/* ==========================================================================
   Boost Traffic Pro - Enterprise SaaS Authentication Design System
   Matches Admin Dashboard Palette & UI/UX Standards
   ========================================================================== */

:root {
    /* Color Tokens */
    --auth-bg-base: #070b14;
    --auth-bg-surface: #0d1322;
    --auth-bg-elevated: #111827;
    --auth-bg-input: #0a0f1d;
    
    --auth-border: #1e293b;
    --auth-border-subtle: rgba(255, 255, 255, 0.07);
    --auth-border-hover: rgba(99, 102, 241, 0.35);
    --auth-border-focus: #6366f1;
    
    --auth-indigo: #6366f1;
    --auth-indigo-hover: #4f46e5;
    --auth-violet: #8b5cf6;
    --auth-fuchsia: #d946ef;
    
    --auth-text-primary: #f8fafc;
    --auth-text-secondary: #94a3b8;
    --auth-text-muted: #64748b;
    
    --auth-success: #10b981;
    --auth-warning: #f59e0b;
    --auth-danger: #ef4444;

    --auth-shadow-card: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
    --auth-shadow-glow: 0 0 35px -5px rgba(99, 102, 241, 0.25);
    --auth-radius-card: 20px;
    --auth-radius-input: 12px;
    --auth-radius-btn: 12px;
}

/* Base Body Styles */
body.auth-body {
    background-color: var(--auth-bg-base);
    color: var(--auth-text-primary);
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    padding: 1.5rem 1rem;
    margin: 0;
}

.font-outfit {
    font-family: 'Outfit', sans-serif;
}

/* Atmospheric Background Elements */
.auth-bg-ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.auth-bg-ambient::before {
    content: '';
    position: absolute;
    top: 15%;
    left: 20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.07) 0%, rgba(99, 102, 241, 0) 70%);
    filter: blur(80px);
    border-radius: 50%;
}

.auth-bg-ambient::after {
    content: '';
    position: absolute;
    bottom: 10%;
    right: 15%;
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, rgba(217, 70, 239, 0.05) 0%, rgba(217, 70, 239, 0) 70%);
    filter: blur(80px);
    border-radius: 50%;
}

/* Auth Container Grid Layout */
.auth-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1060px;
    margin: auto;
}

.auth-grid {
    display: grid;
    grid-template-columns: 1fr;
    background: var(--auth-bg-surface);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-card);
    box-shadow: var(--auth-shadow-card);
    overflow: hidden;
}

@media (min-width: 1024px) {
    .auth-grid {
        grid-template-columns: 1.05fr 1.25fr;
        min-height: 620px;
    }
    
    .auth-grid.auth-grid-signup {
        grid-template-columns: 0.95fr 1.35fr;
    }
}

/* Left Brand & Trust Panel */
.auth-brand-panel {
    background: linear-gradient(170deg, rgba(13, 19, 34, 0.95) 0%, rgba(7, 11, 20, 0.98) 100%);
    border-bottom: 1px solid var(--auth-border);
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .auth-brand-panel {
        border-bottom: none;
        border-right: 1px solid var(--auth-border);
        padding: 3rem 2.5rem;
    }
}

.auth-brand-panel::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(99, 102, 241, 0.2), transparent);
    pointer-events: none;
}

/* Brand Header */
.auth-logo-link {
    display: inline-flex;
    align-items: center;
    transition: transform 0.2s ease, opacity 0.2s ease;
    text-decoration: none;
}

.auth-logo-link:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.auth-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.25);
    margin-top: 1.25rem;
    width: fit-content;
}

/* Brand Content & Trust Points */
.auth-brand-hero-title {
    font-size: 1.75rem;
    line-height: 1.25;
    font-weight: 800;
    color: var(--auth-text-primary);
    margin-top: 1rem;
    letter-spacing: -0.02em;
}

@media (min-width: 1024px) {
    .auth-brand-hero-title {
        font-size: 2.125rem;
    }
}

