/* ============================================================================
   HUB v3 — Auth Pages (Login, Forgot, Reset)
   Concepto: Split-panel · Dark left · Clean right · High-end corporate
   Landing page CSS lives in landing.css (src/Views/public/landing.twig).
   ============================================================================ */

/* ── Reset y base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: var(--bg-primary);
    color: var(--ink-950);
    padding: var(--safe-area-top) var(--safe-area-right) var(--safe-area-bottom) var(--safe-area-left);
    min-height: 100vh;
    min-height: calc(100svh - var(--safe-area-top) - var(--safe-area-bottom));
}
@supports (height: 100dvh) {
    body {
        min-height: calc(100dvh - var(--safe-area-top) - var(--safe-area-bottom));
    }
}

/* ── Auth Shell — split layout ───────────────────────────────────────── */
.auth-shell {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    min-height: calc(100svh - var(--safe-area-top) - var(--safe-area-bottom));
}

@supports (height: 100dvh) {
    .auth-shell {
        min-height: calc(100dvh - var(--safe-area-top) - var(--safe-area-bottom));
    }
}

/* ── Panel izquierdo — oscuro, branding ──────────────────────────────── */
.auth-panel-brand {
    background: var(--auth-panel-bg);
    color: var(--auth-text-primary);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem;
    overflow: hidden;
}

/* Orbes de luz decorativos */
.auth-panel-brand::before {
    content: '';
    position: absolute;
    top: -100px; left: -100px;
    width: 500px; height: 500px;
    background: radial-gradient(circle 0%, transparent 70%);
    pointer-events: none;
}
.auth-panel-brand::after {
    content: '';
    position: absolute;
    bottom: -80px; right: -80px;
    width: 400px; height: 400px;
    background: radial-gradient(circle 0%, transparent 70%);
    pointer-events: none;
}

.auth-brand-top {
    position: relative;
    z-index: 1;
}
.auth-brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}
.auth-brand-logo img {
    height: 28px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: .9;
}
/* Logo uploaded in Ajustes → Marca keeps its own colors. */
.auth-brand-logo img.brand-logo-custom {
    max-width: 10rem;
    height: 3rem;
    flex-shrink: 0;
    filter: none;
    opacity: 1;
    object-fit: contain;
}
.auth-brand-logo-text {
    font-size: var(--type-title-4-size);
    font-weight: 700;
    color: var(--auth-text-primary);
    letter-spacing: -.01em;
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 2rem 0;
}
.auth-brand-tagline {
    font-size: clamp(1.75rem, 3vw, 2.375rem);
    font-weight: 800;
    color: var(--auth-text-primary);
    letter-spacing: -.035em;
    line-height: 1.15;
    margin-bottom: 1rem;
}
.auth-brand-tagline span {
    color: var(--auth-accent);
}
.auth-brand-desc {
    font-size: var(--type-callout-size);
    color: var(--auth-text-secondary);
    line-height: 1.6;
    max-width: 36ch;
    margin-bottom: 2.5rem;
}

