/* ==========================================================================
   MagiHub — Modales de Login y Registro
   --------------------------------------------------------------------------

   Al estar todo bajo #mh-auth, reglas como "input", "label", "h2" o
   ".ia-btn-primary { width: 100% }" solo se aplican dentro del modal y no
   rompen el diseño del landing.
   ========================================================================== */

/* --- Bloquea el scroll del landing mientras el modal está abierto --- */
body.mh-auth-open { overflow: hidden; }

/* --------------------------------------------------------------------------
   Overlay: (color + glow naranja)
   -------------------------------------------------------------------------- */
#mh-auth {
    position: fixed;
    inset: 0;
    z-index: 99999;
    overflow-y: auto;
    background: var(--ia-black);
    color: var(--ia-white);
    font-family: var(--ia-font-body);
    opacity: 0;
    visibility: hidden;
    /* la visibilidad cambia al instante al abrir y con retardo al cerrar */
    transition: opacity .3s ease, visibility 0s linear .3s;
}

#mh-auth.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity .3s ease, visibility 0s;
}

/* Glow naranja superior */
#mh-auth::before {
    content: '';
    position: fixed;
    top: -180px;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    height: 400px;
    background: radial-gradient(ellipse, rgba(235, 70, 4, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Contenedor de cada modal
   -------------------------------------------------------------------------- */
#mh-auth .mh-modal {
    display: none;
    box-sizing: border-box;
    min-height: 100vh;
    /* dvh: en móvil el 100vh se queda corto y tapaba el final de la tarjeta */
    min-height: 100dvh;
    padding: 2rem 1rem;
    align-items: center;
    /* safe center: centrada cuando cabe, y si la tarjeta es más alta que la
       ventana se alinea arriba, para que el overlay se pueda desplazar hasta
       el final. Con "center" a secas, lo que sobresale por arriba no hay
       forma de alcanzarlo. */
    align-items: safe center;
    justify-content: center;
}

#mh-auth .mh-modal.is-active { display: flex; }

/* --------------------------------------------------------------------------
   Tarjeta
   -------------------------------------------------------------------------- */
#mh-auth .card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 2.8rem 2.5rem;
    background: var(--ia-surface);
    border: 1px solid var(--ia-border);
    border-radius: var(--ia-radius-xl);
    animation: mh-pulse-border 3s ease-in-out infinite;

    /* Estado inicial: la tarjeta arranca más abajo y con opacidad 0.
       Al abrir, la clase .is-in la hace subir suavemente. */
    opacity: 0;
    transform: translateY(48px);
    transition: opacity .45s ease, transform .55s cubic-bezier(.22, 1, .36, 1);
}

#mh-auth .mh-modal--register .card { 
    max-width: 100%;
    margin: 2% 10%;
}

/* Efecto suave de desplazamiento: la tarjeta sube a su sitio */
#mh-auth .mh-modal.is-active .card.is-in {
    opacity: 1;
    transform: translateY(0);
}

@keyframes mh-pulse-border {
    0%, 100% { border-color: rgba(235, 70, 4, 0.2); box-shadow: 0 0 0 rgba(235, 70, 4, 0); }
    50%      { border-color: rgba(235, 70, 4, 0.5); box-shadow: 0 0 20px rgba(235, 70, 4, 0.1); }
}

@keyframes mh-spin { to { transform: translateY(-50%) rotate(360deg); } }

/* --------------------------------------------------------------------------
   Logo
   -------------------------------------------------------------------------- */
#mh-auth .logo-wrap { text-align: center; margin-bottom: 1rem; }
#mh-auth .logo-wrap img { height: 40px; }

#mh-auth .logo-dark { display: none; }
[data-theme="dark"] #mh-auth .logo-light { display: none; }
[data-theme="dark"] #mh-auth .logo-dark  { display: inline-block; }

/* --------------------------------------------------------------------------
   Títulos
   -------------------------------------------------------------------------- */