.auth-brand-hero-title span {
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-brand-desc {
    color: var(--auth-text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-top: 0.75rem;
}

.auth-trust-list {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

.auth-trust-item {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
}

.auth-trust-icon-box {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #818cf8;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.auth-trust-text h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #e2e8f0;
    margin: 0;
}

.auth-trust-text p {
    font-size: 0.75rem;
    color: var(--auth-text-muted);
    margin: 0.125rem 0 0 0;
    line-height: 1.4;
}

/* Right Form Card */
.auth-form-card {
    padding: 2.25rem 1.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--auth-bg-surface);
}

@media (min-width: 640px) {
    .auth-form-card {
        padding: 2.75rem 2.5rem;
    }
}

.auth-form-header {
    margin-bottom: 1.75rem;
}

.auth-form-title {
    font-size: 1.625rem;
    font-weight: 800;
    color: var(--auth-text-primary);
    letter-spacing: -0.02em;
    margin: 0;
}

.auth-form-subtitle {
    font-size: 0.875rem;
    color: var(--auth-text-secondary);
    margin: 0.375rem 0 0 0;
}

/* Section Divider / Header in Form */
.auth-section-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0 1rem 0;
}

.auth-section-label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--auth-text-muted);
    white-space: nowrap;
}

.auth-section-line {
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

/* Floating Label Inputs */
.floating-group {
    position: relative;
    margin-bottom: 1.125rem;
}

.floating-input {
    width: 100%;
    height: 52px;
    background-color: var(--auth-bg-input);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-input);
    padding: 0 2.875rem 0 2.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--auth-text-primary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-sizing: border-box;
}

.floating-input.no-left-icon {
    padding-left: 1rem;
}

.floating-input.no-right-icon {
    padding-right: 1rem;
}

.floating-input:hover:not(:disabled) {
    border-color: var(--auth-border-hover);
}

.floating-input:focus {
    background-color: #0c1224;
    border-color: var(--auth-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.floating-input.has-error {
    border-color: var(--auth-danger) !important;
    background-color: rgba(239, 68, 68, 0.03);
}

.floating-input.has-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

/* Floating Label Position & Animation */
.floating-label {
    position: absolute;
    left: 2.875rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--auth-text-secondary);
    pointer-events: none;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 0.35rem;
    border-radius: 4px;
    transform-origin: left top;
    user-select: none;
    z-index: 2;
}

.floating-group.no-left-icon .floating-label {
    left: 0.875rem;
}

/* Focused or Filled State */
.floating-group.is-focused .floating-label,
.floating-group.is-filled .floating-label,
.floating-input:focus ~ .floating-label,
.floating-input:not(:placeholder-shown) ~ .floating-label {
    top: 0px;
    left: 0.875rem;
    transform: translateY(-50%) scale(0.85);
    background-color: var(--auth-bg-surface);
    color: #818cf8;
    font-weight: 600;
    box-shadow: 0 0 8px rgba(13, 19, 34, 0.8);
}

.floating-group.is-focused.has-error .floating-label,
.floating-input.has-error:focus ~ .floating-label {
    color: var(--auth-danger);
}

/* Input Leading / Trailing Icons */
.input-icon-left {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-text-muted);
    pointer-events: none;
    transition: color 0.18s ease;
    z-index: 2;
}

.floating-group:focus-within .input-icon-left {
    color: var(--auth-indigo);
}

