:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #10b981;
    --error: #ef4444;
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.centered-view {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100%;
    height: 100vh;
}

.dashboard-layout {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem 1.2rem; /* Slightly reduced horizontal padding */
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.main-content {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 2rem; /* Reduced from 2.5rem to be more consistent */
    scroll-behavior: smooth;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    height: 100%;
}

.logo-area {
    margin-bottom: 2.5rem;
    font-weight: 800;
    font-size: 1.4rem;
    padding: 0 0.8rem;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.7rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.8rem;
    margin: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-link i { 
    margin-right: 0.75rem; 
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-link.active, .nav-link:hover {
    background: rgba(99, 102, 241, 0.15);
    color: white;
    transform: translateX(5px);
}

.nav-link-logout {
    margin-top: auto !important;
    color: #ef4444 !important;
}
.nav-link-logout:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444 !important;
}


.login-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-image: linear-gradient(rgba(15, 23, 42, 0.8), rgba(15, 23, 42, 0.8)), url('../img/gaming_bg.png');
    background-size: cover;
    background-position: center;
    filter: blur(5px);
    transform: scale(1.1);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.btn-login {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
}

.btn-login:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--error);
    padding: 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    display: none;
}

.footer-text {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- PREMIUM TWEAKS --- */

@keyframes pulse-glow {
    0% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.2); }
    50% { box-shadow: 0 0 30px rgba(99, 102, 241, 0.5); border-color: #818cf8; }
    100% { box-shadow: 0 0 20px rgba(99, 102, 241, 0.2); }
}

.machine-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.machine-card:hover {
    transform: scale(1.03) translateY(-5px);
    z-index: 10;
}

.machine-card.active {
    border-color: #6366f1;
    animation: pulse-glow 2.5s infinite;
}

.btn-start {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    border: 1px solid rgba(16, 185, 129, 0.5);
}

.btn-stop {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
    border: 1px solid rgba(239, 68, 68, 0.5);
}

.btn-start:hover, .btn-stop:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.sidebar {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* =============================================
   HAMBURGER MENU & MOBILE RESPONSIVE
   ============================================= */

.hamburger-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1100;
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0.75rem;
    width: 44px;
    height: 44px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.hamburger-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
}

.hamburger-btn.is-open .fa-bars { display: none; }
.hamburger-btn.is-open .fa-times { display: inline; }
.hamburger-btn:not(.is-open) .fa-times { display: none; }

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.visible {
    opacity: 1;
}

@media (max-width: 768px) {
    .hamburger-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px;
        box-shadow: 5px 0 30px rgba(0,0,0,0.5);
        padding-top: 4.5rem;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        padding: 1.25rem;
        padding-top: 4.5rem; /* Space for hamburger */
    }

    .dashboard-layout {
        flex-direction: column;
    }

    /* Stats bar / turno bar - stack on mobile */
    .stats-bar,
    .turno-bar {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    /* POS container - stack */
    .pos-container {
        grid-template-columns: 1fr !important;
    }

    /* Product grid - 2 columns on mobile */
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    /* Machine grid - 2 columns on mobile */
    .machine-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
        gap: 1rem !important;
    }

    .machine-card {
        padding: 1rem !important;
    }

    .timer-display {
        font-size: 1.5rem !important;
    }

    /* Toolbar responsive */
    .toolbar {
        flex-direction: column;
    }

    .toolbar .search-box {
        width: 100%;
    }

    /* Client header responsive */
    .client-header {
        flex-direction: column !important;
        gap: 1rem;
        align-items: flex-start !important;
    }

    /* Tables scroll on mobile */
    .client-table-container {
        overflow-x: auto;
    }

    table {
        min-width: 600px;
    }

    /* Cart container full width */
    .cart-container {
        position: static !important;
    }

    /* Filter tabs scroll */
    .filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .filter-tabs::-webkit-scrollbar { display: none; }

    /* Modals */
    .modal .login-container {
        margin: 1rem;
        max-width: calc(100vw - 2rem) !important;
    }

    /* Header tweaks */
    header {
        flex-direction: column !important;
        gap: 0.75rem;
        align-items: flex-start !important;
    }

    h2 {
        font-size: 1.3rem !important;
    }
}

@media (max-width: 480px) {
    .stats-bar,
    .turno-bar {
        grid-template-columns: 1fr 1fr !important;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .machine-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .main-content {
        padding: 1rem;
        padding-top: 4rem;
    }
}


:root {
    --min-tap-size: 48px;
}

.btn-action, .btn-login, .toolbar select, .toolbar input, .nav-item, input[type="number"], select {
    min-height: var(--min-tap-size);
}

.soft-feedback {
    transition: transform 0.1s ease, opacity 0.1s ease;
}
.soft-feedback:active {
    transform: scale(0.95);
    opacity: 0.8;
}


.quick-time-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 1rem;
}
.time-btn {
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    min-height: var(--min-tap-size);
}
.time-btn:active { background-color: var(--primary-color); }

@media (max-width: 768px) {
    .main-content { padding: 1rem; padding-top: 4.5rem; }


    /* Transform Modal to Bottom Sheet */
    .modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }
    .modal .login-container {
        margin: 0 !important;
        max-width: 100% !important;
        width: 100%;
        border-radius: 24px 24px 0 0;
        padding: 24px 20px;
        animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }
}
