/**
 * SaaS Auth Pages - Shared Layout
 * Enterprise-grade: white, minimal, professional (Notion / Zoho / Stripe style)
 * UI/UX only - no logic changes
 */

:root {
    --auth-bg: #ffffff;
    --auth-card-bg: #ffffff;
    --auth-card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --auth-card-radius: 12px;
    --auth-radius-input: 10px;
    --auth-border: #e5e7eb;
    --auth-text: #111827;
    --auth-text-secondary: #6b7280;
    --auth-primary: #2563eb;
    --auth-primary-hover: #1d4ed8;
    --auth-primary-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
    --auth-input-bg: #f9fafb;
    --auth-input-bg-focus: #ffffff;
    --auth-input-border: #e5e7eb;
    --auth-input-border-hover: #d1d5db;
    --auth-input-focus: #2563eb;
    --auth-input-focus-glow: rgba(37, 99, 235, 0.14);
    --auth-icon-muted: #9ca3af;
    --auth-error-bg: #fef2f2;
    --auth-error-text: #b91c1c;
    --auth-error-border: #fecaca;
    --auth-error-icon: #dc2626;
    --auth-info-bg: #f0f9ff;
    --auth-info-text: #0369a1;
    --auth-footer-bg: #ffffff;
    --auth-footer-border: #e5e7eb;
    --auth-footer-text: #6b7280;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.auth-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--auth-bg);
    color: var(--auth-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.auth-header-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--auth-bg);
    border-bottom: 1px solid var(--auth-border);
    padding: 0 24px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-header-bar .auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--auth-text);
    font-weight: 600;
    font-size: 1.125rem;
}

.auth-header-bar .auth-logo-icon {
    width: 32px;
    height: 32px;
    background: var(--auth-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
}

.auth-header-bar .auth-logo-img {
    height: 36px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    display: block;
}

.auth-header-bar .auth-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--auth-text-secondary);
}

.auth-header-bar .auth-nav a {
    color: var(--auth-text-secondary);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.auth-header-bar .auth-nav a:hover {
    color: var(--auth-primary);
    background: var(--auth-info-bg);
}

.auth-header-bar .auth-nav .auth-nav-sep {
    color: var(--auth-border);
    user-select: none;
}

/* Main content - centered card */
.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px 48px;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--auth-card-bg);
    border-radius: var(--auth-card-radius);
    box-shadow: var(--auth-card-shadow);
    border: 1px solid var(--auth-border);
    padding: 40px 44px;
}

/* Card entrance: fade + slide up */
.auth-card-animate .auth-card-inner {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.auth-card-animate.auth-card-loaded .auth-card-inner {
    opacity: 1;
    transform: translateY(0);
}

.auth-card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--auth-text);
    margin-bottom: 6px;
}

.auth-card-subtitle {
    font-size: 0.9375rem;
    color: var(--auth-text-secondary);
    margin-bottom: 28px;
}

.auth-form .form-group {
    margin-bottom: 22px;
}

.auth-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--auth-text);
    margin-bottom: 8px;
}

/* Input wrapper: relative container so icon and input align in one line */
.auth-input-wrap {
    position: relative;
    display: block;
    min-height: 48px;
}
.auth-input-wrap .auth-input-icon {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-icon-muted);
    font-size: 1rem;
    pointer-events: none;
    transition: color 0.2s ease;
}
.auth-input-wrap .auth-input-icon i {
    font-size: 1rem;
    width: 1em;
    height: 1em;
    display: block;
    line-height: 1;
    text-align: center;
}
.auth-input-wrap:focus-within .auth-input-icon {
    color: var(--auth-input-focus);
}
.auth-form.has-error .auth-input-wrap .auth-input-icon {
    color: var(--auth-error-icon);
}

.auth-input-wrap input {
    padding-left: 48px;
    padding-right: 14px;
}
.auth-password-wrap input {
    padding-right: 48px;
}

