:root {
    --sidebar-width: 250px;
    --header-height: 60px;
    --primary-color: #1976D2;
    --accent-color: #00b4d8;
    --bg-color: #EAEDED;
    --text-color: #2c3e50;
    --white: #ffffff;
    --border-color: #dcdde1;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--white);
    color: var(--text-color);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

.brand {
    padding: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-menu {
    padding: 20px 0;
}

.sidebar-menu a {
    display: block;
    padding: 15px 25px;
    color: #576574;
    text-decoration: none;
    transition: 0.3s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: #e3f2fd;
    color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
}

.sidebar-menu i {
    width: 20px;
}

.sidebar-menu a[href="login.html"] {
    background-color: #e74c3c;
    color: white !important;
    margin: 20px;
    text-align: center;
    border-radius: 5px;
    font-weight: bold;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sidebar-menu a[href="login.html"]:hover {
    background-color: #c0392b;
    border-left: none;
    /* remove default active border */
    transform: translateY(-2px);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    height: var(--header-height);
    background-color: var(--white);
    padding: 0 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.content {
    padding: 25px;
    flex: 1;
    overflow-y: auto;
    /* Allow scrolling within content if needed, but per-module optimization is better */
    display: flex;
    flex-direction: column;
}

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--white);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #DADCE0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.card-title {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.card-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #DADCE0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.data-table th,
.data-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background-color: #f8f9fa;
    color: #7f8c8d;
    font-weight: 600;
}

.status-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-recibido {
    background-color: #e1f5fe;
    color: #0288d1;
}

.status-proceso {
    background-color: #fff3e0;
    color: #f57c00;
}

.status-listo {
    background-color: #e8f5e9;
    color: #388e3c;
}

.status-entregado {
    background-color: #eceff1;
    color: #546e7a;
}

.status-cancelado {
    background-color: #fab1a0;
    color: #c0392b;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    margin-right: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.action-btn i {
    pointer-events: none;
    /* Prevent icon from capturing click */
}

.btn-edit {
    background-color: #3498db;
    color: white;
}

.btn-delete {
    background-color: #e74c3c;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        width: 250px;
        /* Ensure width is fixed */
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .header {
        padding: 0 15px;
    }

    /* Mobile Menu Toggle Button (will be added to HTML) */
    .menu-toggle {
        display: block !important;
        font-size: 1.5rem;
        cursor: pointer;
        margin-right: 15px;
    }

    /* Table Responsiveness */
    .card {
        overflow-x: auto;
    }

    .data-table {
        min-width: 600px;
        /* Force scroll */
    }

    /* POS Grid */
    .pos-grid {
        display: flex;
        flex-direction: column;
        height: auto;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        height: 50vh;
        /* Fixed height for scroll on mobile */
    }

    .cart-panel {
        height: auto;
        border-radius: 8px;
    }
}

.menu-toggle {
    display: none;
    /* Hidden on desktop */
}

.card.full-height {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.table-container {
    flex: 1;
    overflow-y: auto;
}

/* --- Added Modal and Button Styles for Orders --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--white);
    padding: 40px;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.05);
    animation: modalFadeIn 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.modal-content h3 {
    margin-bottom: 25px;
    font-size: 1.5rem;
    color: var(--text-color);
    text-align: center;
    font-weight: 700;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.payment-methods {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin: 20px 0;
}

.method-btn {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.method-btn.active {
    border-color: var(--accent-color);
    background-color: rgba(0, 180, 216, 0.1);
    color: var(--accent-color);
}

.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.input-group input,
.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #dcdde1;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #fcfcfc;
}

.input-group input:focus,
.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent-color);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.1);
    outline: none;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 25px;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 180, 216, 0.2);
}

.btn-primary:hover {
    background-color: #0096c7;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 180, 216, 0.3);
}

.btn-secondary {
    background-color: #f1f2f6;
    color: #2c3e50;
    border: 1px solid #dcdde1;
    padding: 12px 25px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background-color: #e4e7eb;
    color: #1e272e;
}

/* --- PRINT MEDIA QUERIES (THERMAL PRINTERS) --- */
@media print {
    body * {
        visibility: hidden;
    }

    #ticketModal,
    #ticketModal * {
        visibility: visible;
    }

    #ticketModal {
        position: absolute;
        left: 0;
        top: 0;
        margin: 0;
        padding: 0;
        width: 100%;
        background: white;
    }

    /* Hide modal UI elements that shouldn't print */
    .modal-actions,
    .close,
    .no-print {
        display: none !important;
    }

    .modal-content {
        box-shadow: none;
        border: none;
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    /* Ensure specific formatting for receipt content if needed */
    .ticket-content {
        font-family: 'Courier New', Courier, monospace;
        width: 100%;
        max-width: 80mm;
        /* Adjust for 80mm or 58mm logic if dynamic? Usually responsive works */
        margin: 0 auto;
        font-size: 12px;
    }

    /* Helper for forcing black text */
    * {
        color: black !important;
        -webkit-print-color-adjust: exact;
    }
}