/* ============================================================
   Tably — Auth Pages Stylesheet
   Dark theme matching landing page (--t-bg: #14151F, --t-primary: #FF6B35)
   ============================================================ */

/* ─── Auth Page Base ──────────────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--t-sp-3) var(--t-sp-2);
    background: var(--t-bg);
    position: relative;
}

/* ─── Language Toggle ─────────────────────────────────────────────────────── */
.auth-lang-toggle {
    position: fixed;
    top: var(--t-sp-2);
    right: var(--t-sp-2);
    z-index: 50;
}

.lang-switch {
    display: flex;
    gap: 0;
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-sm);
    overflow: hidden;
    cursor: pointer;
    padding: 0;
}

.lang-option {
    padding: 8px 14px;
    font-size: var(--t-caption);
    font-weight: 600;
    color: var(--t-text-3);
    transition: var(--t-transition-fast);
    user-select: none;
}

.lang-option.active {
    background: var(--t-primary);
    color: #fff;
}

/* ─── Auth Wrapper & Card ─────────────────────────────────────────────────── */
.auth-wrapper {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.auth-card {
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius);
    padding: var(--t-sp-5) var(--t-sp-4);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ─── Logo ────────────────────────────────────────────────────────────────── */
.auth-logo {
    display: block;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--t-text);
    text-decoration: none;
    margin-bottom: var(--t-sp-3);
    letter-spacing: -0.02em;
}

.auth-logo span {
    color: var(--t-primary);
}

/* ─── Title ───────────────────────────────────────────────────────────────── */
.auth-title {
    text-align: center;
    font-size: var(--t-h2);
    font-weight: 700;
    color: var(--t-text);
    margin-bottom: var(--t-sp-3);
}

/* ─── Progress Indicator ──────────────────────────────────────────────────── */
.progress-indicator {
    margin-bottom: var(--t-sp-4);
}

.progress-text {
    display: block;
    text-align: center;
    font-size: var(--t-caption);
    color: var(--t-text-3);
    margin-bottom: var(--t-sp-1);
}

.progress-bar {
    height: 4px;
    background: var(--t-surface-2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    background: var(--t-primary);
    border-radius: 2px;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Step Headings ───────────────────────────────────────────────────────── */
.step-heading {
    font-size: var(--t-h3);
    font-weight: 600;
    color: var(--t-text);
    margin-bottom: var(--t-sp-3);
}

/* ─── Form Steps ──────────────────────────────────────────────────────────── */
.form-step {
    animation: fadeIn 0.3s ease;
}

.form-step[hidden] {
    display: none;
}

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

/* ─── Form Groups ─────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--t-sp-2);
}

.form-group label {
    display: block;
    font-size: var(--t-body);
    font-weight: 500;
    color: var(--t-text-2);
    margin-bottom: 6px;
}

/* ─── Form Inputs ─────────────────────────────────────────────────────────── */
.form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: var(--t-body);
    font-family: var(--t-font);
    color: var(--t-text);
    background: var(--t-bg);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-sm);
    outline: none;
    transition: border-color var(--t-transition-fast), box-shadow var(--t-transition-fast);
    min-height: 48px;
}

.form-input::placeholder {
    color: var(--t-text-3);
}

.form-input:focus {
    border-color: var(--t-primary);
}

.form-input.is-invalid {
    border-color: var(--t-red);
}

.form-input.is-valid {
    border-color: var(--t-green);
}

.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ─── Input with Icon ─────────────────────────────────────────────────────── */
.input-with-icon {
    position: relative;
}

.input-with-icon .form-input {
    padding-left: 44px;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--t-text-3);
    font-size: 0.9rem;
    pointer-events: none;
}

/* ─── Input with Prefix ───────────────────────────────────────────────────── */
.input-with-prefix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--t-text-3);
    font-size: var(--t-body);
    font-weight: 500;
    pointer-events: none;
    z-index: 1;
}

.input-with-prefix .form-input {
    padding-left: 60px;
}

/* ─── Input with Toggle (password) ────────────────────────────────────────── */
.input-with-toggle {
    position: relative;
}

.input-with-toggle .form-input {
    padding-right: 48px;
}

.input-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--t-text-3);
    cursor: pointer;
    border-radius: var(--t-radius-xs);
    transition: color var(--t-transition-fast);
}

.input-toggle:hover {
    color: var(--t-text);
}

/* ─── Field Errors ────────────────────────────────────────────────────────── */
.field-error {
    font-size: var(--t-caption);
    color: var(--t-red);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.field-error[hidden] {
    display: none;
}

/* ─── Field Status (loading indicator) ────────────────────────────────────── */
.field-status {
    font-size: var(--t-caption);
    color: var(--t-text-3);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.field-status[hidden] {
    display: none;
}

/* ─── Places Results Dropdown ─────────────────────────────────────────────── */
.places-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--t-surface-2);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-sm);
    margin-top: 4px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 20;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.places-results[hidden] {
    display: none;
}

