/*
 * Split login styles for auth_sociosci — SCI brand.
 *
 * Two-step flow: (1) pick audience card, (2) reveal the credentials form.
 * Full-bleed hero over a wine/gold gradient with the SCI palette; cards on
 * warm white with subtle gold dot patterns and a rounded avatar.
 *
 * Palette:
 *   --sci-vino    #6B0A11
 *   --sci-carmin  #A3121D
 *   --sci-rojo    #C1121F
 *   --sci-rojo-d  #8E0E17
 *   --sci-oro     #E3C05C
 *   --sci-oro-d   #B8862B
 */

/* Tipografía SCI - IBM Plex Sans */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

/* Full-bleed with 100vw generates horizontal scroll when the page has a
   vertical scroll bar; on mobile this shrinks the whole page. This clip
   prevents it without creating a scroll container. If the Moodle theme
   fights it, remove this line and wrap the split in a container with
   overflow-x: clip. */
html, body { overflow-x: clip; }

.sci-acceso {
    /* Palette */
    --sci-vino: #6B0A11;
    --sci-carmin: #A3121D;
    --sci-rojo: #C1121F;
    --sci-rojo-d: #8E0E17;
    --sci-oro: #E3C05C;
    --sci-oro-d: #B8862B;

    /* Warm neutrals biased to gold */
    --sci-tinta: #211C1B;
    --sci-gris: #6B645F;
    --sci-linea: #DCD6D0;
    --sci-placeholder: #A29A94;
    --sci-blanco: #FFFFFF;

    --font-sans: 'IBM Plex Sans', "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    font-family: var(--font-sans);
    color: var(--sci-blanco);
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;

    /* Full-bleed inside Moodle */
    position: relative;
    left: 50%;
    right: 50%;
    width: 100vw;
    max-width: 100vw;
    margin-left: -50vw;
    margin-right: -50vw;
    overflow: hidden;

    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 24px;

    background:
        radial-gradient(120% 90% at 15% 0%, #B0141F 0%, rgba(176,20,31,0) 55%),
        radial-gradient(110% 100% at 100% 100%, #9C111B 0%, rgba(156,17,27,0) 58%),
        linear-gradient(140deg, #7A0C14 0%, var(--sci-carmin) 48%, var(--sci-vino) 100%);
}

.sci-acceso *,
.sci-acceso *::before,
.sci-acceso *::after { box-sizing: border-box; }

/* Alert banner for login errors (renders above the whole hero). */
.sci-acceso__alerta {
    position: relative;
    z-index: 2;
    max-width: 720px;
    margin: 0 auto 20px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.96);
    color: #8E0E17;
    border: 1px solid #F2C9CD;
    border-left: 4px solid var(--sci-rojo);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    box-shadow: 0 8px 24px rgba(20, 4, 6, 0.25);
}

/* ---------- Fondo decorativo ---------- */
.sci-acceso__fondo {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}
.sci-acceso__curvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
/* Gold dot patterns in two corners */
.sci-acceso__trama {
    position: absolute;
    width: min(46%, 560px);
    height: min(64%, 520px);
    background-image: radial-gradient(circle, rgba(227,192,92,.55) 1px, transparent 1.4px);
    background-size: 10px 10px;
    opacity: .34;
}
.sci-acceso__trama--tl {
    top: 0;
    left: 0;
    -webkit-mask-image: radial-gradient(75% 75% at 0% 0%, #000 0%, transparent 72%);
    mask-image: radial-gradient(75% 75% at 0% 0%, #000 0%, transparent 72%);
}
.sci-acceso__trama--br {
    bottom: 0;
    right: 0;
    -webkit-mask-image: radial-gradient(75% 75% at 100% 100%, #000 0%, transparent 72%);
    mask-image: radial-gradient(75% 75% at 100% 100%, #000 0%, transparent 72%);
}

/* ---------- Inner container ---------- */
.sci-acceso__inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1040px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 44px;
}

/* ---------- Header (step 1 only) ---------- */
.sci-acceso__header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    max-width: 640px;
}
.sci-acceso__header-icono {
    color: var(--sci-oro);
    display: block;
    width: 56px;
    height: 56px;
}
.sci-acceso__header-icono svg { width: 100%; height: 100%; display: block; }
.sci-acceso__header-rule {
    display: block;
    width: 150px;
    height: 1px;
    background: linear-gradient(90deg, rgba(227,192,92,0), var(--sci-oro) 25%, var(--sci-oro) 75%, rgba(227,192,92,0));
}
.sci-acceso__titulo {
    margin: 6px 0 0;
    font-size: clamp(28px, 4.2vw, 42px);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -.4px;
    text-wrap: balance;
    color: var(--sci-blanco);
}
.sci-acceso__subtitulo {
    margin: 0;
    font-size: clamp(14px, 1.7vw, 16.5px);
    font-weight: 400;
    line-height: 1.5;
    color: rgba(255,255,255,.9);
    text-wrap: balance;
}

/* ---------- Option grid (step 1) ---------- */
.sci-acceso__opciones {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1px 1fr;
    align-items: stretch;
    gap: 0 56px;
}
.sci-acceso__divisor-v {
    width: 1px;
    background: linear-gradient(180deg, rgba(227,192,92,0), rgba(227,192,92,.85) 18%, rgba(227,192,92,.85) 82%, rgba(227,192,92,0));
}

/* ---------- Card ---------- */
.sci-card {
    position: relative;
    background: var(--sci-blanco);
    border-radius: 14px;
    padding: 40px 42px 36px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow: hidden;
    box-shadow: 0 22px 48px rgba(45,4,8,.34), 0 2px 6px rgba(45,4,8,.18);
    color: var(--sci-tinta);
}
.sci-card::before,
.sci-card::after {
    content: "";
    position: absolute;
    width: 150px;
    height: 150px;
    background-image: radial-gradient(circle, rgba(184,134,43,.5) 1px, transparent 1.3px);
    background-size: 9px 9px;
    opacity: .30;
    pointer-events: none;
}
.sci-card::before {
    top: 0;
    left: 0;
    -webkit-mask-image: radial-gradient(70% 70% at 0% 0%, #000, transparent 70%);
    mask-image: radial-gradient(70% 70% at 0% 0%, #000, transparent 70%);
}
.sci-card::after {
    bottom: 0;
    right: 0;
    -webkit-mask-image: radial-gradient(70% 70% at 100% 100%, #000, transparent 70%);
    mask-image: radial-gradient(70% 70% at 100% 100%, #000, transparent 70%);
}
.sci-card > * { position: relative; z-index: 1; }

.sci-card__aro {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sci-rojo);
    background: linear-gradient(150deg, #F0D689 0%, var(--sci-oro) 42%, #C9A245 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.55);
}
.sci-card__aro svg { width: 46px; height: 46px; display: block; }

.sci-card__titulo {
    margin: 20px 0 0;
    font-size: clamp(21px, 2.4vw, 27px);
    font-weight: 700;
    line-height: 1.2;
    color: var(--sci-rojo);
    letter-spacing: -.2px;
}
.sci-card__desc {
    margin: 12px 0 0;
    font-size: 14.5px;
    font-weight: 400;
    line-height: 1.55;
    color: var(--sci-gris);
    max-width: 34ch;
    text-wrap: balance;
}
.sci-card__rule {
    width: 100%;
    max-width: 310px;
    height: 1px;
    margin: 30px 0 26px;
    background: linear-gradient(90deg, rgba(184,134,43,0), rgba(184,134,43,.65) 20%, rgba(184,134,43,.65) 80%, rgba(184,134,43,0));
}

/* ---------- Buttons ---------- */
.sci-btn {
    -webkit-appearance: none;
    appearance: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 12px 20px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    cursor: pointer;
    text-decoration: none;
    transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.sci-btn--rojo {
    background: linear-gradient(180deg, var(--sci-rojo) 0%, var(--sci-rojo-d) 100%);
    border: 1px solid rgba(227,192,92,.6);
    color: var(--sci-blanco);
}
.sci-btn--rojo:hover {
    background: linear-gradient(180deg, #CE1622 0%, #9C1019 100%);
    box-shadow: 0 6px 18px rgba(142,14,23,.32);
    color: var(--sci-blanco);
    text-decoration: none;
}
.sci-btn--rojo:active { transform: translateY(1px); }

.sci-btn--contorno {
    background: transparent;
    border: 1px solid var(--sci-rojo);
    color: var(--sci-rojo);
    letter-spacing: .2px;
    text-transform: none;
    font-size: 14.5px;
}
.sci-btn--contorno:hover {
    background: rgba(193,18,31,.06);
    border-color: var(--sci-rojo-d);
    color: var(--sci-rojo);
    text-decoration: none;
}

.sci-btn--google {
    background: var(--sci-blanco);
    border: 1px solid var(--sci-linea);
    color: var(--sci-tinta);
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: .1px;
    text-transform: none;
}
.sci-btn--google:hover {
    border-color: #BFB6AE;
    box-shadow: 0 3px 10px rgba(33,28,27,.09);
    color: var(--sci-tinta);
    text-decoration: none;
}
.sci-btn--google svg { width: 18px; height: 18px; flex: none; }
.sci-btn__icon { width: 18px; height: 18px; flex: none; object-fit: contain; }

/* ---------- Forms (step 2) ---------- */
.sci-acceso__formularios {
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 22px;
}
.sci-card--form {
    width: 100%;
    max-width: 460px;
    padding: 36px 40px 34px;
}
.sci-card--form .sci-card__aro { width: 62px; height: 62px; }
.sci-card--form .sci-card__aro svg { width: 32px; height: 32px; }
.sci-card--form .sci-card__titulo { margin-top: 16px; font-size: clamp(20px, 2.2vw, 25px); }
.sci-card--form .sci-card__desc { font-size: 13.5px; margin-top: 10px; }

.sci-form {
    width: 100%;
    margin-top: 26px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    text-align: left;
}
.sci-form__campo {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.sci-form__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--sci-tinta);
    letter-spacing: .1px;
}
.sci-form__control { position: relative; display: flex; }
.sci-form__input {
    width: 100%;
    min-height: 44px;
    padding: 11px 14px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 400;
    color: var(--sci-tinta);
    background: var(--sci-blanco);
    border: 1px solid var(--sci-linea);
    border-radius: 6px;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.sci-form__input::placeholder { color: var(--sci-placeholder); }
.sci-form__input:hover { border-color: #C6BDB5; }
.sci-form__input:focus {
    outline: none;
    border-color: var(--sci-rojo);
    box-shadow: 0 0 0 3px rgba(193,18,31,.13);
}
.sci-form__input--clave { padding-right: 46px; }

.sci-form__ojo {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--sci-oro-d);
    cursor: pointer;
    transition: color .18s ease, background-color .18s ease;
}
.sci-form__ojo:hover { color: var(--sci-rojo); background: rgba(184,134,43,.1); }
.sci-form__ojo svg { width: 19px; height: 19px; display: block; }
.sci-form__ojo .sci-form__ojo-off { display: none; }
.sci-form__ojo[aria-pressed="true"] .sci-form__ojo-on { display: none; }
.sci-form__ojo[aria-pressed="true"] .sci-form__ojo-off { display: block; }

.sci-form__enviar { margin-top: 4px; }

.sci-acceso__link {
    display: inline-block;
    font-size: 13px;
    font-weight: 500;
    color: var(--sci-gris);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: color .18s ease, border-color .18s ease;
}
.sci-acceso__link:hover {
    color: var(--sci-rojo);
    border-bottom-color: rgba(193,18,31,.45);
    text-decoration: none;
}

.sci-card__pie {
    width: 100%;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.sci-card__nota {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--sci-gris);
    text-wrap: balance;
}

/* "O con tu correo Moodle" divider */
.sci-divisor {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 4px 0 2px;
}
.sci-divisor::before,
.sci-divisor::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(184,134,43,0), rgba(184,134,43,.7));
}
.sci-divisor::after { background: linear-gradient(90deg, rgba(184,134,43,.7), rgba(184,134,43,0)); }
.sci-divisor__texto {
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 1.3px;
    text-transform: uppercase;
    color: var(--sci-oro-d);
    white-space: nowrap;
}

.sci-card__separador {
    width: 100%;
    height: 1px;
    background: var(--sci-linea);
    margin: 6px 0 2px;
}

/* Back to step 1 */
.sci-acceso__volver {
    -webkit-appearance: none;
    appearance: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    border: 0;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,.86);
    cursor: pointer;
    transition: color .18s ease;
}
.sci-acceso__volver:hover { color: var(--sci-oro); }
.sci-acceso__volver svg { width: 16px; height: 16px; display: block; }

/* ---------- Two-step state machine ---------- */
.sci-acceso[data-paso="form"] .sci-acceso__header,
.sci-acceso[data-paso="form"] .sci-acceso__opciones { display: none; }
.sci-acceso[data-paso="form"] .sci-acceso__formularios { display: flex; }

.sci-acceso__formularios .sci-card--form { display: none; }
.sci-acceso[data-tipo="externo"] .sci-card--form[data-form="externo"],
.sci-acceso[data-tipo="socios"] .sci-card--form[data-form="socios"] {
    display: flex;
    animation: sciEntra .42s cubic-bezier(.2,.7,.3,1) both;
}

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

/* ---------- Focus visible ---------- */
.sci-acceso :focus-visible {
    outline: 2px solid var(--sci-oro);
    outline-offset: 3px;
    border-radius: 4px;
}
.sci-card :focus-visible {
    outline: 2px solid var(--sci-rojo);
    outline-offset: 2px;
}
.sci-form__input:focus-visible { outline: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .sci-acceso { padding: 44px 20px; align-items: flex-start; }
    .sci-acceso__inner { gap: 34px; }
    .sci-acceso__opciones {
        grid-template-columns: 1fr;
        gap: 28px 0;
        max-width: 460px;
        margin: 0 auto;
    }
    .sci-acceso__divisor-v {
        width: 70%;
        height: 1px;
        justify-self: center;
        background: linear-gradient(90deg, rgba(227,192,92,0), rgba(227,192,92,.85) 20%, rgba(227,192,92,.85) 80%, rgba(227,192,92,0));
    }
    .sci-card { padding: 34px 30px 30px; }
}

@media (max-width: 480px) {
    .sci-acceso { padding: 32px 16px; }
    .sci-card { padding: 30px 22px 26px; }
    .sci-card--form { padding: 30px 22px 26px; }
    .sci-card__aro { width: 76px; height: 76px; }
    .sci-card__aro svg { width: 40px; height: 40px; }
    .sci-card__rule { margin: 24px 0 22px; }
    .sci-divisor { gap: 10px; }
    .sci-divisor__texto { font-size: 10.5px; letter-spacing: 1px; }
}

@media (prefers-reduced-motion: reduce) {
    .sci-acceso *,
    .sci-acceso *::before,
    .sci-acceso *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