#mh-auth h2, #mh-auth h3 {
    font-family: var(--ia-font-display);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-align: center;
    margin-bottom: 0.4rem;
}

#mh-auth .subtitle {
    text-align: center;
    color: var(--ia-muted);
    font-size: 0.88rem;
    margin-bottom: 2rem;
}

#mh-auth .mh-modal--register .subtitle { margin-bottom: 0.6rem; }

/* --------------------------------------------------------------------------
   Aviso de invitación (solo registro)
   -------------------------------------------------------------------------- */
#mh-auth .invite-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: var(--ia-cyan-dim);
    border: 1px solid rgba(235, 70, 4, 0.2);
    border-radius: var(--ia-radius-md);
    padding: 0.5rem 0.9rem;
    font-family: var(--ia-font-mono);
    font-size: 0.75rem;
    color: var(--ia-cyan);
    margin-bottom: 1.8rem;
}

/* --------------------------------------------------------------------------
   Caja de error
   -------------------------------------------------------------------------- */
#mh-auth .error-box {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    line-height: 1.5;
    background: rgba(235, 70, 4, 0.08);
    border: 1px solid rgba(235, 70, 4, 0.25);
    border-radius: var(--ia-radius-md);
    padding: 0.8rem 1rem;
    font-size: 0.87rem;
    color: #CD3A00;
    margin-bottom: 1.3rem;
}

#mh-auth .error-box.hidden { display: none; }

/* --------------------------------------------------------------------------
   Formulario
   -------------------------------------------------------------------------- */
#mh-auth .row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }

#mh-auth .form-group {
    margin-bottom: 1.1rem;
    /* En columna, con el control empujado abajo, los campos de una misma fila
       quedan alineados aunque una etiqueta necesite dos líneas y la otra una. */
    display: flex;
    flex-direction: column;
}

#mh-auth .form-group > textarea,
#mh-auth .form-group > .select-wrap { margin-top: auto; }

/* Licencias es un número corto y Proveedores un texto libre donde se escriben
   varios nombres: con la mitad de la fila se quedaba corto, así que Licencias
   ocupa lo justo y Proveedores el resto.
   (En móvil manda la regla de una columna del final del archivo: empate de
   especificidad y va después.) */
#mh-auth .row--providers { grid-template-columns: minmax(0, 0.5fr) minmax(0, 1fr); }

#mh-auth label {
    display: block;
    font-family: var(--ia-font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--ia-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

#mh-auth input,
#mh-auth select,
#mh-auth textarea {
    width: 100%;
    background: var(--ia-surface-raised);
    border: 1px solid var(--ia-border);
    border-radius: var(--ia-radius-md);
    padding: 0.72rem 1rem;
    color: var(--ia-white);
    font-family: var(--ia-font-body);
    font-size: 0.95rem;
    /* explícito para que input y select midan lo mismo de alto */
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
}

#mh-auth input:focus,
#mh-auth select:focus,
#mh-auth textarea:focus { border-color: var(--ia-cyan); }
#mh-auth input.err,
#mh-auth select.err,
#mh-auth textarea.err { border-color: var(--ia-red); }

/* El campo de proveedores es de texto libre y suele llevar varios nombres: se
   le da alto de unas tres líneas y se puede estirar a lo alto si hace falta. */
#mh-auth textarea {
    min-height: 5.4rem;
    resize: vertical;
}

#mh-auth input::placeholder,
#mh-auth textarea::placeholder { color: var(--ia-muted); }

#mh-auth .field-error {
    display: block;
    min-height: 1.06rem;
    font-size: 0.76rem;
    line-height: 1.4;
    color: var(--ia-red);
    margin-top: 0.31rem;
}

#mh-auth .field-error.hidden { visibility: hidden; }