.places-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background var(--t-transition-fast);
}

.places-result-item:hover,
.places-result-item--active {
    background: var(--t-bg);
}

.places-result-item i {
    color: var(--t-primary);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.places-result-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.places-result-text strong {
    font-size: var(--t-body);
    color: var(--t-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.places-result-text small {
    font-size: var(--t-caption);
    color: var(--t-text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Make the places search container relative for dropdown positioning */
.form-group:has(#places-search) {
    position: relative;
}

/* ─── Map Preview ─────────────────────────────────────────────────────────── */
.map-preview {
    margin-bottom: var(--t-sp-2);
    border-radius: var(--t-radius-sm);
    overflow: hidden;
    border: 1px solid var(--t-border);
}

.map-preview[hidden] {
    display: none;
}

.map-preview__placeholder {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--t-bg);
    color: var(--t-text-2);
    font-size: var(--t-caption);
}

.map-preview__placeholder i {
    color: var(--t-primary);
    font-size: 1.1rem;
}

/* ─── Link Button ─────────────────────────────────────────────────────────── */
.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--t-primary);
    font-size: var(--t-caption);
    font-weight: 500;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: var(--t-sp-2);
    transition: opacity var(--t-transition-fast);
    font-family: var(--t-font);
}

.link-btn:hover {
    opacity: 0.8;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: var(--t-body);
    font-weight: 600;
    font-family: var(--t-font);
    border: none;
    border-radius: var(--t-radius-sm);
    cursor: pointer;
    transition: all var(--t-transition-fast);
    min-height: 48px;
    min-width: 44px;
    text-decoration: none;
}

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

.btn-primary {
    background: var(--t-primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--t-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--t-primary-glow);
}

.btn-secondary {
    background: var(--t-surface-2);
    color: var(--t-text);
    border: 1px solid var(--t-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--t-bg);
    border-color: var(--t-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--t-text-2);
    border: 1px solid var(--t-border);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--t-surface-2);
    color: var(--t-text);
}

.btn-full {
    width: 100%;
}

/* ─── Step Actions ────────────────────────────────────────────────────────── */
.step-actions {
    margin-top: var(--t-sp-3);
}

.step-actions--split {
    display: flex;
    gap: var(--t-sp-2);
    justify-content: space-between;
}

.step-actions--split .btn-primary {
    flex: 1;
}

/* ─── OTP Area ────────────────────────────────────────────────────────────── */
.otp-area {
    margin: var(--t-sp-2) 0;
}

.otp-area[hidden] {
    display: none;
}

/* OTP Input Component Styles */
.otp-input-container {
    text-align: center;
}

.otp-digits {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: var(--t-sp-2);
}

.otp-digit {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.4rem;
    font-weight: 600;
    font-family: var(--t-font);
    color: var(--t-text);
    background: var(--t-bg);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-xs);
    outline: none;
    transition: border-color var(--t-transition-fast), box-shadow var(--t-transition-fast);
}

.otp-digit:focus {
    border-color: var(--t-primary);
}

.otp-digit-error {
    border-color: var(--t-red);
}

.otp-timer {
    font-size: var(--t-caption);
    color: var(--t-text-3);
    text-align: center;
    margin-bottom: var(--t-sp-1);
}

.otp-resend-btn {
    background: none;
    border: none;
    color: var(--t-primary);
    font-size: var(--t-caption);
    font-weight: 500;
    cursor: pointer;
    padding: 8px 16px;
    font-family: var(--t-font);
    min-height: 44px;
}

.otp-resend-btn:hover {
    opacity: 0.8;
}

.otp-error {
    font-size: var(--t-caption);
    color: var(--t-red);
    text-align: center;
    margin-top: var(--t-sp-1);
}

/* ─── Verified Badge ──────────────────────────────────────────────────────── */
.verified-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--t-radius-sm);
    margin-bottom: var(--t-sp-2);
    font-size: var(--t-caption);
    color: var(--t-green);
    font-weight: 500;
}

.verified-badge[hidden] {
    display: none;
}

.verified-badge i {
    font-size: 1rem;
}

/* ─── Password Strength ───────────────────────────────────────────────────── */
.password-strength {
    margin-bottom: var(--t-sp-2);
}

.strength-checklist {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.strength-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--t-caption);
    color: var(--t-text-3);
    transition: color var(--t-transition-fast);
}

.strength-item i {
    font-size: 0.6rem;
    color: var(--t-text-3);
    transition: color var(--t-transition-fast);
}

.strength-item.met {
    color: var(--t-green);
}

