:root {
    /* Color Palette - Premium Dark Theme with vibrant accents */
    --bg-main: #0b1121;
    --bg-surface: #151e32;
    --bg-surface-hover: #1e293b;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-blue: #3b82f6;
    --accent-blue-glow: rgba(59, 130, 246, 0.4);
    --accent-green: #10b981;
    --accent-green-glow: rgba(16, 185, 129, 0.4);
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --accent-purple: #8b5cf6;
    
    --border-color: rgba(255, 255, 255, 0.08);
    
    --font-family: 'Inter', system-ui, sans-serif;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -1px rgba(0,0,0,0.2);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.4), 0 8px 10px -6px rgba(0,0,0,0.2);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: radial-gradient(circle at top right, rgba(59, 130, 246, 0.05), transparent 40%),
                      radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.05), transparent 40%);
}

/* Dashboard Layout */
.dashboard-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: rgba(21, 30, 50, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 32px 0;
    z-index: 10;
    transition: var(--transition);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 48px;
    letter-spacing: -0.5px;
}

.logo i {
    color: var(--accent-blue);
    font-size: 28px;
    filter: drop-shadow(0 0 8px var(--accent-blue-glow));
}

.menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 15px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.menu-item i {
    width: 24px;
    text-align: center;
    font-size: 18px;
    transition: var(--transition);
}

.menu-item:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.menu-item.active {
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0) 100%);
    color: var(--text-primary);
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background-color: var(--accent-blue);
    border-radius: 0 4px 4px 0;
    box-shadow: 0 0 10px var(--accent-blue-glow);
}

.menu-item.active i {
    color: var(--accent-blue);
    transform: scale(1.1);
}

.sidebar-footer {
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    scroll-behavior: smooth;
}

.main-content::-webkit-scrollbar {
    width: 6px;
}
.main-content::-webkit-scrollbar-track {
    background: transparent;
}
.main-content::-webkit-scrollbar-thumb {
    background: var(--bg-surface-hover);
    border-radius: var(--radius-full);
}

/* Views Handling */
.view-section {
    display: none;
}
.view-section.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

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

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.6s ease-out;
}

.header-title h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-title p {
    color: var(--text-secondary);
    font-size: 15px;
}

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

.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar i {
    position: absolute;
    left: 18px;
    color: var(--text-secondary);
}

.search-bar input {
    background-color: rgba(21, 30, 50, 0.5);
    border: 1px solid var(--border-color);
    padding: 12px 20px 12px 48px;
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    width: 300px;
    transition: var(--transition);
    backdrop-filter: blur(8px);
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    width: 340px;
    background-color: rgba(21, 30, 50, 0.8);
}

.icon-btn {
    background-color: rgba(21, 30, 50, 0.5);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    backdrop-filter: blur(8px);
}

.icon-btn:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.notification {
    position: relative;
}

.badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--accent-red);
    color: white;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--bg-main);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.profile {
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    padding: 6px 16px 6px 6px;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    transition: var(--transition);
}

.profile:hover {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: var(--border-color);
}

.profile img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-blue);
    box-shadow: 0 0 10px var(--accent-blue-glow);
}

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

