/* assets/css/estilo.css - Modern Premium UI */

:root {
    /* Fallbacks en caso de que no carguen desde PHP */
    --color-primario: #004aad;
    --color-secundario: #002d6b;
    --color-texto: #4b5563;
    --color-titulos: #1e293b;
    --color-bg-glass: rgba(255, 255, 255, 0.7);
    --color-bg-glass-hover: rgba(255, 255, 255, 0.85);
    --border-glass: rgba(255, 255, 255, 0.5);
    --shadow-soft: 0 10px 40px -10px rgba(0,0,0,0.08);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-texto);
    /* El fondo viene dinámicamente en el tag style del header */
    background-image: var(--fondo-url) !important;
    background-size: cover !important;
    background-attachment: fixed !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
}

/* Capa oscura/clara para legibilidad sobre fondos complejos */
.bg-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.4) 0%, rgba(226, 232, 240, 0.2) 100%);
    backdrop-filter: blur(8px);
    z-index: 0;
}

.app-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--color-titulos);
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

/* Contenedores Principales con Glassmorphism Premium */
.container, .panel, .launchpad-container {
    width: 100%;
    margin: 0 auto;
    background: var(--color-bg-glass);
    border-radius: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 2.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.container { max-width: 600px; }
.panel { max-width: 1200px; }
.launchpad-container { max-width: 900px; margin-top: 4vh; }

/* Efecto Hover Suave en Paneles */
.container:hover, .panel:hover {
    box-shadow: 0 15px 50px -10px rgba(0,0,0,0.12);
}

/* ==============================================================
   BOTONES E INPUTS
============================================================== */
button, .btn, input[type="submit"] {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--color-primario), var(--color-secundario));
    color: white;
    border: none;
    padding: 0.8rem 1.8rem;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

button:hover, .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    filter: brightness(1.1);
}

button:active, .btn:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.8);
    color: var(--color-titulos);
    border: 1px solid rgba(0,0,0,0.1);
}
.btn-secondary:hover {
    background: #fff;
    color: var(--color-primario);
}

label {
    font-weight: 500;
    color: var(--color-titulos);
    margin-top: 1rem;
    margin-bottom: 0.4rem;
    display: block;
    font-size: 0.95rem;
}

input, select, textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    margin-bottom: 1.2rem;
    border: 2px solid rgba(226, 232, 240, 0.8);
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-titulos);
    font-size: 1rem;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primario);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 74, 173, 0.1);
}

/* ==============================================================
   TABLAS Y DATOS
============================================================== */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

th {
    background-color: rgba(248, 250, 252, 0.7);
    color: var(--color-titulos);
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    letter-spacing: 0.02em;
}

th:first-child { border-top-left-radius: 12px; }
th:last-child { border-top-right-radius: 12px; }

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.5);
}

/* ==============================================================
   LAUNCHPAD (INDEX.PHP)
============================================================== */
.launchpad-header {
    text-align: center;
    margin-bottom: 3rem;
}

.launchpad-logo {
    max-height: 90px;
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.launchpad-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.launch-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: 20px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: var(--color-texto);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.launch-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, transparent, rgba(255,255,255,0.4));
    opacity: 0;
    transition: opacity 0.4s ease;
}

.launch-card:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 20px 40px -10px rgba(0,0,0,0.15);
    border-color: var(--color-primario);
}

.launch-card:hover::before { opacity: 1; }

.launch-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--color-primario), var(--color-secundario));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: transform 0.4s ease;
}

.launch-card:hover .launch-icon {
    transform: scale(1.1);
}

.launch-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.launch-info p {
    font-size: 0.9rem;
    opacity: 0.8;
}

.launch-arrow {
    margin-top: 1.5rem;
    font-size: 1.2rem;
    color: var(--color-primario);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.4s ease;
}

.launch-card:hover .launch-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ==============================================================
   ANIMACIONES GLOBALES