/* Password: lock left, eye right — both vertically centered */
.auth-password-toggle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--auth-icon-muted);
    cursor: pointer;
    border-radius: 0 var(--auth-radius-input) var(--auth-radius-input) 0;
    transition: color 0.2s ease, background 0.15s ease;
}
.auth-password-toggle:hover {
    color: var(--auth-primary);
    background: rgba(37, 99, 235, 0.06);
}
.auth-password-toggle:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--auth-input-focus-glow);
}
.auth-password-toggle i {
    font-size: 1rem;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="tel"] {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px 12px 48px;
    font-size: 0.9375rem;
    line-height: 1.4;
    border: 1px solid var(--auth-input-border);
    border-radius: var(--auth-radius-input);
    background: var(--auth-input-bg);
    color: var(--auth-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.auth-password-wrap input {
    padding-right: 48px;
}

.auth-form input:hover {
    border-color: var(--auth-input-border-hover);
}
.auth-form input:focus {
    outline: none;
    border-color: var(--auth-input-focus);
    background: var(--auth-input-bg-focus);
    box-shadow: 0 0 0 3px var(--auth-input-focus-glow);
}
.auth-form.has-error input {
    border-color: var(--auth-error-border);
}
.auth-form.has-error input:focus {
    border-color: var(--auth-error-icon);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.auth-form input::placeholder {
    color: var(--auth-text-secondary);
    opacity: 0.85;
}

.auth-form input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 100px var(--auth-input-bg) inset;
}
.auth-form input:focus:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 100px var(--auth-input-bg-focus) inset;
}

.auth-btn-primary {
    width: 100%;
    min-height: 48px;
    padding: 14px 16px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(180deg, #3b82f6 0%, var(--auth-primary) 100%);
    border: none;
    border-radius: var(--auth-radius-input);
    cursor: pointer;
    box-shadow: var(--auth-primary-shadow);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    margin-top: 10px;
    position: relative;
}
.auth-btn-primary .auth-btn-spinner {
    display: none;
    margin-left: 8px;
    font-size: 1.125rem;
}
.auth-btn-primary.auth-btn-loading .auth-btn-text {
    visibility: hidden;
}
.auth-btn-primary.auth-btn-loading .auth-btn-spinner {
    display: inline-block;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    margin-left: 0;
}

.auth-btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #2563eb 0%, var(--auth-primary-hover) 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.auth-btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--auth-primary-shadow);
}

.auth-btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

.auth-btn-primary:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}

.auth-card-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--auth-border);
    text-align: center;
    font-size: 0.875rem;
    color: var(--auth-text-secondary);
}

.auth-card-footer a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-card-footer a:hover {
    text-decoration: underline;
}

.auth-helper-text {
    font-size: 0.75rem;
    color: var(--auth-icon-muted);
    margin: 0 0 18px;
    line-height: 1.45;
}
.auth-label-optional {
    font-weight: 400;
    color: var(--auth-icon-muted);
    font-size: 0.8125rem;
}

/* Messages */
.auth-alert {
    padding: 12px 16px;
    border-radius: var(--auth-radius-input);
    font-size: 0.875rem;
    margin-bottom: 22px;
}
.auth-alert-animate {
    animation: authAlertFade 0.3s ease;
}
@keyframes authAlertFade {
    from { opacity: 0; transform: translateY(-2px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-alert-error {
    background: var(--auth-error-bg);
    color: var(--auth-error-text);
    border: 1px solid var(--auth-error-border);
}

.auth-alert-info {
    background: var(--auth-info-bg);
    color: var(--auth-info-text);
    border: 1px solid #bae6fd;
}

.auth-alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Checkbox — aligned with text */
.auth-checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.auth-checkbox-group input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--auth-primary);
    cursor: pointer;
}

.auth-checkbox-group label {
    font-size: 0.875rem;
    color: var(--auth-text-secondary);
    font-weight: 400;
    cursor: pointer;
    line-height: 1.4;
}

/* Footer */
.auth-page-footer {
    background: var(--auth-footer-bg);
    border-top: 1px solid var(--auth-footer-border);
    padding: 20px 24px;
    font-size: 0.8125rem;
    color: var(--auth-footer-text);
    text-align: center;
}
.auth-page-footer .auth-footer-copy {
    margin: 0;
}
.auth-page-footer .auth-footer-trust {
    margin: 8px 0 0;
    font-size: 0.75rem;
    color: var(--auth-text-secondary);
    opacity: 0.85;
}

.auth-page-footer a {
    color: var(--auth-footer-text);
    text-decoration: none;
}

.auth-page-footer a:hover {
    text-decoration: underline;
    color: var(--auth-text);
}

.auth-page-footer .auth-footer-sep {
    margin: 0 8px;
    color: var(--auth-border);
}

/* Responsive — icons stay aligned, no overlap */
@media (max-width: 480px) {
    .auth-header-bar {
        padding: 0 16px;
    }
    .auth-card {
        padding: 32px 24px;
    }
    .auth-main {
        padding: 24px 16px 32px;
    }
    .auth-input-wrap,
    .auth-form input[type="text"],
    .auth-form input[type="email"],
    .auth-form input[type="password"],
    .auth-form input[type="tel"] {
        min-height: 48px;
    }
    .auth-btn-primary {
        min-height: 48px;
        width: 100%;
    }
}
