/* ==========================================================================
   KERO'S POS - ESTILOS VISUALES PREMIUM (GLASSMORPHISM & DARK MODE)
   ========================================================================== */

:root {
    --bg-primary: #0a0a0d;
    --bg-secondary: #121218;
    --glass-bg: rgba(22, 22, 30, 0.7);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-glow: rgba(231, 76, 60, 0.15);
    
    --accent-red: #e74c3c;
    --accent-red-hover: #c0392b;
    --accent-green: #2ecc71;
    --accent-blue: #3498db;
    --accent-yellow: #f1c40f;
    
    --text-primary: #ffffff;
    --text-muted: #8e8e9f;
    --text-dark: #121214;
    
    --font-headers: 'Montserrat', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --border-radius: 12px;
    --transition-speed: 0.3s;
    --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --blur-value: blur(16px);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-headers);
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Header Cohesion */
.pos-header {
    background: rgba(10, 10, 13, 0.9);
    backdrop-filter: var(--blur-value);
    -webkit-backdrop-filter: var(--blur-value);
    border-bottom: 1px solid var(--glass-border);
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-container {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-title {
    font-family: var(--font-headers);
    font-weight: 900;
    font-size: 20px;
    letter-spacing: 1px;
    color: var(--text-primary);
}

.logo-sub {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 2px;
    color: var(--accent-red);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sync-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    padding: 6px 12px;
    border-radius: 20px;
    color: var(--text-muted);
}

.sync-badge.online {
    color: var(--accent-green);
    border-color: rgba(46, 204, 113, 0.2);
    background: rgba(46, 204, 113, 0.05);
}

.sync-badge.offline {
    color: var(--accent-yellow);
    border-color: rgba(241, 196, 15, 0.2);
    background: rgba(241, 196, 15, 0.05);
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    display: inline-block;
}

/* App Layout */
.app-container {
    flex: 1;
    display: flex;
    flex-direction: row;
    position: relative;
    min-height: calc(100vh - 65px);
}

/* Sidebar Navigation */
.sidebar {
    width: 250px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 0;
    transition: var(--transition-speed);
    
    /* Hacer el menú lateral fijo al hacer scroll en escritorio */
    position: sticky;
    top: 65px; /* Altura de la cabecera pos-header */
    height: calc(100vh - 65px);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 25px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: var(--transition-speed);
}

.sidebar-item.active a,
.sidebar-item a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.02);
}

.sidebar-item.active a {
    border-left-color: var(--accent-red);
    background: rgba(231, 76, 60, 0.05);
}

/* Main Content Panel */
.main-content {
    flex: 1;
    padding: 30px;
    background: radial-gradient(circle at top right, rgba(231, 76, 60, 0.03), transparent 60%);
    overflow-y: auto;
}

/* Tab Panels */
.tab-panel {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-value);
    -webkit-backdrop-filter: var(--blur-value);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow-main);
    position: relative;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    background: linear-gradient(90deg, var(--accent-red), transparent);
    opacity: 0.5;
}

.card-title {
    font-size: 18px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Dashboard Summary Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition-speed);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(231, 76, 60, 0.2);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 28px;
    font-weight: 800;
    margin: 10px 0;
    font-family: var(--font-headers);
}

.stat-change {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.change-up { color: var(--accent-green); }
.change-down { color: var(--accent-red); }

/* Forms styling */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
    transition: var(--transition-speed);
}

.form-group select option {
    background-color: #121218;
    color: #ffffff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-red);
    background: rgba(255, 255, 255, 0.07);
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.2);
}

/* Estilo para el icono del calendario en campos de fecha (Modo Oscuro) */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.2);
    cursor: pointer;
    transform: scale(1.25);
    opacity: 0.75;
    transition: opacity 0.2s, transform 0.2s;
}

input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    transform: scale(1.4);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 50px;
    padding: 12px 28px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.25), inset 0 -2px 4px rgba(0, 0, 0, 0.3), 0 4px 15px rgba(0, 0, 0, 0.4);
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.btn-primary {
    background: linear-gradient(180deg, #d38312, #a85b00);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #e59324, #b96b00);
    transform: translateY(-1px);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3), inset 0 -2px 4px rgba(0, 0, 0, 0.3), 0 0 20px rgba(211, 131, 18, 0.6);
}

.btn-success {
    background: linear-gradient(180deg, #2ecc71, #1e824c);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-success:hover {
    background: linear-gradient(180deg, #40d47e, #249758);
    transform: translateY(-1px);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3), inset 0 -2px 4px rgba(0, 0, 0, 0.3), 0 0 20px rgba(46, 204, 113, 0.6);
}

.btn-secondary {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05));
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(180deg, #e74c3c, #c0392b);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-danger:hover {
    background: linear-gradient(180deg, #ea6153, #d64535);
    transform: translateY(-1px);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3), inset 0 -2px 4px rgba(0, 0, 0, 0.3), 0 0 20px rgba(231, 76, 60, 0.6);
}

