/* ============================================================================
   AUTHENTICATION PAGE STYLES
   ============================================================================ */

/* Override body styles for auth pages */
body:has(.auth-page) {
    margin: 0;
    padding: 0;
    background: transparent;
    overflow: hidden;
}

.auth-page {
    background: #FFFFFF;
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile browsers */
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    animation: slideUp 0.5s ease-out;
}

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

/* Logo Section */
.logo-section {
    text-align: center;
    margin-bottom: 32px;
}

.logo-section .logotype {
    color: var(--ink-primary) !important;
}

.logo-section .logotype .accent {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-hover) 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
}

.logo {
    font-size: 48px;
    margin-bottom: 16px;
}

.logo-title {
    font-size: 32px;
    font-weight: 700;
    color: #222222;
    margin-bottom: 8px;
}

.logo-subtitle {
    font-size: 16px;
    color: #717171;
}

/* Auth Card */
.auth-card {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    border: 1px solid #EBEBEB;
}

.auth-card-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 8px;
}

.auth-card-subtitle {
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 24px;
}

/* Auth Form */
.auth-form {
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(201, 99, 63, 0.1);
    font-size: 16px; /* Prevents iOS zoom on focus */
}

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

.otp-input {
    text-align: center;
    font-size: 24px;
    letter-spacing: 8px;
    font-weight: 600;
}

.form-hint {
    margin-top: 6px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    display: inline-block;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(201, 99, 63, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-block {
    width: 100%;
    display: block;
}

/* Secondary, low-emphasis button. Used for sign-out, "Remove", "Not now"
   — actions where the user's not going anywhere good and the primary
   indigo would feel too loud. */
.btn-ghost {
    background: transparent;
    color: var(--ink-muted);
    border: 1px solid var(--border-subtle);
}
.btn-ghost:hover {
    background: var(--surface-muted);
    color: var(--ink-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background-color: #fee;
    color: var(--color-error);
    border: 1px solid var(--color-error);
}

.alert-success {
    background-color: #efe;
    color: var(--color-success);
    border: 1px solid var(--color-success);
}

/* Links */
.auth-link {
    margin-top: 20px;
    text-align: center;
}

.link-secondary {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color var(--transition-fast);
}

.link-secondary:hover {
    color: var(--color-primary);
}

/* Footer */
.footer-text {
    text-align: center;
    margin-top: 24px;
    color: #717171;
    font-size: 14px;
}

.footer-text p {
    margin: 0;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .auth-page {
        padding: 16px;
    }

    .auth-card {
        padding: 24px;
    }

    .logo {
        font-size: 40px;
    }

    .logo-title {
        font-size: 28px;
    }

    .auth-card-title {
        font-size: 20px;
    }
}

/* Legal Pages (Privacy, Terms) - Scrollable Content */
.auth-page.legal-page {
    align-items: flex-start;
    padding-top: 40px;
    padding-bottom: 40px;
}

.legal-page .auth-card {
    max-height: 70vh;
    overflow-y: auto;
}

.legal-page .auth-card-title {
    position: sticky;
    top: -32px;
    background: white;
    margin: -32px -32px 16px -32px;
    padding: 32px 32px 16px 32px;
    border-bottom: 1px solid var(--color-border-light);
    z-index: 1;
}

@media (max-width: 480px) {
    .legal-page .auth-card-title {
        margin: -24px -24px 16px -24px;
        padding: 24px 24px 16px 24px;
        top: -24px;
    }
}

/* SMS Consent Section */
.sms-consent-section {
    margin-top: 16px;
    margin-bottom: 20px;
}

.consent-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

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

.consent-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-primary);
}

.consent-disclosure {
    margin-top: 8px;
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.consent-disclosure a {
    color: var(--color-primary);
}

/* Role toggle (Parent / Sitter) on the sign-in page */
.role-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    background: #E4E7EB;
    border-radius: 12px;
    margin-top: 6px;
    line-height: 1;
    box-sizing: border-box;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .role-toggle {
        background: #2A2A35;
    }
}
:root[data-theme="dark"] .role-toggle {
    background: #2A2A35;
}

/* Specificity: .form-group label (defined in sitterchat.css) sets
   display: block and margin-bottom: 8px on every label inside a
   form-group. These toggle options ARE labels inside a form-group, so
   we need the double-class trick to out-specify that rule without
   using !important. */
.role-toggle-option.role-toggle-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    margin: 0;
    padding: 0;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    color: var(--ink-primary);
    cursor: pointer;
    transition: background var(--motion-fast) var(--ease),
                color var(--motion-fast) var(--ease),
                box-shadow var(--motion-fast) var(--ease);
    user-select: none;
    box-sizing: border-box;
}

.role-toggle-option > span {
    display: block;
    text-align: center;
    line-height: 1;
}

.role-toggle-option:has(.role-toggle-input:checked) {
    background: var(--surface-canvas);
    color: var(--brand-primary);
    box-shadow: 0 1px 2px rgba(10, 10, 20, 0.08), 0 1px 1px rgba(10, 10, 20, 0.04);
}

.role-toggle-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}