.profile-info .name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-info .role {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Cards General */
.card {
    background-color: rgba(21, 30, 50, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 28px;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.card:hover {
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

/* KPI Cards */
.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.kpi-card {
    display: flex;
    align-items: center;
    gap: 24px;
    animation: fadeInUp 0.6s ease-out backwards;
}

.kpi-card:nth-child(1) { animation-delay: 0.1s; }
.kpi-card:nth-child(2) { animation-delay: 0.2s; }
.kpi-card:nth-child(3) { animation-delay: 0.3s; }
.kpi-card:nth-child(4) { animation-delay: 0.4s; }

.kpi-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    position: relative;
}

.kpi-icon::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    filter: blur(15px);
    z-index: -1;
    opacity: 0.6;
}

.kpi-icon.blue { background-color: rgba(59, 130, 246, 0.15); color: var(--accent-blue); }
.kpi-icon.blue::after { background-color: var(--accent-blue); }

.kpi-icon.green { background-color: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.kpi-icon.green::after { background-color: var(--accent-green); }

.kpi-icon.yellow { background-color: rgba(245, 158, 11, 0.15); color: var(--accent-yellow); }
.kpi-icon.yellow::after { background-color: var(--accent-yellow); }

.kpi-icon.red { background-color: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.kpi-icon.red::after { background-color: var(--accent-red); }

.kpi-info {
    flex: 1;
}

.kpi-info h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.kpi-info .value {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.trend {
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background-color: rgba(255, 255, 255, 0.05);
}

.trend.up { color: var(--accent-green); background-color: rgba(16, 185, 129, 0.1); }
.trend.down { color: var(--accent-green); background-color: rgba(16, 185, 129, 0.1); }
.trend.neutral { color: var(--text-muted); }

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 1fr 2.2fr;
    gap: 24px;
    margin-bottom: 40px;
    animation: fadeInUp 0.6s ease-out backwards;
    animation-delay: 0.5s;
}

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

.card-header h2 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.tabs {
    display: flex;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding: 4px;
    border: 1px solid var(--border-color);
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.canvas-wrapper {
    position: relative;
    height: 320px;
    width: 100%;
}

/* Bottom Section */
.bottom-section {
    animation: fadeInUp 0.6s ease-out backwards;
    animation-delay: 0.6s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px var(--accent-blue-glow);
    font-family: var(--font-family);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-blue-glow);
    filter: brightness(1.1);
}

/* Info Grid (Caracterizacion) */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-top: 10px;
}

.info-item span {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 4px;
}

.info-item p {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

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

th {
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

td {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-secondary);
}

td strong {
    color: var(--text-primary);
    font-weight: 600;
}

tbody tr {
    transition: var(--transition);
}

tbody tr:hover {
    background-color: rgba(255,255,255,0.03);
    transform: scale(1.005);
}

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

.progress-bar {
    width: 120px;
    height: 6px;
    background-color: rgba(0,0,0,0.3);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 4px;
    display: inline-block;
    vertical-align: middle;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), #60a5fa);
    border-radius: var(--radius-full);
    box-shadow: 0 0 10px var(--accent-blue-glow);
}

.progress-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-left: 12px;
    font-weight: 500;
}

.status {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.status.on-time {
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status.delayed {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.status.maintenance {
    background-color: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 17, 33, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    padding: 32px;
    box-shadow: var(--shadow-lg), 0 0 40px rgba(0,0,0,0.5);
    transform: translateY(20px) scale(0.95);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

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

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--accent-red);
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="text"], input[type="number"], input[type="email"], input[type="password"], select {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 14px;
    transition: var(--transition);
}

input[type="text"]:focus, input[type="number"]:focus, input[type="email"]:focus, input[type="password"]:focus, select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

option {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font-family);
}

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

.action-cell {
    text-align: center;
    width: 80px;
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.btn-icon-danger {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-danger:hover {
    background-color: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.btn-icon-primary {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-primary:hover {
    background-color: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes fadeOutUp {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); }
}

/* Auth Layout */
.auth-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: none;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.15), transparent 40%),
                radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.15), transparent 40%),
                var(--bg-main);
    z-index: 1000;
}

.auth-wrapper.active {
    display: flex;
    animation: fadeIn 0.5s ease-out;
}

.auth-card {
    background-color: rgba(21, 30, 50, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
}

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

.auth-header .logo {
    justify-content: center;
    margin-bottom: 8px;
    font-size: 28px;
    padding: 0;
}

.auth-header #auth-subtitle {
    color: var(--text-secondary);
    font-size: 15px;
}

.auth-form {
    display: none;
    animation: fadeInUp 0.4s ease-out;
}

.auth-form.active {
    display: block;
}

.auth-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.text-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}

.text-link:hover {
    color: #60a5fa;
    text-decoration: underline;
}

.w-100 {
    width: 100%;
    justify-content: center;
}

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 1200px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
    }
    
    .dashboard-container.sidebar-open .sidebar {
        transform: translateX(0);
    }
    
    .kpi-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .search-bar input {
        width: 200px;
    }
    
    .kpi-cards {
        grid-template-columns: 1fr;
    }
}
