/* ==========================================================================
   1. VARIABLES DE DISEÑO (SYSTEM TOKENS)
   ========================================================================== */
:root {
    --color-primary: #004B84;
    --color-primary-light: #e6f0f7;
    --color-success: #28a745;
    --color-error: #dc3545;
    --color-warning: #ffc107;
    --color-text-primary: #1a202c;
    --color-text-secondary: #718096;
    --color-background: #f7f8fa;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;

    --font-main: 'Montserrat', sans-serif;
    
    --fs-base: 16px;
    --fs-sm: 14px;
    --fs-lg: 20px;
    --fs-xl: 28px;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-focus-ring: 0 0 0 3px rgba(0, 75, 132, 0.2);

    --transition-fast: all 0.2s ease-in-out;
}

/* ==========================================================================
   2. ESTILOS GLOBALES Y LAYOUT
   ========================================================================== */
body {
    font-family: var(--font-main);
    background-color: var(--color-background);
    color: var(--color-text-primary);
    display: flex;
    justify-content: center;
    font-size: var(--fs-base);
    flex-direction:column;
      /* quita márgenes y usa viewport “small” */
  margin: 0;
  min-height: 100svh;
    
}

.container {
    max-width: 1380px;
    width: 100%;
    background-color: var(--color-surface);
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    min-height:100dvh;
    margin: 24px auto;
    min-width: 0;
}

html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
html, body { max-width: 100%; overflow-x: hidden; }

/* 1) Altura segura en móviles (evita saltos por barras iOS) */



.main-layout {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    margin-top: 30px;
}

.column-left {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.column-right {
    flex: 1;
    position: sticky;
    top: 30px;
}

/* ==========================================================================
   3. TIPOGRAFÍA
   ========================================================================== */
h1 {
    font-size: var(--fs-xl);
    font-weight: 700;
    text-align: center;
    color: var(--color-primary);
    margin: 60px 0;
}
h1 > i { margin-right: 10px; }

h3 {
    font-size: var(--fs-lg);
    font-weight: 600;
    text-align: center;
    color: var(--color-primary);
    margin-bottom: 20px;
}
h3 > i { margin-right: 8px; }

/* ==========================================================================
   4. BOTONES E INPUTS
   ========================================================================== */
.search-container {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: none;
    margin: 0;
    flex-wrap: wrap;
    justify-content: center;
}

.search-container2 {
    display: flex;
    justify-content: space-evenly;
    flex-direction: row;
    gap:16px;
}
#btnClear, #btnBuscar  {
    width:100%;
    font-family: 'Montserrat', sans-seriff;
}

#btnBack {
font-family: 'Montserrat', sans-serif;
    gap: 12px;
    padding: 8px 12px;
    background: #f0f0f0;
    text-decoration: none;
    color: #000;
    display: flex;
    align-items: center;
    width: max-content;
    font-weight: 600;
    border-radius: 6px;
    font-size: 12px;
}

.buttons-container {
    display: flex;
    gap:8px;
}

#btnAddId {
    color:#000;
    font-family: 'Montserrat', sans-seriff;

} 

#buscar {
    flex-grow: 1;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md) !important;
    padding: 12px 16px;
    font-size: var(--fs-base);
    transition: var(--transition-fast);
    font-family: 'Montserrat', sans-serif;
    letter-spacing:1.5px;
    
}

#buscar:focus-visible {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-focus-ring);
}

button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: var(--fs-base);
    font-weight: 600;
    border-radius: var(--radius-md) !important;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 2px solid transparent;
}
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#btnBuscar {
    background-color: var(--color-primary);
    border-color: var(--color-primary) !important;
    color: var(--color-surface);
}
#btnBuscar:hover:not(:disabled) {
    background-color: #003a6a;
    border-color: #003a6a !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

#btnClear {
    background-color: transparent;
    border: 2px solid var(--color-border) !important;
    color: var(--color-text-secondary);
}
#btnClear:hover:not(:disabled) {
    background-color: var(--color-error);
    border-color: var(--color-error) !important;
    color: var(--color-surface);
}

