@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-color: #0A1628;      /* Navy oscuro profundo */
    --accent-color: #2563EB;       /* Azul brillante */
    --accent-light: rgba(37, 99, 235, 0.1);
    --success-color: #10B981;      /* Verde esmeralda */
    --success-light: rgba(16, 185, 129, 0.1);
    --warning-color: #F59E0B;      /* Ámbar */
    --warning-light: rgba(245, 158, 11, 0.1);
    --danger-color: #EF4444;       /* Rojo */
    --danger-light: rgba(239, 68, 68, 0.1);
    --bg-color: #F8FAFC;           /* Gris azulado muy claro */
    --card-bg: #FFFFFF;
    --text-primary: #0F172A;       /* Slate 900 */
    --text-secondary: #475569;     /* Slate 600 */
    --text-light: #94A3B8;          /* Slate 400 */
    --border-color: #E2E8F0;       /* Slate 200 */
    --sidebar-width: 260px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Scrollbar Style */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}

/* Page Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-color);
    color: #FFFFFF;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--accent-color), #3B82F6);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #FFFFFF;
}

.logo-subtitle {
    font-size: 10px;
    color: var(--text-light);
    font-weight: 500;
    letter-spacing: 0.2px;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 12px;
    list-style: none;
    overflow-y: auto;
}

.menu-item {
    margin-bottom: 4px;
}

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: #94A3B8;
    transition: var(--transition);
}

.menu-link:hover, .menu-link.active {
    color: #FFFFFF;
    background-color: rgba(255, 255, 255, 0.05);
}

.menu-link.active {
    background-color: var(--accent-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.menu-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background-color: rgba(0, 0, 0, 0.15);
}

.recinto-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
}

.recinto-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
}

.recinto-info {
    flex: 1;
    overflow: hidden;
}

.recinto-name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recinto-status {
    font-size: 10px;
    color: var(--success-color);
    display: flex;
    align-items: center;
    gap: 4px;
}

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

/* Main Content Wrapper */
.app-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* Header Styling */
.app-header {
    height: 70px;
    background-color: #FFFFFF;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-welcome {
    display: flex;
    flex-direction: column;
}

.welcome-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.welcome-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.notification-btn {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.notification-btn:hover {
    background-color: #F1F5F9;
}

.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 16px;
    height: 16px;
    background-color: var(--danger-color);
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    font-size: 9px;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.header-datetime {
    font-size: 13px;
    color: var(--text-secondary);
    background-color: #F8FAFC;
    padding: 8px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--accent-light);
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 11px;
    color: var(--text-light);
    font-weight: 500;
}

/* Page Body Container */
.page-body {
    flex: 1;
    padding: 32px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* Grid Layouts */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

/* Stat Cards */
.stat-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.02);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background-color: var(--accent-color);
}

.stat-card.stat-vehicle::before { background-color: var(--accent-color); }
.stat-card.stat-person::before { background-color: var(--accent-color); }
.stat-card.stat-delivery::before { background-color: var(--warning-color); }
.stat-card.stat-total::before { background-color: var(--success-color); }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-trend {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
}

.trend-up { color: var(--success-color); }
.trend-down { color: var(--danger-color); }
.trend-neutral { color: var(--text-light); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--accent-light);
    color: var(--accent-color);
}

.stat-card.stat-delivery .stat-icon {
    background-color: var(--warning-light);
    color: var(--warning-color);
}

.stat-card.stat-total .stat-icon {
    background-color: var(--success-light);
    color: var(--success-color);
}

/* Content Grid (Dashboard Cards) */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.full-width-grid {
    grid-template-columns: 1fr;
}

/* Card Contenedor */
.card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 24px;
    flex: 1;
}

/* Badges (Pills) */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-success {
    background-color: var(--success-light);
    color: var(--success-color);
}

.badge-danger {
    background-color: var(--danger-light);
    color: var(--danger-color);
}

.badge-warning {
    background-color: var(--warning-light);
    color: var(--warning-color);
}

.badge-info {
    background-color: var(--accent-light);
    color: var(--accent-color);
}

/* Table Design */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.table th {
    padding: 14px 20px;
    background-color: #F8FAFC;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background-color: #F8FAFC;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--accent-color);
    color: #FFFFFF;
}

.btn-primary:hover {
    background-color: #1D4ED8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-secondary {
    background-color: #F1F5F9;
    color: var(--text-secondary);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: #E2E8F0;
}

.btn-danger {
    background-color: var(--danger-color);
    color: #FFFFFF;
}

.btn-danger:hover {
    background-color: #DC2626;
}

.btn-full {
    width: 100%;
}

/* Tabs */
.tabs-container {
    display: flex;
    background-color: #F1F5F9;
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.tab-btn.active {
    background-color: #FFFFFF;
    color: var(--accent-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Forms styling */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-label.required::after {
    content: ' *';
    color: var(--danger-color);
}

.form-control {
    width: 100%;
    padding: 11px 16px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: #FFFFFF;
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* Login View specific */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background-color: #FFFFFF;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.3);
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--accent-color), #3B82F6);
    border-radius: var(--radius-lg);
    color: #FFFFFF;
    font-size: 24px;
    font-weight: 800;
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
    margin-bottom: 16px;
}

.auth-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--primary-color);
}

.auth-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Mobile Bottom Navigation (Bottom bar) */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background-color: #FFFFFF;
    border-top: 1px solid var(--border-color);
    z-index: 110;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 10px;
    font-weight: 500;
    width: 20%;
    height: 100%;
    cursor: pointer;
    transition: var(--transition);
}

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

.mobile-nav-item svg {
    width: 22px;
    height: 22px;
    margin-bottom: 2px;
}

/* Special Floating Plus Action Button for mobile */
.mobile-nav-center {
    position: relative;
    top: -14px;
}

.mobile-nav-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: var(--accent-color);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
    transition: var(--transition);
}

.mobile-nav-fab:hover {
    transform: scale(1.05);
}

/* Verification Scanner Component */
.scanner-container {
    background-color: var(--primary-color);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    color: #FFFFFF;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}

.scanner-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.scanner-subtitle {
    font-size: 13px;
    color: #94A3B8;
    margin-bottom: 24px;
}

.scanner-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.scanner-icon-btn {
    background-color: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 140px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #FFFFFF;
    font-weight: 600;
    font-size: 13px;
    transition: var(--transition);
}

.scanner-icon-btn:hover {
    background-color: rgba(255,255,255,0.08);
    border-color: var(--accent-color);
}

.scanner-icon-btn svg {
    width: 32px;
    height: 32px;
    color: var(--accent-color);
}

.scanner-badge {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Map Style */
.map-container {
    height: 360px;
    background-color: #E2E8F0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

/* Leaflet Map custom fixes */
.leaflet-container {
    height: 100%;
    width: 100%;
}

/* Heatmap indicators */
.heatmap-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background-color: #FFFFFF;
    padding: 12px;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
}

.legend-bar {
    height: 8px;
    width: 100px;
    background: linear-gradient(to right, blue, green, yellow, red);
    border-radius: 4px;
    margin-top: 4px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    
    .app-sidebar.open {
        transform: translateX(0);
    }
    
    .app-content {
        margin-left: 0;
        padding-bottom: 64px; /* Space for bottom nav */
    }
    
    .app-header {
        padding: 0 20px;
    }
    
    .page-body {
        padding: 20px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .mobile-nav {
        display: flex;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .scanner-box {
        justify-content: stretch;
    }
    
    .scanner-icon-btn {
        flex: 1;
        width: 100%;
    }
}
