/* ==========================================================================
   Tribes Market - Authentication Pages (Login, Register & Reset Password)
   Unified compact layout powered by shared tokens from common.css
   ========================================================================== */

body.auth-page header,
body.login-page header {
    min-height: 56px;
    padding: 0;
    display: flex;
    align-items: center;
}

body.auth-page header .header-main,
body.login-page header .header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 56px;
    padding: 6px clamp(12px, 3vw, 32px);
    box-sizing: border-box;
}

body.auth-page header .logo,
body.login-page header .logo {
    font-size: clamp(1rem, 2.2vw, 1.24rem);
}

.auth-container {
    width: min(calc(100% - 32px), 360px);
    margin: clamp(8px, 2.5vh, 28px) auto;
    background: var(--bg-white);
    padding: clamp(14px, 2.5vh, 22px) clamp(16px, 4vw, 20px);
    border-radius: var(--radius-card);
    border: 1px solid var(--border-light);
    box-sizing: border-box;
    box-shadow: var(--shadow-card);
}

.auth-container > h2 {
    font-family: var(--font-sans);
    font-size: var(--font-heading-section);
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    margin: 0 0 12px;
}

.auth-container p.subtitle {
    color: var(--text-muted);
    font-size: var(--font-small);
    margin: -6px 0 16px;
    line-height: 1.45;
}

.auth-container .form-group {
    margin-bottom: 10px;
}

.auth-container .form-group label {
    margin-bottom: 4px;
    font-size: var(--font-small);
}

.auth-container .form-group input,
.auth-submit-btn,
.google-btn {
    min-height: 44px;
    box-sizing: border-box;
}

.auth-container .form-group input {
    font-size: var(--font-body);
}

/* Password Visibility Toggle */
.login-password {
    position: relative;
}

.login-password input {
    min-height: 44px;
    padding-inline-end: 70px;
}

#loginPasswordVisibility,
.password-toggle-btn {
    position: absolute;
    inset-inline-end: 4px;
    top: 50%;
    transform: translateY(-50%);
    min-width: 56px;
    min-height: 44px;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: var(--font-small);
    cursor: pointer;
}

.auth-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.auth-modal-submit {
    flex: 1;
    justify-content: center;
}

.auth-modal-cancel {
    padding: 10px 16px;
}

.login-forgot {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 6px;
}

.login-forgot a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    font-size: var(--font-small);
    color: var(--brand-ochre);
    text-decoration: none;
    font-weight: 600;
}

.login-forgot a:hover {
    text-decoration: underline;
}

/* Google Sign-In Button */
.google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background-color: var(--bg-white);
    color: var(--text-main);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-btn);
    padding: 10px 16px;
    font-size: var(--font-body);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}

.google-btn:hover {
    background-color: var(--bg-surface-elevated);
    border-color: var(--text-muted);
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 10px 0;
    color: var(--text-muted);
    font-size: var(--font-xs);
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.04em;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-light);
}

.divider::before {
    margin-right: 1em;
}

.divider::after {
    margin-left: 1em;
}

.auth-submit-btn {
    width: 100%;
    background-color: var(--brand-ochre);
    color: white;
    border: none;
    padding: 11px 14px;
    border-radius: var(--radius-btn);
    font-size: var(--font-body);
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    margin-top: 2px;
    transition: background 0.15s ease;
}

.auth-submit-btn:hover {
    background-color: var(--brand-ochre-hover);
}

.auth-submit-btn:disabled {
    background-color: var(--text-subtle);
    cursor: not-allowed;
}

[data-theme="dark"] .auth-submit-btn {
    color: #16191d;
}

.auth-footer {
    text-align: center;
    margin-top: 12px;
    font-size: var(--font-small);
    color: var(--text-muted);
    line-height: 1.5;
}

.auth-footer a {
    color: var(--brand-ochre);
    font-weight: 700;
    text-decoration: none;
}

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

.back-link {
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-small);
    font-weight: 600;
    transition: color 0.15s;
}

.back-link:hover {
    color: var(--brand-ochre);
}

/* Terms & Privacy Consent Controls */
.auth-consent-group {
    margin: 6px 0 10px;
}

.auth-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-block-size: 44px;
    padding: 4px 0;
    cursor: pointer;
    font-size: var(--font-small);
    line-height: 1.45;
    color: var(--text-secondary);
}

.auth-consent-label a {
    color: var(--brand-ochre);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-consent-label a:hover {
    color: var(--brand-ochre-hover);
}

#acceptTerms {
    accent-color: var(--brand-ochre);
    inline-size: 1.15em;
    aspect-ratio: 1;
    margin: 0.15em 0 0;
    flex-shrink: 0;
    cursor: pointer;
}

#acceptTerms:focus-visible {
    outline: 2px solid var(--brand-ochre);
    outline-offset: 2px;
}

#acceptTerms[aria-invalid="true"] {
    outline: 2px solid var(--danger-text);
    outline-offset: 2px;
}

@supports not (accent-color: auto) {
    .auth-consent-label {
        position: relative;
        padding-left: 1.75rem;
    }

    #acceptTerms {
        position: absolute !important;
        clip-path: inset(50%) !important;
        overflow: hidden !important;
        width: 1px !important;
        height: 1px !important;
        margin: -1px !important;
        padding: 0 !important;
        border: 0 !important;
        white-space: nowrap !important;
    }

    #acceptTerms + span::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0.35rem;
        width: 1.1rem;
        height: 1.1rem;
        border: 2px solid var(--border-strong);
        background: var(--bg-input);
        border-radius: 4px;
        box-sizing: border-box;
    }

    #acceptTerms:focus-visible + span::before {
        outline: 2px solid var(--brand-ochre);
        outline-offset: 2px;
    }

    #acceptTerms[aria-invalid="true"] + span::before {
        border-color: var(--danger-text);
    }

    #acceptTerms:checked + span::before {
        background-color: var(--brand-ochre);
        border-color: var(--brand-ochre);
    }

    #acceptTerms:checked + span::after {
        content: "";
        position: absolute;
        left: 0.36rem;
        top: 0.52rem;
        width: 0.3rem;
        height: 0.55rem;
        border: solid #ffffff;
        border-width: 0 2px 2px 0;
        transform: rotate(45deg);
    }

    :root[data-theme="dark"] #acceptTerms:checked + span::after {
        border-color: #16191d;
    }
}

.auth-field-error {
    margin-top: 4px;
    padding: 6px 10px;
    border-radius: 6px;
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger-text);
    font-size: var(--font-xs);
    font-weight: 600;
    line-height: 1.4;
}

.auth-legal-note {
    margin: 8px 0 0;
    text-align: center;
    font-size: var(--font-xs);
    color: var(--text-muted);
    line-height: 1.45;
}

.auth-legal-note a,
.auth-legal-links a {
    color: var(--brand-ochre);
    font-weight: 600;
    text-decoration: none;
}

.auth-legal-note a:hover,
.auth-legal-links a:hover {
    text-decoration: underline;
}

.auth-legal-links {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: var(--font-xs);
    color: var(--text-muted);
}

.auth-legal-links a {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
}
