/*
  BH · LOGIN · GRAPHITE EMBER
  Adaptado de .claude/prototipos/bh-login-graphite-ember.html
  - Variables de color en clases de página (.bh-login-page / .bh-pending-page) para evitar contaminar otras vistas.
  - body {} del prototipo trasladado a esas mismas clases (estructura de viewport).
  - Bloque de "STATE SWITCHER" eliminado (era solo del prototipo).
  - html/body resets y *{box-sizing} omitidos (Tailwind preflight ya los aplica globalmente).
*/

.bh-login-page,
.bh-pending-page {
    --canvas: #0D0D0D;
    --s1: #161616;
    --s2: #1F1F1F;
    --s3: #2A2A2A;
    --b-sub: #222222;
    --b-str: #333333;
    --b-focus: #3F3F3F;
    --t1: #EAEAEA;
    --t2: #8A8A8A;
    --t3: #606060;
    --t4: #404040;
    --ember: #D97756;
    --ember-bright: #E8904D;
    --ember-bg: #2A1810;
    --sky: #7AB8E8;
    --sky-bg: #0F1E2E;
    --ok: #6EC87A;
    --ok-bg: #0F2612;
    --err: #E85D5D;
    --err-bg: #2E1010;
    --r-sm: 3px;
    --r-md: 5px;
    --r-lg: 8px;

    font-family: 'Inter', system-ui, sans-serif;
    background: var(--canvas);
    color: var(--t1);
    font-size: 13px;
    line-height: 20px;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.bh-login-page .mono,
.bh-pending-page .mono {
    font-family: 'JetBrains Mono', monospace;
}

/* ===== LOGIN CARD ===== */
.bh-login-page .login-card,
.bh-pending-page .login-card {
    background: var(--s1);
    border: 1px solid var(--b-sub);
    border-radius: var(--r-lg);
    width: 420px;
    max-width: 100%;
    overflow: hidden;
    position: relative;
}

.bh-login-page .card-header,
.bh-pending-page .card-header {
    padding: 24px 32px 20px;
    border-bottom: 1px solid var(--b-sub);
}

.bh-login-page .brand,
.bh-pending-page .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bh-login-page .brand-mark,
.bh-pending-page .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: var(--r-sm);
    background: var(--s3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ember);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    font-size: 16px;
    border: 1px solid var(--b-str);
}

.bh-login-page .brand-title,
.bh-pending-page .brand-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: .02em;
    color: var(--t1);
    line-height: 18px;
}

.bh-login-page .brand-subtitle,
.bh-pending-page .brand-subtitle {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--t3);
    margin-top: 2px;
}

.bh-login-page .card-body,
.bh-pending-page .card-body {
    padding: 24px 32px 28px;
}

.bh-login-page .h1,
.bh-pending-page .h1 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 22px;
    line-height: 28px;
    font-weight: 600;
    color: var(--t1);
    margin: 0 0 6px;
    letter-spacing: -.005em;
}

.bh-login-page .lead,
.bh-pending-page .lead {
    font-size: 13px;
    line-height: 20px;
    color: var(--t2);
    margin: 0 0 22px;
}

/* ===== FORM ===== */
.bh-login-page .form-group {
    margin-bottom: 14px;
}

.bh-login-page .form-label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--t2);
    margin-bottom: 6px;
}

.bh-login-page .form-input {
    width: 100%;
    height: 34px;
    padding: 0 12px;
    background: var(--canvas);
    border: 1px solid var(--b-sub);
    border-radius: var(--r-md);
    font: 13px 'Inter', sans-serif;
    color: var(--t1);
    outline: none;
    transition: border-color .14s ease, background .14s ease;
}

.bh-login-page .form-input::placeholder {
    color: var(--t3);
}

.bh-login-page .form-input:focus {
    border-color: var(--b-focus);
    background: var(--s1);
}

.bh-login-page .form-input.error {
    border-color: var(--err);
}

.bh-login-page .form-input.error:focus {
    box-shadow: 0 0 0 2px rgba(232, 93, 93, .15);
}

.bh-login-page .form-help {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    line-height: 16px;
    color: var(--t3);
    margin-top: 5px;
}