#mh-auth .form-group:has(.field-error) { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Desplegable
   --------------------------------------------------------------------------
   El <select> nativo se pinta con los colores del sistema (fondo blanco) y
   desentona con el modal. Se le quita la apariencia y la flecha se dibuja con
   .select-caret, que sí puede usar las variables del tema.
   -------------------------------------------------------------------------- */
#mh-auth .select-wrap {
    position: relative;
    display: block;
}

#mh-auth select {
    appearance: none;
    -webkit-appearance: none;
    /* ancho real de la flecha (8px girados) más un respiro */
    padding-right: 2.2rem;
    cursor: pointer;
}

/* Sin proveedor elegido el value está vacío: el texto se ve tenue, como un
   placeholder. Si el navegador no entiende :has(), solo pierde ese matiz. */
#mh-auth select:has(option[value=""]:checked) { color: var(--ia-muted); }

/* La lista desplegada la pinta el sistema, pero hereda estos colores. */
#mh-auth select option {
    background: var(--ia-surface-raised);
    color: var(--ia-white);
}

#mh-auth .select-caret {
    position: absolute;
    right: 1.15rem;
    top: 50%;
    width: 8px;
    height: 8px;
    margin-top: -6px;
    border-right: 1.6px solid var(--ia-muted);
    border-bottom: 1.6px solid var(--ia-muted);
    transform: rotate(45deg);
    pointer-events: none;
    transition: border-color 0.2s;
}

#mh-auth .select-wrap:focus-within .select-caret { border-color: var(--ia-cyan); }

/* Los botones grises del input numérico rompen la línea del modal. Se ocultan;
   con las flechas del teclado el campo sigue siendo usable. */
#mh-auth input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}

#mh-auth input[type="number"]::-webkit-outer-spin-button,
#mh-auth input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#mh-auth .invite-input {
    font-family: var(--ia-font-mono);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

#mh-auth .hint {
    font-size: 0.76rem;
    color: var(--ia-muted);
    margin-top: 0.3rem;
}

/* --------------------------------------------------------------------------
   Botón principal
   -------------------------------------------------------------------------- */
#mh-auth .ia-btn-primary {
    display: block;
    width: 100%;
    background: var(--ia-cyan);
    color: var(--ia-black);
    font-family: var(--ia-font-display);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0;
    padding: 0.82rem;
    border-radius: var(--ia-radius-md);
    border: none;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
    margin-top: 0.4rem;
    position: relative;
}

#mh-auth .ia-btn-primary:hover { opacity: 0.9; transform: none; }
#mh-auth .ia-btn-primary:active { transform: scale(0.98); }
#mh-auth .ia-btn-primary:disabled { opacity: 0.65; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   Spinner
   -------------------------------------------------------------------------- */
#mh-auth .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: var(--ia-black);
    border-radius: 50%;
    animation: mh-spin 0.7s linear infinite;
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
}

/* --------------------------------------------------------------------------
   Divisor y botón de Google
   -------------------------------------------------------------------------- */
#mh-auth .divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.4rem 0;
    font-family: var(--ia-font-mono);
    font-size: 0.72rem;
    color: var(--ia-muted);
}

#mh-auth .divider::before,
#mh-auth .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--ia-border);
}

#mh-auth .btn-google {
    width: 100%;
    background: transparent;
    border: 1px solid var(--ia-border);
    border-radius: var(--ia-radius-md);
    padding: 0.72rem;
    color: var(--ia-white);
    font-family: var(--ia-font-body);
    font-size: 0.92rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: border-color 0.2s;
}

#mh-auth .btn-google:hover { border-color: var(--ia-cyan); }

/* --------------------------------------------------------------------------
   Enlaces del pie
   -------------------------------------------------------------------------- */
#mh-auth .footer-links {
    text-align: center;
    margin-top: 1.6rem;
    font-size: 0.84rem;
    color: var(--ia-muted);
}

#mh-auth .footer-links a { color: var(--ia-cyan); text-decoration: none; }
#mh-auth .footer-links a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   "← Volver" (arriba izquierda, como en las pantallas originales)
   -------------------------------------------------------------------------- */
