﻿/* Estilos Premium - CABINA COEM */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Paleta Armónica HSL tailored */
    --color-bg: #070913;
    --color-card: rgba(21, 29, 51, 0.65);
    --color-card-solid: #151d33;
    --color-border: rgba(36, 48, 79, 0.4);
    --color-border-hover: rgba(59, 130, 246, 0.4);
    
    --color-primary: #3b82f6;
    --color-primary-dark: #1e3a8a;
    --color-primary-light: #93c5fd;
    
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #06b6d4;
    
    --color-text: #f3f4f6;
    --color-text-muted: #9ca3af;
    --color-text-dark: #111827;
    
    --glass-blur: 15px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --radius: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 12px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* Contenedor Principal SPA */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar colapsable */
.sidebar {
    width: 260px;
    background: rgba(11, 15, 30, 0.85);
    border-right: 1px solid var(--color-border);
    backdrop-filter: blur(var(--glass-blur));
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 20px;
}

.sidebar-logo {
    width: 38px;
    height: 38px;
    background: var(--color-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.2rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.sidebar-title {
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.05em;
    color: var(--color-text);
    line-height: 1.2;
}

.sidebar-title span {
    display: block;
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 500;
    letter-spacing: 0.1em;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    cursor: pointer;
}

.menu-item:hover, .menu-item.active {
    color: white;
    background: rgba(59, 130, 246, 0.15);
    border-left: 3px solid var(--color-primary);
}

.menu-item svg {
    width: 20px;
    height: 20px;
}

.sidebar-footer {
    padding-top: 15px;
    border-top: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    font-size: 0.85rem;
}

.user-badge .role {
    font-size: 0.75rem;
    color: var(--color-primary-light);
    display: block;
}

/* Contenido Principal */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 25px;
    transition: var(--transition);
}

/* Header superior */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-border);
}

.main-header h2 {
    font-size: 1.6rem;
    font-weight: 600;
}

.main-header p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* Cards premium con Glassmorphism */
.card {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    backdrop-filter: blur(var(--glass-blur));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: var(--transition);
}

.card:hover {
    border-color: var(--color-border-hover);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.card-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Grid de Indicadores (KPIs) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.kpi-card {
    text-align: center;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-primary);
}

.kpi-card.kpi-success::before { background: var(--color-success); }
.kpi-card.kpi-warning::before { background: var(--color-warning); }
.kpi-card.kpi-danger::before { background: var(--color-danger); }
.kpi-card.kpi-info::before { background: var(--color-info); }