#formPago {    
    display: flex;
    margin: 0;
    gap: 15px;
    flex-direction: column;
}

#formPago input, #formPago .descripcion-visual-container {
    padding: 12px;
    font-size: var(--fs-base);
    border-radius: var(--radius-md);
    font-family: var(--font-main);
    border: 1px solid var(--color-border);
    background-color: var(--color-background);
    width: -webkit-fill-available;
    line-height: 1.5;
}

.student-desc-card {
    display:flex;
    flex-direction:column;
    gap:4px;
}

.student-desc-card p {
    margin-top:0;    
}

.form-group {
    display:flex;
    flex-direction:column;
    gap: 6px;

}

.form-group label {
        color: var(--color-primary);
    font-weight:700;
}

#btnPagar {
    font-size: 18px;
    padding: 16px;
    background-color: var(--color-success) !important;
    border-color: var(--color-success) !important;
    color: var(--color-surface);
}
#btnPagar:hover:not(:disabled) {
    background-color: #218838 !important;
    border-color: #218838 !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
#btnPagar:disabled {
    background-color: #ccc !important;
    border-color: #ccc !important;
    cursor: not-allowed;
}

/* ==========================================================================
   5. TARJETAS DE PLANES (.plan)
   ========================================================================== */
.plan {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 20px;
    align-items: center;
    border: 1px solid var(--color-border);
    background-color: var(--color-surface);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    cursor: pointer;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    align-items: start;

}

@media (max-width: 800px) {
    .plan {
        grid-template-columns: 1fr 1fr;
        display: grid;
    }
}

@media (max-width: 560px) {
    .plan {
        grid-template-columns: 1fr;
        display: grid;
    }

    h1 {
        font-size: 24px;
        padding: 0 8px;
    }
}

.plan:not(.no-deselect):hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.plan.selected {
    border-color: var(--color-primary);
    background-color: var(--color-primary-light);
    box-shadow: var(--shadow-md);
}
/* Indicador visual de selección */
/* Opción 1: Ícono de Círculo con Check (check-circle) */
.plan.selected::before {
    content: '\f058'; /* Este es el código Unicode para el ícono fa-check-circle */
    font-family: 'Font Awesome 6 Free'; /* Llama a la fuente de Font Awesome */
    font-weight: 900; /* MUY IMPORTANTE: Selecciona el estilo 'sólido' del ícono */
    position: absolute;
    top: 12px;
    right: 15px;
    font-size: 22px; /* Un poco más grande para que se vea bien */
    color: var(--color-primary);
}

.plan.no-deselect {
    cursor: not-allowed;
    background-color: var(--color-primary-light);
}

.plan span {
    display:flex;
    flex-direction:column;
    gap:4px;
}

.plan span label {
    font-size: var(--fs-sm);
    color: var(--color-primary);
    font-weight: 600;
    margin-bottom: 4px;
}
.plan span div {
    font-size: var(--fs-base);
    color: var(--color-text-primary);
}

/* ==========================================================================
   6. ACORDEÓN
   ========================================================================== */
.student-accordion {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: 15px;
    overflow: hidden;
    background-color: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.accordion-button {
    background-color: transparent;
    width: 100%;
    display: flex;
    justify-content: space-between;
    flex-direction: row;
    align-items: center;
    font-family:'Montserrat', sans-seriff;
}

#span_container {
    display:flex;
    gap:4px;
    color: #000;
}

#span_title {
    text-align:left;
    font-weight:500;
}

#span_name {
    text-align:left;
    font-weight:700;
}