#mh-auth .back-link {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 5;
    font-family: var(--ia-font-mono);
    font-size: 0.8rem;
    color: var(--ia-muted);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

#mh-auth .back-link:hover { color: var(--ia-cyan); }

/* --------------------------------------------------------------------------
   Toggle de tema (arriba derecha, como en las pantallas originales)
   -------------------------------------------------------------------------- */
#mh-auth .theme-toggle {
    position: fixed;
    top: 1.3rem;
    right: 1.5rem;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 34px;
    background: var(--ia-surface);
    border: 1px solid var(--ia-border);
    border-radius: var(--ia-radius-md);
    color: var(--ia-muted);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

#mh-auth .theme-toggle:hover { color: var(--ia-cyan); border-color: var(--ia-cyan); }
#mh-auth .theme-toggle svg { width: 17px; height: 17px; display: block; }
#mh-auth .theme-toggle .icon-moon { display: none; }
#mh-auth .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] #mh-auth .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] #mh-auth .theme-toggle .icon-sun  { display: none; }

/* --------------------------------------------------------------------------
   Ventanas bajas (portátiles, zoom alto)
   --------------------------------------------------------------------------
   Si el contenido no cabe, se desplaza el modal entero; pero es mejor que
   quepa: en pantallas de poca altura se compactan los huecos en vez de dejar
   que el formulario se salga. */
@media (max-height: 900px) {
    /* Aquí solo se compacta la tarjeta: no hay tope de alto ni scroll dentro de
       ella. Si el contenido no cabe (p. ej. con un aviso visible), se desplaza
       el modal entero, que es lo que se espera. */
    #mh-auth .card {
        padding: 2rem 2.2rem;
    }
    #mh-auth .logo-wrap { margin-bottom: 1.2rem; }
    #mh-auth .logo-wrap img { height: 34px; }
    #mh-auth .subtitle { margin-bottom: 1.2rem; }
    #mh-auth .mh-modal--register .subtitle { margin-bottom: 0.5rem; }

    #mh-auth .form-group { margin-bottom: 0.8rem; }

    #mh-auth input,
    #mh-auth select,
    #mh-auth textarea { padding: 0.6rem 0.9rem; }

    #mh-auth textarea { min-height: 4.4rem; }

    #mh-auth .ia-btn-primary { padding: 0.72rem; }
    #mh-auth .footer-links { margin-top: 1rem; }
}

/* --------------------------------------------------------------------------
   Móvil (igual que register.php)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    /* Los botones fijos de arriba (Volver y el cambio de tema) van pegados a las
       esquinas, y con el padding de antes la tarjeta nacía justo debajo de
       ellos: se tocaban. En móvil arranca más abajo. */
    #mh-auth .mh-modal { padding: 4.5rem 1rem 2.5rem; }
    #mh-auth .card { padding: 2rem 1.3rem; }
    #mh-auth .row { grid-template-columns: 1fr; gap: 0; }
}

/* --------------------------------------------------------------------------
   Movimiento reducido
   --------------------------------------------------------------------------
   El borde de la tarjeta late sin parar, el spinner da vueltas y la tarjeta
   entra deslizándose: quien pide menos movimiento en su sistema no debería
   ver nada de eso. El modal funciona igual, solo se queda quieto. Se puede
   usar transition: none sin miedo porque el JS no escucha transitionend.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    #mh-auth .card {
        animation: none;
        transition: none;
    }

    #mh-auth .spinner { animation: none; }

    #mh-auth input,
    #mh-auth select,
    #mh-auth .select-caret,
    #mh-auth .btn-google,
    #mh-auth .back-link,
    #mh-auth .theme-toggle,
    #mh-auth .ia-btn-primary { transition: none; }
}
.iframe-calendar{
    background-color: white;
    border-radius: 25px;
    padding: 1%;
}