.kpi-value {
    font-size: 2.2rem;
    font-weight: 700;
    margin: 5px 0;
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Gráficos y Dashboard */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Formularios Premium */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: rgba(11, 15, 30, 0.8);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    color: var(--color-text);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Botones Premium */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}
.btn-primary:hover { background: #2563eb; }

.btn-success {
    background: var(--color-success);
    color: white;
}
.btn-success:hover { background: #059669; }

.btn-danger {
    background: var(--color-danger);
    color: white;
}
.btn-danger:hover { background: #dc2626; }

.btn-warning {
    background: var(--color-warning);
    color: white;
}
.btn-warning:hover { background: #d97706; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}
.btn-outline:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--color-text-muted);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Tablas Premium */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--color-border);
}

.table-premium {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    text-align: left;
}

.table-premium th {
    background: rgba(255,255,255,0.03);
    padding: 14px 18px;
    font-weight: 600;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

.table-premium td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}

.table-premium tr:last-child td {
    border-bottom: none;
}

.table-premium tr:hover td {
    background: rgba(255, 255, 255, 0.015);
}

/* Badges / Pill tags */
.badge {
    display: inline-flex;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary { background: rgba(59, 130, 246, 0.15); color: var(--color-primary-light); border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-success { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-info { background: rgba(6, 182, 212, 0.15); color: #22d3ee; border: 1px solid rgba(6, 182, 212, 0.2); }

/* Modales Premium */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 9, 19, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--color-card-solid);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    width: 90%;
    max-width: 550px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.modal-close:hover {
    color: white;
}

/* Pantalla de Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px 30px;
}

.login-logo {
    margin-bottom: 25px;
    text-align: center;
}

.login-logo .logo-ico {
    display: inline-flex;
    width: 50px;
    height: 50px;
    background: var(--color-primary);
    border-radius: 10px;
    color: white;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    margin-bottom: 10px;
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.login-logo p {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* Grid de Selección de Zonales */
.zonales-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.zonal-checkbox-card {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.zonal-checkbox-card input {
    cursor: pointer;
}

.zonal-checkbox-card:hover {
    background: rgba(59, 130, 246, 0.05);
    border-color: var(--color-border-hover);
}

.zonal-checkbox-card.selected {
    background: rgba(59, 130, 246, 0.12);
    border-color: var(--color-primary);
}

/* Spinner de carga */
.loader-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(7, 9, 19, 0.8);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
}

.loader-overlay.active {
    display: flex;
}

.spinner {
    border: 3px solid rgba(255,255,255,0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: var(--color-primary);
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Tostadas / Toasts */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--color-card-solid);
    border-left: 4px solid var(--color-primary);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    padding: 12px 20px;
    min-width: 250px;
    max-width: 350px;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease forwards;
}

.toast.toast-success { border-left-color: var(--color-success); }
.toast.toast-warning { border-left-color: var(--color-warning); }
.toast.toast-danger { border-left-color: var(--color-danger); }

@keyframes slideIn {
    from { transform: translateX(120%); }
    to { transform: translateX(0); }
}

/* Responsividad general */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 240px;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    
    /* Botón flotante para menú en móviles */
    .mobile-menu-toggle {
        display: block !important;
        position: fixed;
        bottom: 20px;
        left: 20px;
        z-index: 200;
        width: 48px;
        height: 48px;
        background: var(--color-primary);
        border-radius: 50%;
        color: white;
        border: none;
        box-shadow: 0 4px 15px rgba(0,0,0,0.3);
        cursor: pointer;
    }
}

.mobile-menu-toggle {
    display: none;
}

/* Nuevos utilitarios - Gestión de Turnos y Matriz */
.grid {
    display: grid;
    gap: 20px;
}
.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.well {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 12px;
    font-size: 0.9rem;
    white-space: pre-wrap;
    width: 100%;
}
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
    gap: 15px;
}
.detail-row:last-child {
    border-bottom: none;
}
.detail-label {
    font-weight: 500;
    color: var(--color-text-muted);
}
.detail-value {
    font-weight: 600;
    color: var(--color-text);
}
.badge-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}
.badge-outline {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}
.btn-xs {
    padding: 3px 8px;
    font-size: 0.75rem;
    border-radius: 12px;
}

/* Temas Personalizados */
body.theme-ocean {
    --color-bg: #001220;
    --color-card: rgba(0, 31, 56, 0.65);
    --color-card-solid: #001f38;
    --color-border: rgba(0, 85, 138, 0.4);
    --color-border-hover: rgba(0, 168, 232, 0.4);
    --color-primary: #00a8e8;
    --color-primary-dark: #007ea7;
    --color-primary-light: #48cae4;
    --color-text: #e0fbfc;
}

body.theme-light {
    --color-bg: #f3f4f6;
    --color-card: rgba(255, 255, 255, 0.85);
    --color-card-solid: #ffffff;
    --color-border: rgba(209, 213, 219, 0.6);
    --color-border-hover: rgba(59, 130, 246, 0.6);
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-light: #60a5fa;
    --color-text: #111827;
    --color-text-muted: #4b5563;
    --color-text-dark: #111827;
}

body.theme-light .sidebar {
    background: rgba(255, 255, 255, 0.95);
}
body.theme-light .menu-item { color: #4b5563; }
body.theme-light .menu-item:hover, body.theme-light .menu-item.active { color: var(--color-primary-dark); }
body.theme-light .table-premium th { color: #374151; background: rgba(0,0,0,0.05); }
body.theme-light .card { border-color: #e5e7eb; box-shadow: 0 4px 6px rgba(0,0,0,0.05); }

/* Theme Selector UI */
.theme-selector {
    position: fixed;
    bottom: 20px;
    left: 20px;
    display: flex;
    gap: 8px;
    background: var(--color-card);
    padding: 8px 12px;
    border-radius: 50px;
    border: 1px solid var(--color-border);
    backdrop-filter: blur(10px);
    z-index: 1000;
}

.theme-btn {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
}
.theme-btn:hover { transform: scale(1.1); }
.theme-btn.active { border-color: white; box-shadow: 0 0 10px rgba(255,255,255,0.5); }
.theme-dark-btn { background: #070913; }
.theme-ocean-btn { background: #001220; }
.theme-light-btn { background: #f3f4f6; }
/* Tema Light Fixes */
body.theme-light {
    --color-bg: #f8fafc;
    --color-card: #ffffff;
    --color-card-solid: #ffffff;
    --color-border: #e2e8f0;
    --color-border-hover: #94a3b8;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-primary-light: #60a5fa;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
}

body.theme-light .card {
    background-color: #ffffff;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    border: 1px solid #e2e8f0;
}

body.theme-light .form-control {
    background-color: #f1f5f9;
    color: #1e293b;
    border-color: #cbd5e1;
}

body.theme-light .form-control:focus {
    background-color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

body.theme-light .table-premium th {
    background-color: #f1f5f9;
    color: #334155;
    border-bottom: 2px solid #e2e8f0;
}

body.theme-light .table-premium td {
    border-bottom: 1px solid #f1f5f9;
}

body.theme-light .table-premium tbody tr:hover {
    background-color: #f8fafc;
}

body.theme-light select option {
    background-color: #ffffff;
    color: #1e293b;
}

body.theme-light .modal-content {
    background-color: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

body.theme-light .modal-header {
    border-bottom: 1px solid #e2e8f0;
}

body.theme-light .modal-footer {
    border-top: 1px solid #e2e8f0;
    background-color: #f8fafc;
}

.card { border-radius: 12px !important; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2) !important; border: 1px solid rgba(255,255,255,0.05) !important; background: var(--bg-color); }

.btn { border-radius: 8px !important; }

