:root {
    --primary-color: #E63946; /* Butcher red */
    --primary-hover: #D62828;
    --bg-color: #F8F9FA;
    --sidebar-bg: #1D3557;
    --sidebar-color: #F1FAEE;
    --panel-bg: #FFFFFF;
    --text-main: #212529;
    --text-muted: #6C757D;
    --border-color: #DEE2E6;
    --success: #2A9D8F;
    --danger: #E63946;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* Layout */
.app-container {
    display: flex;
    flex-direction: row-reverse;
    height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-color);
    display: flex;
    flex-direction: column;
}

.logo {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: background-color 0.2s;
}

.logo:hover {
    background-color: rgba(255,255,255,0.05);
}

.logo-img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 50%;
    background: white;
}

.logo h1 {
    font-size: 18px;
    line-height: 1.2;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.nav-links {
    list-style: none;
    margin: 16px 0;
}

.sales-summary {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid var(--border-color);
    text-align: right;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
}
.sales-summary span {
    color: var(--primary-color);
    margin-left: 8px;
}

.nav-links li a {
    display: block;
    padding: 12px 24px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
}

.nav-links li a:hover, .nav-links li a.active {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
    border-left: 4px solid var(--primary-color);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 32px;
    position: relative;
    z-index: 1;
}

.main-content::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    background-image: url('logo.jpg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.10;
    mix-blend-mode: multiply;
    pointer-events: none;
    z-index: -1;
}

/* Views */
.view {
    display: none;
    flex-direction: column;
    height: 100%;
}
.view.active {
    display: flex;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* Panels */
.panel {
    background: rgba(255, 255, 255, 0.85); /* Semi-transparent to show watermark */
    backdrop-filter: blur(4px); /* Glassmorphism effect */
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    padding: 24px;
}

/* PDV Grid */
.pdv-grid {
    display: flex;
    gap: 24px;
    flex: 1;
    min-height: 0;
}

.pdv-left {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pdv-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.barcode-input-container input {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
}

/* Print Rules for 80mm Receipt */
.print-only {
    display: none;
}

@media print {
    body, html {
        height: auto !important;
        overflow: visible !important;
        background: #fff !important;
    }
    body > :not(#print-area) {
        display: none !important;
    }
    .print-only {
        display: block !important;
    }
    #print-area {
        display: block !important;
        position: relative;
        width: 80mm;
        margin: 0;
        padding: 0;
        font-family: 'Courier New', Courier, monospace;
        font-size: 12px;
        color: #000;
    }
    .ticket-header {
        text-align: center;
        margin-bottom: 10px;
        border-bottom: 1px dashed #000;
        padding-bottom: 10px;
    }
    .ticket-header img {
        max-width: 60px;
        margin-bottom: 5px;
        filter: grayscale(100%);
    }
    .ticket-title {
        font-size: 16px;
        font-weight: bold;
    }
    .ticket-item {
        border-bottom: 1px dashed #ccc;
        padding: 5px 0;
        margin-bottom: 5px;
    }
    .ticket-item-title {
        font-weight: bold;
        margin-bottom: 3px;
    }
    .ticket-item-details {
        display: flex;
        justify-content: space-between;
        font-size: 11px;
    }
    .ticket-totals {
        border-top: 1px dashed #000;
        padding-top: 5px;
        margin-bottom: 10px;
    }
    .ticket-totals div {
        display: flex;
        justify-content: space-between;
        margin-bottom: 2px;
    }
    .ticket-totals .bold {
        font-weight: bold;
        font-size: 14px;
    }
    .ticket-customer {
        border-top: 1px dashed #000;
        padding-top: 5px;
        margin-bottom: 10px;
    }
    .ticket-footer {
        text-align: center;
        border-top: 1px dashed #000;
        padding-top: 10px;
        font-size: 10px;
    }
}    outline: none;
    transition: box-shadow 0.2s;
}
.barcode-input-container input:focus {
    box-shadow: 0 0 0 4px rgba(230, 57, 70, 0.2);
}

.cart-list {
    flex: 1;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    border-radius: 12px;
    padding: 16px;
    overflow-y: auto;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05);
    position: relative;
    z-index: 1;
}

.cart-list::before {
    content: '';
    position: fixed; /* Fixed relative to the container if possible, but absolute works if parent is relative */
    /* Wait, position: absolute inside scrollable container scrolls. Let's use absolute. */
}

/* Let's fix the above to valid css: */
.cart-list::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70%;
    height: 70%;
    transform: translate(-50%, -50%);
    background-image: var(--bg-logo);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.04;
    pointer-events: none;
    z-index: -1;
}

.empty-cart-message {
    text-align: center;
    color: var(--text-muted);
    margin-top: 40px;
    font-size: 16px;
}

/* Buttons */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}
.btn-primary {
    background: var(--primary-color);
    color: white;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
    background: #E9ECEF;
    color: var(--text-main);
}
.btn-secondary:hover { background: #DEE2E6; }
.btn-large {
    width: 100%;
    padding: 16px;
    font-size: 18px;
    margin-bottom: 12px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.data-table th {
    color: var(--text-muted);
    font-weight: 600;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-overlay.hidden { display: none; }
.modal {
    background: white;
    width: 400px;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}
.btn-close { background: none; border: none; font-size: 24px; cursor: pointer; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select {
    width: 100%; padding: 10px;
    border: 1px solid var(--border-color); border-radius: 6px;
}
.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }

/* Utilities */
.hidden { display: none !important; }
.totals { margin: 24px 0; }
.total-row { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 18px; }
.grand-total { font-size: 28px; font-weight: 700; color: var(--primary-color); border-top: 2px solid var(--border-color); padding-top: 12px;}

.status-indicator { display: flex; align-items: center; gap: 8px; font-weight: 500;}
.status-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; background: #ccc; }
.status-dot.green { background: var(--success); }

/* Cart items */
.cart-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.cart-item-details { flex: 1; }
.cart-item-name { font-weight: 600; font-size: 16px; }
.cart-item-meta { color: var(--text-muted); font-size: 14px; }
.cart-item-price { font-weight: 700; font-size: 16px; }

/* Mobile Header */
.mobile-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-color);
    padding: 12px 16px;
    font-size: 1.2rem;
    font-weight: bold;
}

#btn-mobile-menu {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Responsividade (Mobile) */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .mobile-topbar {
        display: flex;
    }

    .sidebar {
        position: fixed;
        right: -260px; /* Escondido por padrão na direita */
        top: 0;
        bottom: 0;
        z-index: 1000;
        transition: right 0.3s ease;
        box-shadow: -2px 0 8px rgba(0,0,0,0.5);
    }

    .sidebar.open {
        right: 0;
    }

    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .pdv-grid, .delivery-grid {
        grid-template-columns: 1fr;
    }

    .cart-summary {
        position: static;
        margin-top: 16px;
    }
}
