/* ==========================================================================
   Login — rediseño visual (solo estilos)
   Paleta: #831112 · #C51A1B · #E9B427 · #C6C6C6 · #575656
   Se carga únicamente desde resources/views/vendor/adminlte/auth/login.blade.php
   ========================================================================== */

:root {
    --sm-red-950: #140304;
    --sm-red-900: #831112;
    --sm-red-600: #c51a1b;
    --sm-gold: #e9b427;
    --sm-grey-300: #c6c6c6;
    --sm-grey-700: #575656;
    --sm-ink: #1c1b1d;
    --sm-muted: #6b6a6e;
    --sm-line: #e6e4e6;
    --sm-radius: 5px;
    --sm-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --sm-ease: cubic-bezier(.22, .8, .3, 1);
}

/* ---------- Página / fondo ---------- */
html { -webkit-text-size-adjust: 100%; }

body.login-page {
    height: auto !important;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 28px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    font-family: var(--sm-font);
    color: var(--sm-ink);
    background-color: var(--sm-red-950) !important;
    background-image:
        radial-gradient(1100px 700px at 12% 8%, rgba(131, 17, 18, .75) 0%, transparent 60%),
        radial-gradient(900px 640px at 92% 92%, rgba(197, 26, 27, .45) 0%, transparent 58%),
        linear-gradient(160deg, #1d0406 0%, #2a0709 55%, #140304 100%) !important;
    background-attachment: fixed;
}

/* el <div> sin clase que AdminLTE pone alrededor del login debe ocupar todo el ancho */
body.login-page > div:not([class]) { width: 100%; }

#sm-bg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    display: block;
}

.sm-login {
    position: relative;
    z-index: 1;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* ---------- Tarjeta ---------- */
.sm-card {
    width: 100%;
    max-width: 440px;
    display: grid;
    grid-template-columns: 1fr;
    background: #fff;
    border-radius: 6px;
    overflow: hidden;
    box-shadow:
        0 24px 48px -16px rgba(0, 0, 0, .6),
        0 0 0 1px rgba(255, 255, 255, .07);
    animation: sm-card-in .7s var(--sm-ease) both;
}

@keyframes sm-card-in {
    from { opacity: 0; transform: translateY(18px) scale(.985); }
    to   { opacity: 1; transform: none; }
}

.sm-card.sm-shake { animation: sm-card-in .7s var(--sm-ease) both, sm-shake .5s .35s ease-in-out; }
@keyframes sm-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-7px); }
    40%, 80% { transform: translateX(7px); }
}

/* ---------- Panel formulario ---------- */
.sm-panel-form {
    padding: 44px 40px 28px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Marca: el nombre de la app es lo primero que se lee */
.sm-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 0 0 26px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--sm-line);
}
.sm-brand-logo { flex: none; display: block; text-decoration: none !important; }
.sm-brand-logo img {
    display: block;
    width: 64px;
    height: 64px;
    object-fit: contain;
}
.sm-brand-text { min-width: 0; }
.sm-brand-name {
    margin: 0;
    font-size: 2rem; /* en pantallas ≥992px esto se sobrescribe más abajo con un tamaño atado al ancho disponible */
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1;
    color: var(--sm-red-900);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sm-brand-name b { font-weight: 800; color: var(--sm-red-600); }
.sm-brand-tag {
    margin: 9px 0 0;
    padding-left: 10px;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--sm-grey-700);
    border-left: 3px solid var(--sm-gold);
}

.sm-title {
    margin: 0 0 4px;
    font-size: 1.2rem;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--sm-ink);
}
.sm-subtitle {
    margin: 0 0 24px;
    font-size: .94rem;
    line-height: 1.5;
    color: var(--sm-muted);
}

/* ---------- Campos ---------- */
.sm-field { margin-bottom: 18px; }

.sm-field > label {
    display: block;
    margin: 0 0 7px;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--sm-ink);
}

.sm-input { position: relative; }