.student-accordion.active .accordion-button, .accordion-button:hover {
    background-color: var(--color-background);
}
.accordion-panel {
    max-height: 0;
    overflow: hidden;
    transition: all 0.25s ease-in-out;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.student-accordion.active .accordion-panel {
    max-height: 1000px;
    padding: 20px;
    border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   7. OTROS COMPONENTES
   ========================================================================== */
/* Resumen de Pago */
#payment-section {
    background-color: var(--color-surface);
    padding: 25px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
}
#payment-section.is-empty::before {
    content: "Seleccione uno o más planes para ver los detalles del pago aquí.";
    text-align: center; font-style: italic; color: var(--color-text-secondary); display: block;
}
#payment-section.is-empty h3, #payment-section.is-empty form { display: none; }

/* Tarjetas de descripción en el resumen */
.descripcion-visual-container { max-height: 250px; }
.student-desc-card strong { color: #000; }

/* Notificaciones */
/* === ESTILOS PARA NOTIFICACIONES (Animación de Contenedor) === */



.notification{
  overflow: hidden;          /* para que el contenido no desborde mientras anima */
  height: 0;                 /* empieza cerrada */
  opacity: 0;                /* empieza transparente */
  transition:
    height 300ms ease,
    opacity 250ms ease;      /* la opacidad puede terminar apenas antes */
}

.notification.is-open{
  opacity: 1;
}

/* Estilo del cuadro (colores por tipo opcional) */
.notification__box{
  padding: 12px 16px;
  border-radius: 10px;
  color:#fff;
  box-shadow: 0 6px 18px rgba(0,0,0,.12);
    display: flex;
  align-items: center;
  gap: 8px;           /* espacio entre icono y texto */
}

.notification__box i {
  font-size: 1.1em;   /* un pelín más grande que el texto */
  line-height: 1;
}

.notification__box.info{    background:#3b82f6; }
.notification__box.success{ background:#10b981; }
.notification__box.error{   background:#ef4444; }

.icon {
    font-size:26px;
    font-weight:600;
}

/* ==========================================================================
   8. RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
        gap: 30px;
    }
    .column-right {
        position: static;
        width: 100%;
    }
}

.chips {
  display:flex; flex-wrap:wrap; gap:8px; margin-top:8px;
}
.chip {
  display:flex; align-items:center; gap:12px;
  padding:6px 20px; border-radius:999px; background:#eef2f7; color:#374151;
  font-size:.9rem; border:1px solid #e5e7eb;
}
.chip .remove {
  background:transparent; border:none; cursor:pointer; font-size:1.25rem; line-height:1;
  color:#6b7280;
  padding:0;
      font-weight: 500;
}
.chip .remove:hover { color:#ef4444; }
.multi-id-actions { display:flex; gap:8px; margin-top:8px; }

:root{
  --color-primary: #004B84;
  --color-primary-light: #e6f0f7;
}

/* ===== Firefox ===== */
html, .scrollable {
  scrollbar-width: thin;                               /* auto | thin | none */
  scrollbar-color: var(--color-primary) var(--color-primary-light);
  scrollbar-gutter: stable;                            /* evita empujones de layout */
}

/* ===== WebKit (Chrome/Edge/Safari) ===== */
html::-webkit-scrollbar,
.scrollable::-webkit-scrollbar {
  width: 12px;                                         /* alto si es horizontal */
  height: 12px;
}

html::-webkit-scrollbar-track,
.scrollable::-webkit-scrollbar-track {
  background: var(--color-primary-light);
  border-radius: 999px;
}

html::-webkit-scrollbar-thumb,
.scrollable::-webkit-scrollbar-thumb {
  background-color: var(--color-primary);
  border-radius: 999px;
  border: 3px solid var(--color-primary-light);        /* anillo limpio alrededor */
  background-clip: padding-box;
  transition: background-color .2s ease;
}

html::-webkit-scrollbar-thumb:hover,
.scrollable::-webkit-scrollbar-thumb:hover {
  /* un 12% más oscuro aprox */
  background-color: #003c6a;
}

html::-webkit-scrollbar-thumb:active,
.scrollable::-webkit-scrollbar-thumb:active {
  /* un 20% más oscuro aprox */
  background-color: #003458;
}

/* Opcional: listas con scroll suave en iOS */
.scrollable { -webkit-overflow-scrolling: touch; }

.site-footer {
    background-color: var(--color-background);
    color: #555;
    text-align: center;
    padding: 12px;
    font-size: 0.9rem;
    border-top: 1px solid #ddd;
    display:flex;
    flex-direction:column;
    gap: 8px;
}

.branding {
    display: flex;
    margin: 0 auto;
    gap: 4px;
    align-items:center;


}

#by_ {
    font-size:12px;
    text-transform:uppercase;
    font-weight:700;
    margin:0;
}

#brand_ {
    font-size:18px;
    text-transform: uppercase;
    font-weight:800;
    margin:0;
}

.tipo-busqueda-label {
  font-weight: 600;
}



/* ====== GUARDARRÍELES ANTI-DESBORDES EN MÓVIL ====== */

/* 0) Box sizing consistente + no overflow horizontal */
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
html, body { max-width: 100%; overflow-x: hidden; }

/* 1) Altura segura en móviles (evita saltos por barras iOS) */
body {
  /* quita márgenes y usa viewport “small” */
  margin: 0;
  min-height: 100svh;
  overflow:visible;
}

/* 2) Container responsivo sin empujar el viewport */
.container {
  width: 100%;
  max-width: 1380px;
  margin: 32px auto;
  /* padding fluido para que no “empuje” en pantallas pequeñas */
  padding: clamp(16px, 4vw, 40px);
  /* por si algo dentro intenta crecer de más */
  min-width: 0;
}

/* 3) Contenidos que podrían provocar desbordes */
.column-left, .column-right { min-width: 0; } /* permite que los hijos en flex encojan */
.search-container, .search-container2 { padding-inline: 0; }
#buscar, button { max-width: 100%; }          /* botones/inputs no crecen más que el viewport */
#resultados, .plan span div { 
  overflow-wrap: anywhere; word-break: break-word; 
}

/* Chips: evita que una chip muuuy larga desborde */
.chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

/* Acordeón: asegura que el panel no fuerce ancho extra */
.accordion-panel { min-width: 0; }

/* 4) Ajustes de layout antes que tu corte de 900px si hace falta */
@media (max-width: 768px) {
  .main-layout { flex-direction: column; gap: 24px; }
  .column-right, .column-left { width: 100%; }
  .container {width:auto;}
}

/* 5) Scrollbar: en móviles hazlo overlay (no reserve espacio) */
@media (max-width: 768px) {
  /* desactiva reserva de gutter en móvil */
  html, .scrollable { scrollbar-gutter: auto; }
  /* y oculta la barra física (en móvil ya es overlay) */
  html::-webkit-scrollbar, .scrollable::-webkit-scrollbar { width: 0; height: 0; }
}

/* 6) Safe areas (iPhone con notch) para padding lateral */
@supports (padding: max(0px)) {
    @media sscreen and (max-width:600px) {
        .container {
            padding: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
        }
    }
}

/* ====== Popover Historial ====== */
/* ====== Popover Historial (con animación) ====== */
.popover-backdrop{
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;

  /* Estado cerrado (oculto, pero transicionable) */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  /* Animaciones */
  transition:
    opacity .25s ease,
    visibility 0s linear .25s; /* esconde la visibilidad al final de la opacidad */
}

/* Estado abierto */
.popover-backdrop.is-open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity .25s ease,
    visibility 0s; /* visible inmediatamente */
}

