/* ============================================================
   YYCL — Sistema de Diseño Corporativo Ejecutivo & Vibrant UI
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Sora:wght@600;700;800&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

:root {
  /* Paleta Oficial YYCL */
  --yycl-yellow:      #FFD403;
  --yycl-yellow-hover:#E6BE00;
  --yycl-yellow-light:#FFFBEB;
  --yycl-navy-dark:   #0B132B;
  --yycl-navy-header: #1C2541;
  --yycl-ink:         #0F172A;
  --yycl-slate-600:   #334155;
  --yycl-slate-400:   #64748B;
  --yycl-border:      #CBD5E1;
  --yycl-bg:          #F1F5F9;
  --yycl-card-bg:     #FFFFFF;

  /* Colores de Estado Enriquecidos y de Alto Contraste */
  --status-ok:        #10B981;
  --status-ok-bg:     #D1FAE5;
  --status-ok-text:   #065F46;
  
  --status-warn:      #F59E0B;
  --status-warn-bg:   #FEF3C7;
  --status-warn-text: #92400E;

  --status-danger:    #EF4444;
  --status-danger-bg: #FEE2E2;
  --status-danger-text:#991B1B;

  --status-info:      #2563EB;
  --status-info-bg:   #DBEAFE;
  --status-info-text: #1E40AF;

  --status-neutral:   #475569;
  --status-neutral-bg:#E2E8F0;
  --status-neutral-text:#1E293B;

  /* Elevaciones & Bordes */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;

  --shadow-sm:  0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:  0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-lg:  0 20px 35px -10px rgba(15, 23, 42, 0.12), 0 10px 15px -5px rgba(15, 23, 42, 0.06);

  /* Tipografía */
  --font-heading: 'Sora', sans-serif;
  --font-title:   'Plus Jakarta Sans', sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
}

/* Reset Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--yycl-bg);
  color: var(--yycl-ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Tamaño de Logo Destacado Legible (54px) */
.brand-logo, .topbar-logo-img {
  height: 54px !important;
  max-height: 54px !important;
  width: auto !important;
  max-width: 220px !important;
  object-fit: contain !important;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.3));
}

.login-logo {
  height: 80px !important;
  max-height: 80px !important;
  width: auto !important;
  max-width: 100% !important;
  object-fit: contain !important;
  margin: 0 auto 1.5rem auto;
  display: block;
}

/* Header Ejecutivo Glassmorphic Principal */
.app-header {
  background: var(--yycl-navy-header);
  color: #FFFFFF;
  padding: 0.95rem 2.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 20px rgba(11, 19, 43, 0.2);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  display: inline-block;
  margin-left: 0.6rem;
  padding-left: 0.75rem;
  border-left: 1px solid rgba(255, 255, 255, 0.25);
}

.user-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.875rem;
}

/* Campanita de Notificaciones / Alertas */
.alert-bell-btn {
  position: relative;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #FFFFFF;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.alert-bell-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

.alert-bell-btn svg {
  width: 22px;
  height: 22px;
}

.bell-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background-color: var(--status-danger);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--yycl-navy-header);
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.8);
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  padding: 0.4rem 0.9rem;
  border-radius: 30px;
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sync-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--status-ok);
  box-shadow: 0 0 8px var(--status-ok);
}

.sync-dot.warning {
  background-color: var(--status-warn);
  box-shadow: 0 0 8px var(--status-warn);
}

/* Contenedor Principal (Full Width Limpio) */
.app-container {
  max-width: 1400px;
  width: 100%;
  margin: 2.25rem auto;
  padding: 0 1.75rem 3rem 1.75rem;
}

/* Header de Sección */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.75rem;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--yycl-navy-dark);
  letter-spacing: -0.025em;
}

/* Selector de Año Dinámico */
.year-select-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: #FFFFFF;
  border: 2px solid var(--yycl-yellow);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--yycl-navy-dark);
  box-shadow: var(--shadow-sm);
  margin-left: 0.5rem;
}

.year-select-badge select {
  background: transparent;
  border: none;
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--yycl-navy-dark);
  outline: none;
  cursor: pointer;
}

/* Pestañas Admin Tabs */
.admin-nav-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--yycl-border);
  margin-bottom: 2rem;
  overflow-x: auto;
}

.admin-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--yycl-slate-400);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.admin-tab-btn:hover {
  color: var(--yycl-navy-dark);
}

.admin-tab-btn.active {
  color: var(--yycl-navy-dark);
  border-bottom-color: var(--yycl-yellow);
}

.admin-card {
  background: var(--yycl-card-bg);
  border: 1px solid var(--yycl-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
}

/* Formularios de Alta Visibilidad y Espaciado Limpio */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
  width: 100%;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--yycl-navy-dark);
  display: block;
}

.form-control, .form-select, .form-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.75rem 1rem;
  border: 1px solid var(--yycl-border);
  border-radius: 10px;
  background-color: #FFFFFF;
  color: var(--yycl-navy-dark);
  outline: none;
  transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus, .form-input:focus {
  border-color: var(--yycl-yellow);
  box-shadow: 0 0 0 3px rgba(255, 212, 3, 0.4);
}

.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: 12px;
  background-color: #FFFBEB;
  border: 1px solid #FCD34D;
  margin-top: 0.75rem;
  margin-bottom: 1.25rem;
  width: 100%;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: #D97706;
}

.checkbox-risk-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: #FEE2E2;
  border: 1px solid #FECDD3;
  color: #991B1B;
  padding: 0.6rem 0.9rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  height: 42px;
  margin-top: 1.25rem;
}

.checkbox-risk-item input[type="checkbox"] {
  accent-color: #DC2626;
  width: 16px;
  height: 16px;
}