.strength-item.met i {
    color: var(--t-green);
    font-size: 0.75rem;
}

/* ─── Checkbox ────────────────────────────────────────────────────────────── */
.form-group--checkbox {
    margin-top: var(--t-sp-2);
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: var(--t-caption);
    color: var(--t-text-2);
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-custom {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border: 2px solid var(--t-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--t-transition-fast);
    margin-top: 1px;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--t-primary);
    border-color: var(--t-primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}

.checkbox-label input[type="checkbox"]:focus + .checkbox-custom {
    border-color: var(--t-primary);
}

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

.checkbox-text a:hover {
    text-decoration: underline;
}

/* ─── Trust Signal ────────────────────────────────────────────────────────── */
.trust-signal {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--t-caption);
    color: var(--t-text-3);
    margin: var(--t-sp-2) 0;
}

.trust-signal i {
    color: var(--t-green);
}

/* ─── Lockout Display ──────────────────────────────────────────────────────── */
.lockout-display {
    margin-bottom: var(--t-sp-3);
    padding: 14px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--t-radius-sm);
}

.lockout-display[hidden] {
    display: none;
}

.lockout-message {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--t-body);
    color: var(--t-red);
    font-weight: 500;
}

.lockout-message i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* ─── Auth Footer ─────────────────────────────────────────────────────────── */
.auth-footer {
    margin-top: var(--t-sp-4);
    text-align: center;
}

.auth-footer__login {
    font-size: var(--t-body);
    color: var(--t-text-3);
}

.auth-footer__login a {
    color: var(--t-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer__login a:hover {
    text-decoration: underline;
}

/* ─── Divider ─────────────────────────────────────────────────────────────── */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: var(--t-sp-3) 0;
    color: var(--t-text-3);
    font-size: var(--t-caption);
}

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

/* ─── Social Login ────────────────────────────────────────────────────────── */
.social-login-placeholder {
    margin-top: var(--t-sp-2);
}

.btn-social {
    width: 100%;
    padding: 12px 20px;
    font-size: var(--t-body);
    font-weight: 500;
    font-family: var(--t-font);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-sm);
    background: var(--t-surface-2);
    color: var(--t-text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: not-allowed;
    opacity: 0.6;
    position: relative;
    min-height: 48px;
}

.badge-soon {
    position: absolute;
    right: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    background: var(--t-primary);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
}

/* ─── Toast Notifications ─────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: var(--t-sp-3);
    right: var(--t-sp-3);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: var(--t-sp-1);
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--t-surface-2);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    animation: toastIn 0.3s ease;
    font-size: var(--t-caption);
    color: var(--t-text);
}

.toast--error {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
}

.toast--success {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.1);
}

.toast--exit {
    animation: toastOut 0.3s ease forwards;
}

.toast-message {
    flex: 1;
}

.toast-message a {
    color: var(--t-primary);
    font-weight: 500;
    text-decoration: none;
}

.toast-close {
    background: none;
    border: none;
    color: var(--t-text-3);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); }
}

/* ─── Success Animation ───────────────────────────────────────────────────── */
.success-animation {
    text-align: center;
    padding: var(--t-sp-5) 0;
    animation: fadeIn 0.5s ease;
}

.success-animation i {
    font-size: 4rem;
    color: var(--t-green);
    margin-bottom: var(--t-sp-2);
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-animation h2 {
    font-size: var(--t-h3);
    color: var(--t-text);
    margin-bottom: var(--t-sp-1);
}

.success-animation p {
    color: var(--t-text-3);
    font-size: var(--t-body);
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

/* ─── Screen Reader Only ──────────────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── Mobile Responsive ───────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .auth-page {
        padding: var(--t-sp-2) var(--t-sp-1);
        align-items: flex-start;
        padding-top: var(--t-sp-5);
    }

    .auth-card {
        padding: var(--t-sp-3) var(--t-sp-2);
        border-radius: var(--t-radius-sm);
    }

    .auth-wrapper {
        max-width: 100%;
    }

    .strength-checklist {
        grid-template-columns: 1fr;
    }

    .step-actions--split {
        flex-direction: column-reverse;
    }

    .step-actions--split .btn-primary {
        width: 100%;
    }

    .step-actions--split .btn-ghost {
        width: 100%;
    }

    .toast-container {
        left: var(--t-sp-2);
        right: var(--t-sp-2);
        bottom: var(--t-sp-2);
        max-width: none;
    }

    .otp-digit {
        width: 42px;
        height: 50px;
        font-size: 1.2rem;
    }
}

@media (max-width: 380px) {
    .otp-digits {
        gap: 4px;
    }

    .otp-digit {
        width: 38px;
        height: 46px;
        font-size: 1.1rem;
    }
}