/* Tables styling */
.table-responsive {
    overflow-x: auto;
    margin-top: 15px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--glass-border);
}

th {
    font-family: var(--font-headers);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    font-size: 14px;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

/* Map Styling */
.map-container {
    height: 450px;
    border-radius: var(--border-radius);
    border: 1px solid var(--glass-border);
    z-index: 1;
    background-color: #1a1a1f;
}

/* Mobile Toggle Hamburger and bottom tabs */
.mobile-nav-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    background: rgba(18, 18, 24, 0.95);
    backdrop-filter: var(--blur-value);
    border-top: 1px solid var(--glass-border);
    z-index: 1000;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
}

.mobile-nav-item.active {
    color: var(--accent-red);
}

.mobile-nav-icon {
    font-size: 20px;
}

/* Suspension / Activation Screen Overlay */
.suspension-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 13, 0.98);
    backdrop-filter: blur(25px);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.suspension-card {
    background: rgba(30, 30, 40, 0.8);
    border: 1px solid rgba(231, 76, 60, 0.3);
    box-shadow: 0 15px 50px rgba(231, 76, 60, 0.2);
    border-radius: var(--border-radius);
    padding: 40px;
    max-width: 480px;
    width: 100%;
    text-align: center;
}

.suspension-icon {
    font-size: 64px;
    color: var(--accent-red);
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.suspension-card h2 {
    font-size: 24px;
    margin-bottom: 15px;
}

.suspension-card p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* Inventory Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-success { background: rgba(46, 204, 113, 0.15); color: var(--accent-green); }
.badge-danger { background: rgba(231, 76, 60, 0.15); color: var(--accent-red); }
.badge-info { background: rgba(52, 152, 219, 0.15); color: var(--accent-blue); }

/* GPS Console control */
.gps-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

/* Offline sync logs list */
.sync-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sync-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    padding: 10px 15px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

/* ==========================================================================
   MEDIA QUERIES (RESPONSIVE BEHAVIOR)
   ========================================================================== */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        padding-bottom: 65px; /* space for mobile nav */
    }
    
    .sidebar {
        display: none; /* hidden on mobile, replaced by bottom bar */
    }
    
    .mobile-nav-bar {
        display: flex;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .btn {
        width: 100%;
    }
    
    .gps-controls {
        flex-direction: column;
    }
}

/* Active Fleet View Mode Button Override */
.btn.active-fleet-view {
    background: linear-gradient(180deg, #2ecc71, #27ae60) !important;
    border-color: #27ae60 !important;
    box-shadow: 0 0 15px rgba(46,204,113,0.6) !important;
    color: #fff !important;
}
.btn.active-fleet-view:hover {
    background: linear-gradient(180deg, #2ecc71, #2ecc71) !important;
    box-shadow: 0 0 20px rgba(46,204,113,0.8) !important;
}

/* Scrollable Mobile Nav Bar */
@media (max-width: 768px) {
    .mobile-nav-bar {
        display: flex;
        overflow-x: auto;
        white-space: nowrap;
        gap: 15px;
        padding: 10px 15px;
        background: rgba(18, 18, 30, 0.95);
        border-top: 1px solid var(--glass-border);
        box-shadow: 0 -5px 25px rgba(0,0,0,0.6);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .mobile-nav-bar::-webkit-scrollbar {
        display: none;
    }
    .mobile-nav-item {
        flex: 0 0 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: var(--text-muted);
        font-size: 11px;
        font-weight: 600;
        transition: color 0.3s ease;
    }
    .mobile-nav-item.active {
        color: var(--accent-orange);
    }
}

/* Grid input and table layout for Weekly Planilla */
.grid-table {
    border-collapse: collapse;
    width: 100%;
}
.grid-table th, .grid-table td {
    padding: 10px;
    border: 1px solid var(--glass-border);
    text-align: center;
}
.grid-table th {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-weight: bold;
    font-size: 13px;
}
.grid-table td {
    font-size: 13px;
    color: var(--text-color);
}
.grid-input:focus {
    outline: none;
    border-color: var(--accent-orange) !important;
    background: rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 0 8px rgba(211, 131, 18, 0.5);
}

/* Print styles for liquidation ticket */
@media print {
    body * {
        visibility: hidden;
    }
    #liquidation-receipt-modal, #liquidation-receipt-modal * {
        visibility: visible;
    }
    #liquidation-receipt-modal {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        background: #fff !important;
        box-shadow: none !important;
        margin: 0;
        padding: 0;
        display: block !important;
    }
    #liquidation-receipt-card {
        max-width: 100%;
        width: 100%;
        border: none !important;
        padding: 0;
        margin: 0;
    }
    .no-print, .no-print * {
        display: none !important;
    }
}

/* Login Overlay styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 18, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}
.login-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

.logout-text-desktop {
    display: inline;
}
@media (max-width: 768px) {
    .logout-text-desktop {
        display: none;
    }
}