/* Tarjetas KPI con Bordes de Contraste Vibrantes */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.25rem;
}

.kpi-card {
  background: #FFFFFF;
  border: 1px solid var(--yycl-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-card.blue { border-top: 4px solid #2563EB; }
.kpi-card.yellow { border-top: 4px solid var(--yycl-yellow); }
.kpi-card.emerald { border-top: 4px solid #10B981; }
.kpi-card.rose { border-top: 4px solid #EF4444; }

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #94A3B8;
}

.kpi-icon-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kpi-icon-avatar.indigo { background: #DBEAFE; color: #1E40AF; }
.kpi-icon-avatar.yellow { background: #FEF3C7; color: #92400E; }
.kpi-icon-avatar.emerald { background: #D1FAE5; color: #065F46; }
.kpi-icon-avatar.rose { background: #FEE2E2; color: #991B1B; }

.kpi-icon-avatar svg {
  width: 26px;
  height: 26px;
  stroke-width: 2.2;
}

.kpi-content {
  flex-grow: 1;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--yycl-slate-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--yycl-navy-dark);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.kpi-subtext {
  font-size: 0.825rem;
  color: var(--yycl-slate-400);
  margin-top: 0.4rem;
  font-weight: 600;
}

/* Gráfico Panel */
.chart-panel {
  background: #FFFFFF;
  border: 1px solid var(--yycl-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2.25rem;
}

.chart-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 1.25rem;
  color: var(--yycl-navy-dark);
}

/* Barra de Filtros Avanzada */
.filter-bar {
  background: #FFFFFF;
  border: 1px solid var(--yycl-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--yycl-navy-dark);
}

/* Leyenda de Códigos Panel */
.legend-panel {
  background: linear-gradient(135deg, #FFFDF0 0%, #FFF8D6 100%);
  border: 2px solid var(--yycl-yellow);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  font-size: 0.875rem;
}

/* Resumen de Asistencias Simplificado */
.attendance-summary-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 30px;
  font-size: 0.8rem;
  font-weight: 800;
  font-family: var(--font-title);
  line-height: 1.2;
}

.chip-ok { background: var(--status-ok-bg); color: var(--status-ok-text); border: 1px solid #A7F3D0; }
.chip-csn { background: var(--status-warn-bg); color: var(--status-warn-text); border: 1px solid #FDE68A; }
.chip-a { background: var(--status-danger-bg); color: var(--status-danger-text); border: 1px solid #FECDD3; }
.chip-cia { background: var(--status-neutral-bg); color: var(--status-neutral-text); border: 1px solid #CBD5E1; }
.chip-p { background: var(--status-info-bg); color: var(--status-info-text); border: 1px solid #BFDBFE; }

.badge-risk {
  background-color: #FEE2E2;
  color: #991B1B;
  border: 1px solid #FECDD3;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* Tabla Ejecutiva */
.table-container {
  background: #FFFFFF;
  border: 1px solid var(--yycl-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background-color: #F8FAFC;
  color: var(--yycl-navy-dark);
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1.15rem 1.2rem;
  border-bottom: 2px solid var(--yycl-border);
  white-space: nowrap;
}

.data-table td {
  padding: 1.15rem 1.2rem;
  border-bottom: 1px solid var(--yycl-border);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
  background-color: #FFFDF0;
}

.tabular-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* Badges y Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.badge-ok { background-color: #D1FAE5; color: #065F46; border: 1px solid #6EE7B7; }
.badge-warn { background-color: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; }
.badge-danger { background-color: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.badge-neutral { background-color: #E2E8F0; color: #1E293B; border: 1px solid #CBD5E1; }

/* Duo Badge */
.badge-duo {
  background-color: #F3E8FF;
  color: #6B21A8;
  border: 1px solid #D8B4FE;
  font-weight: 800;
}

/* Circular Horas Badge */
.horas-circle-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--yycl-yellow);
  background-color: #FFFBEB;
  color: #92400E;
  font-family: var(--font-title);
  font-size: 0.875rem;
  font-weight: 800;
}

/* Botones con Estilo Moderno */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-title);
  font-size: 0.875rem;
  font-weight: 800;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
}

.btn-primary {
  background-color: var(--yycl-yellow);
  color: var(--yycl-navy-dark);
  box-shadow: 0 4px 12px rgba(255, 212, 3, 0.35);
}

.btn-primary:hover {
  background-color: var(--yycl-yellow-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(255, 212, 3, 0.45);
}

.btn-outline {
  background-color: #FFFFFF;
  border: 1px solid var(--yycl-border);
  color: var(--yycl-navy-dark);
}

.btn-outline:hover {
  background-color: #F8FAFC;
  border-color: #94A3B8;
  transform: translateY(-1px);
}

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

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

.btn-sm {
  padding: 0.45rem 0.95rem;
  font-size: 0.8rem;
}

/* Pantalla de Iniciar Sesión (Login) */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top right, #1C2541 0%, #0B132B 100%);
  padding: 1.5rem;
}

.login-card {
  background-color: #FFFFFF;
  border-radius: var(--radius-xl);
  padding: 2.75rem 2.25rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.login-title {
  font-family: var(--font-heading);
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
  color: var(--yycl-navy-dark);
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--yycl-slate-600);
  margin-bottom: 2rem;
  font-weight: 600;
}

/* Empty States */
.empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--yycl-slate-600);
}

.empty-state-icon {
  font-size: 2.8rem;
  margin-bottom: 1rem;
}

.empty-state-text {
  font-size: 1rem;
  font-weight: 500;
  max-width: 450px;
  margin: 0 auto;
}

/* Responsivo */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .form-select, .form-input {
    width: 100%;
  }
}