.sm-input > svg.sm-ico {
    position: absolute;
    left: 15px;
    top: 50%;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: #9a989d;
    pointer-events: none;
    transition: color .2s ease;
}

/* se usa #id + clase para ganar a las reglas globales de style.css */
.sm-login .sm-input #input_username,
.sm-login .sm-input #input_pass {
    display: block;
    width: 100%;
    height: 50px;
    margin: 0;
    padding: 0 46px 0 44px;
    text-align: left;
    font-family: var(--sm-font);
    font-size: .96rem;
    color: var(--sm-ink);
    background: #faf9fa;
    border: 1.5px solid var(--sm-line);
    border-radius: var(--sm-radius);
    outline: none;
    box-shadow: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.sm-login .sm-input #input_username::placeholder,
.sm-login .sm-input #input_pass::placeholder {
    color: #a7a5aa;
    opacity: 1;
}

.sm-login .sm-input #input_username:hover,
.sm-login .sm-input #input_pass:hover { border-color: #d3d0d4; }

.sm-login .sm-input #input_username:focus,
.sm-login .sm-input #input_pass:focus {
    background: #fff;
    border-color: var(--sm-red-600);
    box-shadow: 0 0 0 4px rgba(197, 26, 27, .13);
}

.sm-input:focus-within > svg.sm-ico { color: var(--sm-red-600); }

/* autocompletado del navegador sin el azul feo */
.sm-login .sm-input input:-webkit-autofill,
.sm-login .sm-input input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--sm-ink);
    -webkit-box-shadow: 0 0 0 1000px #fff inset;
    transition: background-color 9999s ease-in-out 0s;
}

.sm-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    width: 38px;
    height: 38px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    padding: 0;
    color: #8d8b90;
    background: transparent;
    border: 0;
    border-radius: 3px;
    cursor: pointer;
    transition: color .2s ease, background-color .2s ease;
}
.sm-toggle:hover { color: var(--sm-ink); background: rgba(0, 0, 0, .05); }
.sm-toggle:focus-visible { outline: 2px solid var(--sm-red-600); outline-offset: 1px; }
.sm-toggle svg { width: 19px; height: 19px; }
.sm-toggle .sm-eye-off { display: none; }
.sm-toggle[aria-pressed="true"] .sm-eye { display: none; }
.sm-toggle[aria-pressed="true"] .sm-eye-off { display: block; }

/* estados de error */
.sm-field.has-error .sm-input #input_username,
.sm-field.has-error .sm-input #input_pass {
    border-color: var(--sm-red-600);
    background: #fff6f6;
}
.sm-error {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    margin: 8px 2px 0;
    font-size: .82rem;
    line-height: 1.35;
    font-weight: 500;
    color: #b3151a;
    animation: sm-fade-up .35s var(--sm-ease) both;
}
.sm-error svg { flex: none; width: 16px; height: 16px; margin-top: 1px; }

.sm-hint {
    display: none;
    align-items: center;
    gap: 6px;
    margin: 8px 2px 0;
    font-size: .78rem;
    font-weight: 500;
    color: #8a5a00;
}
.sm-hint.show { display: flex; animation: sm-fade-up .25s var(--sm-ease) both; }
.sm-hint svg { width: 15px; height: 15px; flex: none; }

/* ---------- Botón ---------- */
.sm-submit {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 52px;
    margin-top: 8px;
    padding: 0 20px;
    font-family: var(--sm-font);
    font-size: .98rem;
    font-weight: 600;
    letter-spacing: .01em;
    color: #fff;
    text-transform: uppercase;
    background: var(--sm-red-600);
    border: 0;
    border-bottom: 3px solid var(--sm-red-900);
    border-radius: var(--sm-radius);
    cursor: pointer;
    box-shadow: none;
    transition: background-color .2s ease, border-color .2s ease, transform .12s ease;
}
.sm-submit:hover { background: #d71f20; border-bottom-color: #6a0d0e; }
.sm-submit:active { transform: translateY(1px); border-bottom-width: 2px; }
.sm-submit:focus-visible { outline: 3px solid rgba(233, 180, 39, .75); outline-offset: 2px; }
.sm-submit svg { width: 18px; height: 18px; transition: transform .25s var(--sm-ease); }
.sm-submit:hover svg { transform: translateX(3px); }

.sm-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: sm-spin .7s linear infinite;
}
.sm-submit.loading { pointer-events: none; filter: saturate(.85) brightness(.96); }
.sm-submit.loading .sm-spinner { display: block; }
.sm-submit.loading .sm-arrow { display: none; }
@keyframes sm-spin { to { transform: rotate(360deg); } }