/* Feature highlights */
.auth-features {
    display: flex;
    flex-direction: column;
    gap: .875rem;
}
.auth-feature {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.auth-feature-icon {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    background: var(--glass-brand-12);
    color: var(--auth-accent);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.auth-feature-icon svg {
    width: 16px; height: 16px;
    fill: currentColor;
}
.auth-feature-text {
    font-size: var(--type-subhead-size);
    color: var(--auth-text-secondary);
    line-height: 1.4;
}
.auth-feature-text strong {
    color: var(--auth-text-primary);
    font-weight: 500;
}

.auth-brand-footer {
    position: relative;
    z-index: 1;
}
.auth-brand-footer p {
    font-size: var(--type-caption-size);
    color: var(--auth-text-muted);
}

/* ── Panel derecho — formulario ──────────────────────────────────────── */
.auth-panel-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    background: var(--bg-surface);
}
.auth-form-box {
    width: 100%;
    max-width: 400px;
}

.auth-form-header {
    margin-bottom: 2rem;
}
.auth-form-title {
    font-size: var(--type-title-1-size);
    font-weight: 700;
    color: var(--ink-950);
    letter-spacing: -.025em;
    margin-bottom: .375rem;
}
.auth-form-subtitle {
    font-size: var(--type-subhead-size);
    color: var(--text-muted);
    line-height: 1.5;
}

/* Campos */
.auth-field {
    margin-bottom: 1rem;
}
.auth-label {
    display: block;
    font-size: var(--type-footnote-size);
    font-weight: 500;
    color: var(--ink-600);
    margin-bottom: .375rem;
    letter-spacing: -.005em;
}
.auth-input {
    display: block;
    width: 100%;
    padding: .625rem .875rem;
    font-size: var(--type-callout-size);
    font-family: inherit;
    color: var(--ink-950);
    background: var(--bg-surface);
    border: 1px solid var(--border-color-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-input:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px var(--glass-brand-12), var(--shadow-xs);
}

/* Checkbox remember */
.auth-checkbox-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.25rem;
}
.auth-checkbox-row input[type="checkbox"] {
    width: 15px; height: 15px;
    accent-color: var(--brand-500);
    cursor: pointer;
}
.auth-checkbox-row label {
    font-size: var(--type-subhead-size);
    color: var(--text-secondary);
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

/* Submit button */
.auth-btn {
    display: block;
    width: 100%;
    padding: .6875rem 1rem;
    font-size: var(--type-callout-size);
    font-weight: 600;
    font-family: inherit;
    letter-spacing: -.01em;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    text-decoration: none;
}
.auth-btn-primary {
    background: var(--ink-900);
    color: var(--bg-surface);
    box-shadow: 0 1px 2px var(--glass-navy-20), inset 0 1px 0 var(--glass-white-06);
}
.auth-btn-primary:hover { background: var(--ink-700); }
.auth-btn-secondary {
    background: transparent;
    color: var(--ink-700);
    border: 1.5px solid var(--border-color-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
}
.auth-btn i {
    flex-shrink: 0;
    font-size: var(--type-body-size);
    line-height: 1;
}
.auth-btn-secondary:hover { background: var(--bg-surface-hover); }
.auth-btn-secondary:disabled { opacity: .55; cursor: not-allowed; }
/* Face ID login (public_html/assets/js/biometric-login.js); auth pages don't load base.css. */
.auth-biometric[hidden],
.auth-biometric [hidden],
.auth-checkbox-row[hidden] {
    display: none !important;
}

.auth-biometric {
    margin-bottom: 1.25rem;
    text-align: center;
}

.auth-biometric .auth-btn {
    gap: .5rem;
}

.auth-biometric-name {
    margin-top: .5rem;
    font-size: var(--type-footnote-size);
    color: var(--text-muted);
}

.auth-passkey-error {
    margin-top: .625rem;
    font-size: var(--type-footnote-size);
    color: var(--danger-600, var(--danger-600));
    text-align: center;
}

/* Links */
.auth-links {
    margin-top: 1.25rem;
    text-align: center;
}
.auth-links a {
    font-size: var(--type-subhead-size);
    color: var(--brand-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}
.auth-links .auth-link-button {
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: var(--type-subhead-size);
    color: var(--brand-600);
    text-decoration: none;
    transition: color var(--transition-fast);
    cursor: pointer;
}
.auth-links a:hover { color: var(--brand-700); text-decoration: underline; }
.auth-links .auth-link-button:hover { color: var(--brand-700); text-decoration: underline; }
.auth-links .divider {
    display: inline-block;
    color: var(--border-color-strong);
    margin: 0 .5rem;
}

/* Forgot password link */
.auth-forgot {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 1.25rem;
}
.auth-forgot a {
    font-size: var(--type-footnote-size);
    color: var(--brand-600);
    text-decoration: none;
}
.auth-forgot a:hover { text-decoration: underline; }

/* Alerts */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    padding: .75rem .875rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    font-size: var(--type-subhead-size);
    border-left: 3px solid transparent;
}
.auth-alert-danger {
    background: var(--danger-50);
    border-color: var(--danger-500);
    color: var(--danger-600);
}
.auth-alert-icon {
    flex-shrink: 0; margin-top: 1px;
    width: 16px; height: 16px;
}

/* Success state */
.auth-success-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-full);
    background: var(--success-50);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 1.25rem;
}
.auth-success-icon svg {
    width: 24px; height: 24px;
    stroke: var(--success-600);
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: var(--type-footnote-size);
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

/* ── Versión mobile — single column ──────────────────────────────────── */
@media (max-width: 768px) {
    .auth-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    .auth-panel-brand {
        padding: 1.5rem 1.25rem;
        min-height: 0;
    }
    .auth-brand-content { padding: 1.25rem 0 0; display: none; }
    .auth-features      { display: none; }
    .auth-brand-footer  { display: none; }
    .auth-panel-form {
        padding: 2rem 1.25rem calc(2rem + var(--safe-area-bottom));
        align-items: flex-start;
    }
    .auth-brand-tagline { font-size: var(--type-title-2-size); }

    .auth-input {
        min-height: 44px;
        font-size: var(--type-body-size);
    }

    .auth-btn,
    .auth-links a,
    .auth-forgot a,
    .auth-brand-logo {
        min-height: 44px;
    }

    /* Links are inline: without a box of their own min-height does nothing. */
    .auth-links a,
    .auth-forgot a {
        display: inline-flex;
        align-items: center;
    }

    .auth-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .auth-checkbox-row input[type="checkbox"] {
        width: 22px;
        height: 22px;
    }

    /* The whole row is the target: the label stretches to the full width and 44px of height. */
    .auth-checkbox-row label {
        flex: 1 1 auto;
        display: flex;
        align-items: center;
        min-height: 44px;
    }
}

/* Touch screens wider than a phone (tablet, H-233): the same 44px targets as the phone layout. */
@media (hover: none) and (pointer: coarse) {
    .auth-btn,
    .auth-links a,
    .auth-forgot a,
    .auth-brand-logo {
        min-height: 44px;
    }

    .auth-links a,
    .auth-forgot a,
    .auth-brand-logo {
        display: inline-flex;
        align-items: center;
    }

    .auth-checkbox-row label {
        flex: 1 1 auto;
        display: flex;
        align-items: center;
        min-height: 44px;
    }
}
