/* VideoHub Auth — Accounts shell */
:root {
    --bg: #0f0f0f;
    --bg-elevated: #212121;
    --bg-card: #212121;
    --bg-input: #121212;
    --border: #303030;
    --border-focus: #3ea6ff;
    --text: #f1f1f1;
    --text-muted: #aaa;
    --text-dim: #717171;
    --primary: #3ea6ff;
    --primary-hover: #65b8ff;
    --danger: #ff4e45;
    --danger-bg: rgba(255, 78, 69, 0.12);
    --warn: #f9ab00;
    --warn-bg: rgba(249, 171, 0, 0.12);
    --success: #2ba640;
    --success-bg: rgba(43, 166, 64, 0.12);
    --info: #3ea6ff;
    --info-bg: rgba(62, 166, 255, 0.12);
    --brand-red: #ff0000;
    --brand-red-dark: #cc0000;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    --topbar-h: 56px;
    --card-max: 450px;
    --font: 'Roboto', Arial, sans-serif;
    --transition: 0.2s ease;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
}

body.auth-body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100%;
    display: flex;
    flex-direction: column;
    line-height: 1.45;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Ensure [hidden] wins over display utilities (flex/grid) */
[hidden] {
    display: none !important;
}

/* Top bar */
.auth-topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    text-decoration: none;
}

.auth-logo:hover {
    text-decoration: none;
}

.logo-icon {
    width: 32px;
    height: 24px;
    background: linear-gradient(135deg, var(--brand-red), var(--brand-red-dark));
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
}

.logo-icon.large {
    width: 48px;
    height: 36px;
    font-size: 16px;
}

.logo-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-accounts {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 4px;
    padding: 2px 8px;
    border: 1px solid var(--border);
    border-radius: 999px;
}

.auth-topbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.lang-select {
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}

.auth-help-link {
    color: var(--text-muted);
    font-size: 14px;
}

.auth-help-link:hover {
    color: var(--text);
}

/* Main layout */
.auth-main {
    flex: 1;
    display: flex;
    min-height: calc(100vh - var(--topbar-h) - 120px);
}

.auth-main.layout-centered {
    justify-content: center;
    align-items: center;
    padding: 32px 16px;
}

.auth-main.layout-split .branding-panel {
    display: flex;
}

.auth-main.layout-split .auth-form-column {
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.auth-main.layout-centered .auth-form-column {
    width: 100%;
    max-width: var(--card-max);
}

.auth-main.layout-centered .branding-panel {
    display: none;
}

/* Branding panel */
.branding-panel {
    display: none;
    width: 50%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, #1a0000 0%, #3d0000 40%, #8b0000 70%, #ff2222 100%);
    color: #fff;
    padding: 48px;
    align-items: center;
}

.branding-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.15;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.35) 0, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(255, 200, 200, 0.25) 0, transparent 45%);
    animation: patternFloat 18s ease-in-out infinite alternate;
}

@keyframes patternFloat {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(-20px, 16px, 0) scale(1.05); }
}

.branding-content {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.branding-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}

.branding-logo .logo-title {
    font-size: 28px;
    color: #fff;
}

.branding-headline {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 28px;
    min-height: 2.4em;
    transition: opacity 0.4s ease;
}

.feature-bullets {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 32px;
}

.feature-bullets li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
}

.feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.branding-testimonial {
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 28px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.testimonial-quote {
    font-size: 14px;
    margin-bottom: 12px;
    font-style: italic;
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.testimonial-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3ea6ff, #0066cc);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.testimonial-meta {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.app-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.app-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.app-badge:hover {
    background: rgba(0, 0, 0, 0.55);
    text-decoration: none;
}

/* Auth card */
.auth-card {
    width: 100%;
    max-width: var(--card-max);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px 28px;
    box-shadow: var(--shadow);
}

.auth-main.layout-split .auth-card {
    max-width: 480px;
}

.auth-view[hidden] {
    display: none !important;
}

.auth-card-header {
    margin-bottom: 20px;
}

.auth-card-header.centered {
    text-align: center;
}

.auth-title {
    font-size: 24px;
    font-weight: 500;
    margin-bottom: 6px;
}

.auth-subtitle {
    color: var(--text-muted);
    font-size: 14px;
}

.auth-subtitle strong {
    color: var(--text);
}

/* Social */
.social-login {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}

.social-login.compact {
    flex-direction: row;
}

.social-login.compact .social-btn {
    flex: 1;
    padding: 10px 8px;
    font-size: 13px;
    justify-content: center;
}

.social-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 16px;
    border-radius: 40px;
    border: 1px solid var(--border);
    background: #fff;
    color: #1f1f1f;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.social-btn:hover {
    filter: brightness(0.97);
}

.social-btn:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
}

.social-apple {
    background: #000;
    color: #fff;
    border-color: #000;
}

.social-facebook {
    background: #1877f2;
    color: #fff;
    border-color: #1877f2;
}

.social-logo {
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--text-dim);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
}

.optional {
    font-weight: 400;
    color: var(--text-dim);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="date"],
.field select,
.change-email-box input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    transition: border-color var(--transition);
}

.field input:focus,
.field select:focus,
.change-email-box input:focus {
    outline: none;
    border-color: var(--border-focus);
}