.bh-login-page .field-error {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    line-height: 16px;
    color: var(--err);
    margin-top: 5px;
}

/* ===== ROW REMEMBER / FORGOT ===== */
.bh-login-page .row-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 6px 0 16px;
}

.bh-login-page .check-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.bh-login-page .cb {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border: 1px solid var(--b-str);
    background: var(--canvas);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all .14s;
}

.bh-login-page .cb:checked {
    background: var(--ember);
    border-color: var(--ember);
}

.bh-login-page .cb:checked::after {
    content: "";
    position: absolute;
    left: 3px;
    top: 0;
    width: 4px;
    height: 8px;
    border: solid #0D0D0D;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.bh-login-page .check-label {
    font-size: 12.5px;
    color: var(--t2);
}

.bh-login-page .link {
    color: var(--sky);
    font-size: 12.5px;
    text-decoration: none;
    font-family: 'Inter', sans-serif;
}

.bh-login-page .link:hover {
    text-decoration: underline;
}

/* ===== BUTTON ===== */
.bh-login-page .btn-primary,
.bh-pending-page .btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 38px;
    padding: 0 16px;
    background: var(--ember);
    color: #1A1A1A;
    font: 600 14px/1 'Inter', sans-serif;
    border: 1px solid var(--ember);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all .12s ease;
}

.bh-login-page .btn-primary:hover,
.bh-pending-page .btn-primary:hover {
    background: var(--ember-bright);
    border-color: var(--ember-bright);
}

.bh-login-page .btn-primary:focus,
.bh-pending-page .btn-primary:focus {
    outline: 2px solid var(--ember);
    outline-offset: 2px;
}

.bh-login-page .btn-primary:disabled,
.bh-pending-page .btn-primary:disabled {
    background: var(--s3);
    border-color: var(--b-str);
    color: var(--t2);
    cursor: not-allowed;
}

.bh-login-page .spinner,
.bh-pending-page .spinner {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(26, 26, 26, .3);
    border-top-color: #1A1A1A;
    animation: bh-login-spin .7s linear infinite;
}

@keyframes bh-login-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===== ALERT ===== */
.bh-login-page .alert {
    display: flex;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-md);
    border: 1px solid rgba(232, 93, 93, .3);
    background: var(--err-bg);
    margin-top: 14px;
    font-size: 12.5px;
    color: var(--err);
}

.bh-login-page .alert svg {
    flex-shrink: 0;
    margin-top: 1px;
    width: 15px;
    height: 15px;
}

.bh-login-page .alert-body {
    color: var(--t1);
    font-size: 12.5px;
    line-height: 18px;
}

/* ===== DIVIDER + FOOTER ===== */
.bh-login-page .divider,
.bh-pending-page .divider {
    height: 1px;
    background: var(--b-sub);
    margin: 20px 0 16px;
}

.bh-login-page .footer-note,
.bh-pending-page .footer-note {
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    line-height: 16px;
    color: var(--t3);
}

.bh-login-page .footer-brand,
.bh-pending-page .footer-brand {
    font-weight: 600;
    color: var(--t2);
    letter-spacing: .02em;
}

/* ===== AMBIENT ===== */
.bh-login-page .ambient,
.bh-pending-page .ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    overflow: hidden;
}

.bh-login-page .ambient::before,
.bh-pending-page .ambient::before {
    content: "";
    position: absolute;
    top: -120px;
    right: -120px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(217, 119, 86, .06), transparent 60%);
    filter: blur(40px);
}

.bh-login-page .hidden,
.bh-pending-page .hidden {
    display: none !important;
}

/* =================================================================
   RESPONSIVE — SSOT § 9.9 Login responsivo
   Mobile-first.
   ================================================================= */