.input-icon-right {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.password-toggle-btn {
    background: transparent;
    border: none;
    padding: 0.375rem;
    border-radius: 6px;
    color: var(--auth-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.password-toggle-btn:hover {
    color: var(--auth-text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.password-toggle-btn:focus-visible {
    outline: 2px solid var(--auth-indigo);
}

/* Readonly Input & Status Badges */
.floating-input.is-readonly {
    cursor: default;
    background-color: rgba(15, 23, 42, 0.6);
    color: #cbd5e1;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    letter-spacing: 0.05em;
}

.security-code-badge {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.25);
    pointer-events: none;
    z-index: 2;
}

/* Password Strength Indicator */
.password-strength-container {
    margin: -0.375rem 0 1rem 0;
    padding: 0 0.25rem;
}

.password-strength-bars {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.375rem;
    height: 4px;
    margin-bottom: 0.375rem;
}

.strength-segment {
    background: var(--auth-border);
    border-radius: 2px;
    transition: background-color 0.25s ease;
}

.strength-segment.active-weak { background-color: var(--auth-danger); }
.strength-segment.active-fair { background-color: var(--auth-warning); }
.strength-segment.active-good { background-color: #38bdf8; }
.strength-segment.active-strong { background-color: var(--auth-success); }

.password-strength-feedback {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.6875rem;
    color: var(--auth-text-muted);
}

.password-strength-label {
    font-weight: 600;
}

/* Password Match Indicator */
.password-match-status {
    font-size: 0.75rem;
    font-weight: 500;
    margin-top: 0.25rem;
    padding-left: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    transition: all 0.2s ease;
}

.match-success {
    color: var(--auth-success);
}

.match-error {
    color: var(--auth-danger);
}

/* Custom Accessible Checkbox */
.auth-checkbox-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    cursor: pointer;
    user-select: none;
}

.auth-custom-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 1.125rem;
    height: 1.125rem;
    border: 1.5px solid var(--auth-border);
    background-color: var(--auth-bg-input);
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    margin-top: 0.125rem;
    transition: all 0.15s ease;
}

.auth-custom-checkbox:hover {
    border-color: var(--auth-border-hover);
}

.auth-custom-checkbox:focus-visible {
    outline: none;
    border-color: var(--auth-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.auth-custom-checkbox:checked {
    background: linear-gradient(135deg, var(--auth-indigo) 0%, var(--auth-violet) 100%);
    border-color: transparent;
}

.auth-custom-checkbox:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5.5px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.auth-checkbox-label {
    font-size: 0.8125rem;
    color: var(--auth-text-secondary);
    line-height: 1.45;
}

.auth-checkbox-label a {
    color: #818cf8;
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-checkbox-label a:hover {
    color: #c084fc;
    text-decoration: underline;
}

/* Primary Submit Button */
.btn-auth-primary {
    width: 100%;
    height: 52px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--auth-radius-btn);
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px -2px rgba(99, 102, 241, 0.35);
    position: relative;
    overflow: hidden;
}

.btn-auth-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px -4px rgba(99, 102, 241, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.2);
    filter: brightness(1.05);
}

.btn-auth-primary:active:not(:disabled) {
    transform: translateY(0) scale(0.99);
}

.btn-auth-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4), 0 4px 14px -2px rgba(99, 102, 241, 0.35);
}

.btn-auth-primary:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    filter: grayscale(0.2);
}

/* Loading Spinner */
.auth-spinner {
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: authSpin 0.7s linear infinite;
}

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

/* Alert Boxes */
.auth-alert {
    padding: 0.875rem 1rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.45;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    animation: authFadeIn 0.3s ease;
}

.auth-alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.auth-alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Auth Footer */
.auth-footer-container {
    margin-top: 1.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.auth-footer-trust-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.75rem;
    color: var(--auth-text-muted);
}

.auth-footer-trust-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.auth-footer-trust-item i,
.auth-footer-trust-item svg {
    color: var(--auth-success);
    width: 0.875rem;
    height: 0.875rem;
}

.auth-copyright-text {
    font-size: 0.6875rem;
    color: var(--auth-text-muted);
}

/* Modal Popup for Terms & Privacy */
.auth-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(3, 7, 18, 0.8);
    backdrop-filter: blur(8px);
    z-index: 999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.auth-modal-backdrop.is-open {
    display: flex;
    opacity: 1;
}

.auth-modal-card {
    background: #0d1322;
    border: 1px solid var(--auth-border);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    overflow: hidden;
}

.auth-modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--auth-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.auth-modal-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--auth-text-primary);
    margin: 0;
}

.auth-modal-close {
    background: transparent;
    border: none;
    color: var(--auth-text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-modal-close:hover {
    color: var(--auth-text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.auth-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--auth-text-secondary);
}

.auth-modal-body h4 {
    color: var(--auth-text-primary);
    font-size: 0.875rem;
    margin: 1rem 0 0.375rem 0;
}

.auth-modal-body h4:first-child {
    margin-top: 0;
}

.auth-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--auth-border);
    display: flex;
    justify-content: flex-end;
}

.auth-modal-btn-close {
    padding: 0.5rem 1.25rem;
    border-radius: 8px;
    background: var(--auth-bg-elevated);
    border: 1px solid var(--auth-border);
    color: var(--auth-text-primary);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
}

.auth-modal-btn-close:hover {
    background: #1e293b;
}

/* Accessibility: Prefers Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    ::before,
    ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