/* ---------- Pie ---------- */
.sm-foot {
    margin-top: auto;
    padding-top: 28px;
    text-align: center;
    font-size: .75rem;
    line-height: 1.5;
    color: #98959b;
}
.sm-foot a { color: inherit !important; text-decoration: none !important; transition: color .2s ease; }
.sm-foot a:hover { color: var(--sm-red-600) !important; }

/* ---------- Panel de marca (solo escritorio) ---------- */
.sm-panel-brand { display: none; }

@media (min-width: 992px) {
    .sm-brand { gap: 20px; }
    .sm-brand-logo img { width: 92px; height: 92px; }

    /* El logo y el nombre van en fila con un ancho fijo (ya no columna como en móvil), así que
       aquí sí se puede usar flex:1 + container query para que el nombre nunca pase a una segunda línea. */
    .sm-brand-text { flex: 1 1 auto; container-type: inline-size; }
    .sm-brand-name {
        font-size: clamp(1.3rem, 12cqw, 2.4rem);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sm-card {
        max-width: 1020px;
        min-height: 640px;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
        border-radius: 8px;
    }

    .sm-panel-form { padding: 52px 56px 30px; }

    .sm-panel-brand {
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        padding: 52px 52px 40px;
        color: #fff;
        overflow: hidden;
        isolation: isolate;
        background: linear-gradient(160deg, #a5171a 0%, #831112 55%, #5c0a0c 100%);
    }

    /* planos angulares (sin círculos ni brillos) con leve parallax según el mouse */
    .sm-panel-brand::before,
    .sm-panel-brand::after {
        content: "";
        position: absolute;
        z-index: -1;
        transition: transform .25s ease-out;
    }
    .sm-panel-brand::before {
        width: 70%; height: 100%;
        right: -12%; top: 0;
        background: rgba(255, 255, 255, .045);
        clip-path: polygon(38% 0, 100% 0, 100% 100%, 0 100%);
        transform: translate(calc(var(--mx, 0) * -14px), calc(var(--my, 0) * -10px));
    }
    .sm-panel-brand::after {
        width: 6px; height: 100%;
        left: 0; top: 0;
        background: var(--sm-gold);
        transform: none;
    }

    .sm-dots {
        position: absolute;
        inset: 0;
        z-index: -1;
        opacity: .5;
        background-image: radial-gradient(rgba(255, 255, 255, .22) 1px, transparent 1.4px);
        background-size: 22px 22px;
        -webkit-mask-image: linear-gradient(160deg, #000 0%, transparent 62%);
        mask-image: linear-gradient(160deg, #000 0%, transparent 62%);
    }

    .sm-chip {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        width: fit-content;
        padding: 6px 12px;
        font-size: .72rem;
        font-weight: 700;
        letter-spacing: .09em;
        text-transform: uppercase;
        color: #3a0608;
        background: var(--sm-gold);
        border-radius: 2px;
    }
    .sm-chip i { display: none; }

    .sm-hero { margin: 0 0 34px; }
    .sm-hero h2 {
        margin: 0 0 14px;
        font-size: 2.35rem;
        line-height: 1.12;
        font-weight: 700;
        letter-spacing: -.035em;
        color: #fff;
    }
    .sm-hero h2 em {
        font-style: normal;
        color: var(--sm-gold);
    }
    .sm-hero p {
        margin: 0;
        max-width: 420px;
        font-size: 1rem;
        line-height: 1.6;
        color: rgba(255, 255, 255, .8);
    }

    .sm-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
    .sm-features li {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 16px;
        font-size: .92rem;
        font-weight: 500;
        color: #fff;
        background: rgba(0, 0, 0, .16);
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 4px;
        transition: transform .3s var(--sm-ease), background-color .3s ease, border-color .3s ease;
        animation: sm-fade-up .7s var(--sm-ease) both;
    }
    .sm-features li:nth-child(1) { animation-delay: .35s; }
    .sm-features li:nth-child(2) { animation-delay: .45s; }
    .sm-features li:nth-child(3) { animation-delay: .55s; }
    .sm-features li:hover { transform: translateX(3px); background: rgba(0, 0, 0, .26); border-color: rgba(233, 180, 39, .6); }
    .sm-features .sm-fi {
        flex: none;
        display: grid;
        place-items: center;
        width: 40px; height: 40px;
        color: #3a0608;
        background: var(--sm-gold);
        border-radius: 3px;
    }
    .sm-features .sm-fi svg { width: 20px; height: 20px; }
    .sm-features small { display: block; margin-top: 2px; font-size: .78rem; font-weight: 400; color: rgba(255, 255, 255, .7); }

    .sm-version {
        margin-top: 34px;
        font-size: .76rem;
        letter-spacing: .04em;
        color: rgba(255, 255, 255, .6);
    }
}

@media (min-width: 992px) and (max-height: 700px) {
    body.login-page { align-items: flex-start; }
}

/* Contenedor del formulario (en escritorio es transparente y ocupa el resto del panel) */
.sm-sheet {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

/* ==========================================================================
   MÓVIL / TABLET (< 992 px) — cabecera de marca + tarjeta flotante con campos subrayados
   Las ondas y partículas del fondo quedan visibles en la cabecera y a los costados.
   ========================================================================== */
@media (max-width: 991.98px) {
    body.login-page {
        padding: 0;
        align-items: flex-start;
    }
    .sm-login { align-items: flex-start; }

    .sm-card {
        max-width: none;
        min-height: 100vh;
        min-height: 100dvh;
        display: flex;
        flex-direction: column;
        background: transparent;
        border-radius: 0;
        box-shadow: none;
        overflow: visible;
        animation: none;              /* la cabecera no debe moverse: las ondas se anclan a ella */
    }
    .sm-card.sm-shake { animation: none; }
    .sm-card.sm-shake .sm-sheet { animation: sm-shake .5s .1s ease-in-out; }

    .sm-panel-form { padding: 0; display: flex; flex-direction: column; flex: 1; }

    /* --- Cabecera de marca --- */
    .sm-brand {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1 1 auto;               /* el espacio sobrante lo absorbe la cabecera, la tarjeta queda pegada abajo */
        gap: 16px;
        margin: 0;
        padding: 46px 24px 52px;
        text-align: center;
        border-bottom: 0;
    }
    .sm-brand-logo img {
        width: 104px;
        height: 104px;
        padding: 0;
        background: transparent;
        border-radius: 50%;
        box-shadow: none;
        /* halo de luz cálido alrededor del ícono */
        filter: drop-shadow(0 0 8px rgba(0, 0, 0, .35)) drop-shadow(0 0 22px rgba(255, 70, 60, .55)) drop-shadow(0 0 46px rgba(197, 26, 27, .55));
    }
    .sm-brand-name {
        font-size: clamp(2rem, 10vw, 2.6rem);
        color: #fff;
        text-shadow: 0 2px 16px rgba(0, 0, 0, .35);
    }
    .sm-brand-name b { color: var(--sm-gold); }
    .sm-brand-tag {
        max-width: 300px;
        margin: 12px auto 0;
        padding: 0;
        font-size: .7rem;
        color: rgba(255, 255, 255, .85);
        border-left: 0;
    }
    .sm-brand-tag::before {
        content: "";
        display: block;
        width: 38px;
        height: 3px;
        margin: 0 auto 11px;
        background: var(--sm-gold);
    }

    /* --- Tarjeta del formulario: pegada abajo, ancho completo, con ondulación en S ---
       Esquina superior izquierda convexa + "oreja" cóncava en la derecha (R = radio de la curva). */
    .sm-sheet {
        --sm-r: 56px;
        position: relative;
        flex: none;
        margin: 0;
        padding: 36px max(26px, calc((100% - 440px) / 2)) calc(24px + env(safe-area-inset-bottom, 0px));
        background: #fff;
        border-radius: var(--sm-r) 0 0 0;
        box-shadow: none;
        animation: sm-fade-up .6s .05s var(--sm-ease) both;
    }
    .sm-sheet::before {
        content: "";
        position: absolute;
        right: 0;
        top: calc(var(--sm-r) * -1);
        width: var(--sm-r);
        height: calc(var(--sm-r) + 1px);   /* 1px de solape para evitar la línea fina entre ambas piezas */
        pointer-events: none;
        /* blanco fuera del cuarto de círculo → el fondo asoma en curva cóncava */
        background: radial-gradient(circle at 0 0, transparent calc(var(--sm-r) - .5px), #fff var(--sm-r));
    }
    .sm-foot { margin-top: 0; }
    .sm-title { margin-bottom: 4px; font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em; }
    .sm-subtitle { margin-bottom: 22px; font-size: .9rem; }

    /* campos subrayados con línea dorada al enfocar */
    .sm-field { margin-bottom: 20px; }
    .sm-field > label { margin-bottom: 2px; font-size: .74rem; letter-spacing: .04em; text-transform: uppercase; color: var(--sm-grey-700); }

    .sm-login .sm-input #input_username,
    .sm-login .sm-input #input_pass {
        height: 48px;
        padding: 0 44px 0 32px;
        font-size: 16px;               /* evita el zoom automático en iOS */
        background: transparent;
        border: 0;
        border-bottom: 1.5px solid #d6d3d7;
        border-radius: 0;
    }
    .sm-login .sm-input #input_username:hover,
    .sm-login .sm-input #input_pass:hover { border-bottom-color: #bdbabf; }
    .sm-login .sm-input #input_username:focus,
    .sm-login .sm-input #input_pass:focus {
        background: transparent;
        border-bottom-color: var(--sm-gold);
        box-shadow: 0 1.5px 0 0 var(--sm-gold);
    }
    .sm-input > svg.sm-ico { left: 2px; }
    .sm-toggle { right: 0; }

    .sm-field.has-error .sm-input #input_username,
    .sm-field.has-error .sm-input #input_pass {
        background: transparent;
        border-bottom-color: var(--sm-red-600);
        box-shadow: 0 1.5px 0 0 var(--sm-red-600);
    }

    .sm-submit { height: 54px; margin-top: 16px; border-radius: 10px; }
    .sm-foot { padding-top: 22px; }
}

/* teléfonos pequeños y pantallas bajas */
@media (max-width: 380px) {
    .sm-sheet { --sm-r: 46px; padding-top: 30px; padding-left: 22px; padding-right: 22px; }
}
@media (max-height: 640px) and (max-width: 991.98px) {
    .sm-brand { padding-top: 28px; padding-bottom: 44px; gap: 10px; }
    .sm-brand-logo img { width: 72px; height: 72px; }
}

/* ---------- Utilidades y accesibilidad ---------- */
@keyframes sm-fade-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

.sm-stagger > * { animation: sm-fade-up .6s var(--sm-ease) both; }
.sm-stagger > *:nth-child(1) { animation-delay: .10s; }
.sm-stagger > *:nth-child(2) { animation-delay: .16s; }
.sm-stagger > *:nth-child(3) { animation-delay: .22s; }
.sm-stagger > *:nth-child(4) { animation-delay: .28s; }
.sm-stagger > *:nth-child(5) { animation-delay: .34s; }
.sm-stagger > *:nth-child(6) { animation-delay: .40s; }

.sm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-delay: 0s !important;
        transition-duration: .001ms !important;
    }
}