/* La tarjeta interna: entra con un leve desplazamiento/escala */
.popover-card{
  width: min(720px, 100%);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  padding: 20px 20px 16px;
  position: relative;
  max-height: 85dvh; overflow: auto;

  /* Animación de entrada/salida */
  transform: translateY(12px) scale(.98);
  opacity: 0;
  transition:
    transform .28s cubic-bezier(.2,.7,.2,1),
    opacity .2s ease;
  transform-origin: top center; /* o top right si quieres que salga desde el botón */
}

/* Cuando el backdrop está abierto, anima la tarjeta a su sitio */
.popover-backdrop.is-open .popover-card{
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Botón cerrar: sin cambios */
.popover-close{
  position: absolute; top: 8px; right: 10px;
  background: transparent; border: 0; cursor: pointer;
  font-size: 1.25rem; color: #4b5563;
}


.history-form{
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end;
  margin-top: 12px;
}
.history-form label{ grid-column: 1 / -1; color: var(--color-primary); font-weight: 700; }
.history-form input{
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  padding: 10px 12px; background: var(--color-background);
}
.history-actions{ display: flex; gap: 8px; }

.btn-primary{
  background: var(--color-primary); color: #fff; border: 2px solid var(--color-primary);
  padding: 10px 16px; border-radius: var(--radius-md); font-weight: 600; cursor: pointer;
}
.btn-primary:hover{ background:#003a6a; border-color:#003a6a; }

.btn-secondary{
  margin-top: 10px;
  background: transparent; color: var(--color-primary); border: 2px solid var(--color-primary);
  padding: 10px 16px; border-radius: var(--radius-md); font-weight: 600; cursor: pointer; width: 100%;
}
.btn-secondary:hover{ background: var(--color-primary-light); }

.history-results{
  margin-top: 16px; border-top: 1px solid var(--color-border); padding-top: 14px;
}

/* Tabla simple */
.history-table{
  width: 100%; border-collapse: collapse; font-size: 0.95rem;
}
.history-table th, .history-table td{
  border-bottom: 1px solid var(--color-border); padding: 10px 8px; text-align: left; align-content: baseline;
}
.history-table th{ color: var(--color-primary); font-weight: 700; background: #f9fafb; }
.history-empty{ color: var(--color-text-secondary); font-style: italic; padding: 8px 0; }
.history-loading{ color: var(--color-text-secondary); }

.search-mode{
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: flex-start;
    font-size: 0.95rem;
}
.search-mode label{
  display:flex; gap:8px; align-items:center; cursor:pointer;
}

input::-webkit-input-placeholder {
  font-family: 'Montserrat', sans-seriff;
  letter-spacing: 0px;
}

/* ===== Radios custom VR/Mindset ===== */
.radio {
  --size: 18px; /* diámetro del radio */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-family: var(--font-main);
  font-size: 16px; /* evita zoom en iOS */
  color: var(--color-text-primary);
}

/* Ocultamos el nativo pero mantenemos accesibilidad */
.radio input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  /* quitar estilos nativos cross-browser */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* Círculo visual */
.radio .radio__control {
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
  display: inline-grid;
  place-items: center;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease, transform .08s ease;
}

/* Punto interior (dot) */
.radio .radio__control::after {
  content: "";
  width: calc(var(--size) * 0.52);
  height: calc(var(--size) * 0.52);
  border-radius: 50%;
  background: var(--color-primary);
  transform: scale(0);
  transition: transform .18s ease;
}

/* Estado checked */
.radio input[type="radio"]:checked + .radio__control {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus-ring);
  background: var(--color-primary-light);
}
.radio input[type="radio"]:checked + .radio__control::after {
  transform: scale(1);
}

/* Hover */
.radio:hover .radio__control {
  border-color: #cbd5e1; /* un poco más oscuro que var(--color-border) */
}

/* Focus accesible (tab teclado) */
.radio input[type="radio"]:focus-visible + .radio__control {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
  border-color: var(--color-primary);
}

/* Disabled */
.radio input[type="radio"]:disabled + .radio__control {
  opacity: .6;
  cursor: not-allowed;
}
.radio input[type="radio"]:disabled ~ .radio__label {
  color: var(--color-text-secondary);
  cursor: not-allowed;
}

/* Tamaño compacto opcional */
.radio.radio--sm { --size: 16px; font-size: 14px; }