/* sm — mobile landscape / phablet (480-767) */
@media (max-width: 767px) {
    .bh-login-page,
    .bh-pending-page {
        padding: 20px;
    }

    .bh-login-page .login-card,
    .bh-pending-page .login-card {
        width: 380px;
    }

    .bh-login-page .card-header,
    .bh-pending-page .card-header {
        padding: 28px 24px 20px;
    }

    .bh-login-page .card-body,
    .bh-pending-page .card-body {
        padding: 24px 24px 28px;
    }

    .bh-login-page .form-input {
        height: 40px;
        font-size: 14px;
    }

    .bh-login-page .btn-primary,
    .bh-pending-page .btn-primary {
        height: 44px;
        font-size: 14px;
    }

    .bh-login-page .form-label {
        font-size: 13px;
    }

    .bh-login-page .check-label,
    .bh-login-page .link {
        font-size: 13px;
    }
}

/* xs — mobile portrait (<480) — flujo principal del BH */
@media (max-width: 479px) {
    .bh-login-page,
    .bh-pending-page {
        padding: 16px;
        align-items: flex-start;
        padding-top: max(env(safe-area-inset-top, 16px), 32px);
        padding-bottom: max(env(safe-area-inset-bottom, 16px), 16px);
    }

    .bh-login-page .login-card,
    .bh-pending-page .login-card {
        width: 100%;
        max-width: 100%;
    }

    .bh-login-page .card-header,
    .bh-pending-page .card-header {
        padding: 22px 20px 18px;
    }

    .bh-login-page .brand-mark,
    .bh-pending-page .brand-mark {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .bh-login-page .brand-title,
    .bh-pending-page .brand-title {
        font-size: 14px;
    }

    .bh-login-page .brand-subtitle,
    .bh-pending-page .brand-subtitle {
        font-size: 11px;
    }

    .bh-login-page .card-body,
    .bh-pending-page .card-body {
        padding: 22px 20px 24px;
    }

    .bh-login-page .h1,
    .bh-pending-page .h1 {
        font-size: 22px;
        line-height: 28px;
    }

    .bh-login-page .lead,
    .bh-pending-page .lead {
        font-size: 14px;
        line-height: 22px;
        margin-bottom: 20px;
    }

    /* Touch-safe inputs · 44px alto + font 16 evita zoom iOS */
    .bh-login-page .form-input {
        height: 44px;
        font-size: 16px;
        padding: 0 14px;
    }

    .bh-login-page .form-help,
    .bh-login-page .field-error {
        font-size: 12px;
        line-height: 17px;
    }

    .bh-login-page .form-label {
        font-size: 13px;
    }

    /* Checkbox más grande en touch */
    .bh-login-page .cb {
        width: 18px;
        height: 18px;
    }

    .bh-login-page .cb:checked::after {
        left: 5px;
        top: 1px;
        width: 5px;
        height: 10px;
        border-width: 0 2.5px 2.5px 0;
    }

    .bh-login-page .check-label,
    .bh-login-page .link {
        font-size: 13.5px;
    }

    .bh-login-page .row-actions {
        margin: 6px 0 20px;
        gap: 12px;
    }

    /* Botón primary touch-safe */
    .bh-login-page .btn-primary,
    .bh-pending-page .btn-primary {
        height: 48px;
        font-size: 15px;
    }

    .bh-login-page .alert {
        font-size: 13px;
        padding: 12px 14px;
    }

    .bh-login-page .divider,
    .bh-pending-page .divider {
        margin: 22px 0 16px;
    }

    .bh-login-page .footer-note,
    .bh-pending-page .footer-note {
        font-size: 12px;
        line-height: 18px;
    }

    /* Ambient blob más sutil */
    .bh-login-page .ambient::before,
    .bh-pending-page .ambient::before {
        width: 240px;
        height: 240px;
        top: -80px;
        right: -80px;
    }
}

/* Landscape mobile bajo (rotación con teclado) */
@media (max-height: 480px) and (orientation: landscape) {
    .bh-login-page,
    .bh-pending-page {
        align-items: flex-start;
        padding-top: 16px;
    }

    .bh-login-page .card-header,
    .bh-pending-page .card-header {
        padding: 16px 24px 14px;
    }

    .bh-login-page .card-body,
    .bh-pending-page .card-body {
        padding: 18px 24px 20px;
    }

    .bh-login-page .lead,
    .bh-pending-page .lead {
        margin-bottom: 16px;
    }
}