.field input[aria-invalid="true"],
.field input.invalid {
    border-color: var(--danger);
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.password-field {
    position: relative;
}

.password-field input {
    padding-right: 44px;
}

.toggle-password {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toggle-password:hover {
    background: #272727;
    color: var(--text);
}

.field-hint {
    font-size: 12px;
    color: var(--text-dim);
}

.field-hint.error {
    color: var(--danger);
}

.field-hint.success {
    color: var(--success);
}

.field-hint.warn,
.caps-warn {
    color: var(--warn);
}

.field-hint.centered {
    text-align: center;
    margin-bottom: 12px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

/* Password strength */
.pw-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.pw-strength-bar {
    flex: 1;
    height: 4px;
    background: #333;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.pw-strength-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--strength, 0%);
    background: var(--strength-color, var(--danger));
    transition: width 0.25s ease, background 0.25s ease;
}

.pw-strength-label {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 72px;
    text-align: right;
}

.pw-reqs {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 6px;
}

.pw-reqs li {
    font-size: 12px;
    color: var(--text-dim);
    padding-left: 18px;
    position: relative;
}

.pw-reqs li::before {
    content: '○';
    position: absolute;
    left: 0;
}

.pw-reqs li.met {
    color: var(--success);
}

.pw-reqs li.met::before {
    content: '✓';
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 20px;
    border-radius: 22px;
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), opacity var(--transition), transform var(--transition);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: #0f0f0f;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #272727;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
    background: #3a3a3a;
}

.btn-block {
    width: 100%;
}

.btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn[aria-busy="true"] .btn-label {
    opacity: 0.85;
}

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

.text-link {
    color: var(--primary);
    font-size: 13px;
}

.text-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
}

.text-btn:hover {
    text-decoration: underline;
}

.auth-alt {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-alt.stacked {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* Alerts */
.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 14px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.alert[hidden] {
    display: none !important;
}

.alert.error {
    background: var(--danger-bg);
    color: #ff8a84;
    border: 1px solid rgba(255, 78, 69, 0.35);
}

.alert.warn {
    background: var(--warn-bg);
    color: #ffd666;
    border: 1px solid rgba(249, 171, 0, 0.35);
}

.alert.info {
    background: var(--info-bg);
    color: #8ecaff;
    border: 1px solid rgba(62, 166, 255, 0.35);
}

.alert.success {
    background: var(--success-bg);
    color: #7ddea0;
    border: 1px solid rgba(43, 166, 64, 0.35);
}

.auth-form.shake {
    animation: shake 0.45s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-form.shake {
        animation: none;
        outline: 2px solid var(--danger);
    }

    .branding-pattern,
    .btn-spinner,
    .spinner-lg {
        animation: none !important;
    }
}

/* Status icons */
.status-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--info-bg);
    color: var(--info);
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-icon.success {
    background: var(--success-bg);
    color: var(--success);
}

.status-icon.warn {
    background: var(--warn-bg);
    color: var(--warn);
}

.status-icon.error {
    background: var(--danger-bg);
    color: var(--danger);
}

/* OTP */
.otp-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 8px 0 4px;
}

.otp-digit {
    width: 44px;
    height: 52px;
    text-align: center;
    font-size: 22px;
    font-weight: 500;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
}

.otp-digit:focus {
    outline: none;
    border-color: var(--border-focus);
}

.masked-dest {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.cooldown-text {
    text-align: center;
    font-size: 12px;
    color: var(--text-dim);
}

.verify-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.change-email-box {
    width: 100%;
    display: flex;
    gap: 8px;
}

.change-email-box .btn {
    flex-shrink: 0;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 16px;
}

.modal-overlay[hidden] {
    display: none !important;
}

.modal {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.modal h2 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 16px;
}

.method-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.method-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    cursor: pointer;
    text-align: left;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    width: 100%;
}

.method-option:hover,
.method-option[aria-checked="true"] {
    border-color: var(--primary);
    background: var(--info-bg);
}

.method-option .method-meta {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
}

/* Spinner */
.spinner-lg {
    width: 40px;
    height: 40px;
    border: 3px solid #333;
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

/* Recovery */
.recovery-steps {
    margin: 0 0 20px 20px;
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recovery-steps li.active {
    color: var(--text);
}

/* Footer */
.auth-footer {
    padding: 20px 16px 28px;
    text-align: center;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-bottom: 10px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 12px;
}

.footer-links a:hover {
    color: var(--text);
}

.footer-security {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.footer-copy {
    font-size: 12px;
    color: var(--text-dim);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #323232;
    color: #fff;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 300;
    box-shadow: var(--shadow);
    max-width: 90vw;
}

.toast[hidden] {
    display: none !important;
}

/* Offline */
.offline-banner {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    right: 0;
    background: var(--warn);
    color: #111;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-weight: 500;
    z-index: 150;
}

.offline-banner[hidden] {
    display: none !important;
}

/* Captcha mock */
.captcha-box {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
}
.turnstile-wrap { width: 100%; min-height: 65px; margin: 2px 0 4px; overflow: hidden; }
.turnstile-wrap[hidden] { display: none; }

/* Demo panel */
.demo-panel {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 250;
    max-width: 320px;
}

.demo-toggle {
    background: #272727;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
}

.demo-body {
    margin-top: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

.demo-body code {
    color: #8ecaff;
    font-size: 11px;
}

/* Highlight social suggestion */
.social-btn.suggested {
    box-shadow: 0 0 0 2px var(--primary);
}

/* Mobile */
@media (max-width: 900px) {
    .auth-main.layout-split {
        flex-direction: column;
    }

    .auth-main.layout-split .branding-panel {
        display: none;
    }

    .auth-main.layout-split .auth-form-column {
        width: 100%;
        padding: 24px 16px;
    }

    .auth-main.layout-split::before {
        content: '';
    }

    .mobile-brand-logo {
        display: flex;
    }
}

@media (max-width: 560px) {
    .auth-card {
        padding: 24px 18px;
        border: none;
        box-shadow: none;
        background: transparent;
    }

    .field-grid {
        grid-template-columns: 1fr;
    }

    .social-login.compact {
        flex-direction: column;
    }

    .otp-digit {
        width: 40px;
        height: 48px;
        font-size: 20px;
    }

    .branding-headline {
        font-size: 26px;
    }

    .change-email-box {
        flex-direction: column;
    }

    .demo-panel {
        display: none;
    }
}