============================================================== */
.fade-in-up {
    animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.pulse-animation {
    animation: pulse 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

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

/* ==============================================================
   RESPONSIVO
============================================================== */
@media (max-width: 768px) {
    .container, .panel, .launchpad-container { padding: 1.5rem; }
    .launchpad-grid { grid-template-columns: 1fr; }
}

/* Mantenemos las clases utilitarias anteriores por compatibilidad temporal */
.header { text-align: center; margin-bottom: 1.5rem; }
.menu-admin { display: flex; gap: 0.75rem; margin-bottom: 2rem; flex-wrap: wrap; }
.menu-admin a { background: rgba(255,255,255,0.7); color: var(--color-primario); padding: 0.5rem 1.2rem; border-radius: 40px; text-decoration: none; font-weight: 500; border: 1px solid rgba(0,0,0,0.05); transition: all 0.2s ease;}
.menu-admin a:hover { background: var(--color-primario); color: white; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.1);}

/* ==============================================================
   BADGES Y ESTADOS
============================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge-pendiente { color: #2563eb; background: rgba(239, 246, 255, 0.7); border: 1px solid rgba(37, 99, 235, 0.2); }
.badge-rellamado { color: #d97706; background: rgba(254, 243, 199, 0.7); border: 1px solid rgba(217, 119, 6, 0.2); }
.badge-atendido { color: #16a34a; background: rgba(220, 252, 231, 0.7); border: 1px solid rgba(22, 163, 74, 0.2); }
.badge-cancelado { color: #dc2626; background: rgba(254, 226, 226, 0.7); border: 1px solid rgba(220, 38, 38, 0.2); }
.badge-area { background: rgba(0,0,0,0.05); color: var(--color-titulos); }

.tr-pendiente { background-color: rgba(239, 246, 255, 0.7); }
.tr-rellamado { background-color: rgba(254, 243, 199, 0.7); }
.tr-atendido { background-color: rgba(220, 252, 231, 0.5); }
.tr-cancelado { background-color: rgba(254, 226, 226, 0.5); }

/* ==============================================================
   UTILIDADES
============================================================== */
.text-center { text-align: center; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mt-2 { margin-top: 1rem; }
.mt-4 { margin-top: 2rem; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1rem; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }

.alert {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-weight: 500;
}
.alert-error {
    background: rgba(254, 226, 226, 0.9);
    color: #dc2626;
    border: 1px solid #f87171;
}
.alert-success {
    background: rgba(220, 252, 231, 0.9);
    color: #16a34a;
    border: 1px solid #4ade80;
}
.alert-warning {
    background: rgba(254, 243, 199, 0.9);
    color: #d97706;
    border: 1px solid #fbbf24;
}

/* ==============================================================
   GRÁFICOS (Flujo de Atención)
================================================================ */
.charts-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-panel-v2 {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    max-height: 400px;
}

.chart-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--color-primario);
    width: 100%;
    text-align: left;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    padding-bottom: 0.5rem;
}

.doughnut-wrapper {
    position: relative;
    height: 250px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.chart-panel-v2 canvas {
    max-height: 300px;
    width: 100% !important;
}

.top3-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.top3-card {
    display: flex;
    align-items: center;
    padding: 0.8rem;
    border-radius: 8px;
}
.top3-medalla {
    font-size: 2rem;
    margin-right: 1rem;
}
.top3-info {
    flex: 1;
}
.top3-nombre {
    font-weight: 600;
    font-size: 1rem;
    display: block;
}
.top3-bar-wrap {
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
    height: 6px;
    margin: 0.3rem 0;
    overflow: hidden;
}
.top3-bar-fill {
    height: 100%;
    border-radius: 4px;
}
.top3-stats {
    font-size: 0.8rem;
    color: #64748b;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.kpi-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.kpi-icon {
    font-size: 2.5rem;
}
.kpi-data {
    display: flex;
    flex-direction: column;
}
.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--color-titulos);
    line-height: 1.2;
}
.kpi-label {
    font-size: 0.9rem;
    color: #64748b;
}