/* ==========================================================================
   BFAI Auth – Styles
   Premium dark/glassmorphism design matching site theme
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --------------------------------------------------------------------------
   CSS Variables
   -------------------------------------------------------------------------- */
:root {
    --auth-bg: #0a0a0f;
    --auth-surface: rgba(20, 20, 35, 0.9);
    --auth-surface-border: rgba(99, 102, 241, 0.15);
    --auth-primary: #6366f1;
    --auth-primary-hover: #4f46e5;
    --auth-primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --auth-text: #f1f5f9;
    --auth-text-muted: #94a3b8;
    --auth-text-dim: #64748b;
    --auth-input-bg: rgba(255, 255, 255, 0.04);
    --auth-input-border: rgba(255, 255, 255, 0.08);
    --auth-input-focus: rgba(99, 102, 241, 0.4);
    --auth-error: #f43f5e;
    --auth-success: #10b981;
    --auth-warning: #f59e0b;
    --auth-radius: 12px;
    --auth-radius-lg: 20px;
    --auth-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    --auth-glow: 0 0 60px rgba(99, 102, 241, 0.1);
}

/* --------------------------------------------------------------------------
   Page Layout
   -------------------------------------------------------------------------- */
.bfai-auth-page {
    min-height: 100vh;
    background: var(--auth-bg);
    display: flex;
    flex-direction: column;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.bfai-auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}

/* Background gradient orbs */
.bfai-auth-main::before {
    content: '';
    position: absolute;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.bfai-auth-main::after {
    content: '';
    position: absolute;
    bottom: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.07) 0%, transparent 70%);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   Auth Card
   -------------------------------------------------------------------------- */
.bfai-auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--auth-surface);
    border: 1px solid var(--auth-surface-border);
    border-radius: var(--auth-radius-lg);
    padding: 40px;
    box-shadow: var(--auth-shadow), var(--auth-glow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: relative;
    z-index: 1;
    animation: auth-card-in 0.4s ease both;
}

@keyframes auth-card-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Card header */
.bfai-auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.bfai-auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--auth-primary-gradient);
    border-radius: 14px;
    font-size: 24px;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.bfai-auth-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--auth-text);
    margin: 0 0 6px;
    line-height: 1.3;
}

.bfai-auth-subtitle {
    font-size: 14px;
    color: var(--auth-text-muted);
    margin: 0;
}

/* --------------------------------------------------------------------------
   Flash Messages / Alerts
   -------------------------------------------------------------------------- */
.bfai-auth-alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
}

.bfai-auth-alert-icon {
    flex-shrink: 0;
    font-size: 16px;
    margin-top: 1px;
}

.bfai-auth-alert.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34d399;
}

.bfai-auth-alert.error {
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.25);
    color: #fb7185;
}

.bfai-auth-alert.info {
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
}

/* --------------------------------------------------------------------------
   Form Elements
   -------------------------------------------------------------------------- */
.bfai-auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.bfai-auth-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bfai-auth-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-text-muted);
    letter-spacing: 0.02em;
}

.bfai-auth-input-wrap {
    position: relative;
}

.bfai-auth-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-text-dim);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.bfai-auth-input {
    width: 100%;
    height: 48px;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: var(--auth-radius);
    color: var(--auth-text);
    font-size: 15px;
    font-family: inherit;
    padding: 0 14px 0 42px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-sizing: border-box;
    outline: none;
    -webkit-appearance: none;
}

.bfai-auth-input::placeholder {
    color: var(--auth-text-dim);
}

.bfai-auth-input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px var(--auth-input-focus);
    background: rgba(99, 102, 241, 0.04);
}

.bfai-auth-input.error {
    border-color: var(--auth-error);
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.15);
}

.bfai-auth-field-error {
    font-size: 12px;
    color: #fb7185;
    display: none;
}

.bfai-auth-field-error.visible {
    display: block;
}

/* Password toggle */
.bfai-auth-pw-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--auth-text-dim);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.bfai-auth-pw-toggle:hover {
    color: var(--auth-text-muted);
}

/* Checkbox row */
.bfai-auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.bfai-auth-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--auth-text-muted);
    cursor: pointer;
}

.bfai-auth-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-primary);
    cursor: pointer;
}

.bfai-auth-forgot-link {
    font-size: 13px;
    color: var(--auth-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.bfai-auth-forgot-link:hover {
    color: #a5b4fc;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.bfai-auth-btn {
    width: 100%;
    height: 50px;
    border-radius: var(--auth-radius);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.01em;
}

.bfai-auth-btn-primary {
    background: var(--auth-primary-gradient);
    color: #fff;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.bfai-auth-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.45);
}

.bfai-auth-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.bfai-auth-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Loading spinner */
.bfai-auth-btn-primary.loading .btn-text {
    display: none;
}

.bfai-auth-btn-primary .btn-spinner {
    display: none;
}

.bfai-auth-btn-primary.loading .btn-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bfai-spin 0.7s linear infinite;
}

@keyframes bfai-spin {
    to {
        transform: rotate(360deg);
    }
}

/* --------------------------------------------------------------------------
   Divider
   -------------------------------------------------------------------------- */
.bfai-auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--auth-text-dim);
    font-size: 12px;
}

.bfai-auth-divider::before,
.bfai-auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
}

/* --------------------------------------------------------------------------
   Google Button
   -------------------------------------------------------------------------- */
.bfai-auth-google-btn {
    width: 100%;
    height: 50px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--auth-radius);
    color: var(--auth-text);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s ease;
    text-decoration: none;
}

.bfai-auth-google-btn:hover {
    background: rgba(255, 255, 255, 0.09);
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.bfai-auth-google-btn img,
.bfai-auth-google-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Footer links
   -------------------------------------------------------------------------- */
.bfai-auth-footer-text {
    text-align: center;
    font-size: 14px;
    color: var(--auth-text-muted);
    margin-top: 24px;
}

.bfai-auth-footer-text a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.bfai-auth-footer-text a:hover {
    color: #a5b4fc;
}

/* --------------------------------------------------------------------------
   Dashboard
   -------------------------------------------------------------------------- */
.bfai-dashboard-page {
    min-height: 100vh;
    background: var(--auth-bg);
    display: flex;
    flex-direction: column;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.bfai-dashboard-main {
    flex: 1;
    padding: 40px 20px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.bfai-dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 40px;
}

.bfai-dashboard-welcome h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--auth-text);
    margin: 0 0 4px;
}

.bfai-dashboard-welcome p {
    font-size: 14px;
    color: var(--auth-text-muted);
    margin: 0;
}

.bfai-dashboard-logout-btn {
    height: 42px;
    padding: 0 20px;
    background: rgba(244, 63, 94, 0.1);
    border: 1px solid rgba(244, 63, 94, 0.25);
    border-radius: 10px;
    color: #fb7185;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.bfai-dashboard-logout-btn:hover {
    background: rgba(244, 63, 94, 0.18);
    color: #fb7185;
}

/* User info card */
.bfai-dashboard-grid {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
    align-items: start;
}

.bfai-dashboard-card {
    background: var(--auth-surface);
    border: 1px solid var(--auth-surface-border);
    border-radius: var(--auth-radius-lg);
    padding: 28px;
    backdrop-filter: blur(16px);
}

.bfai-dashboard-card-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--auth-text-dim);
    margin: 0 0 20px;
}

.bfai-dashboard-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--auth-primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin: 0 auto 16px;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.bfai-dashboard-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--auth-text);
    text-align: center;
    margin: 0 0 4px;
}

.bfai-dashboard-email {
    font-size: 13px;
    color: var(--auth-text-muted);
    text-align: center;
    margin: 0 0 20px;
}

.bfai-dashboard-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bfai-dashboard-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.bfai-dashboard-meta-label {
    font-size: 12px;
    color: var(--auth-text-dim);
    font-weight: 500;
}

.bfai-dashboard-meta-value {
    font-size: 13px;
    color: var(--auth-text-muted);
    font-weight: 600;
}

/* Badges */
.bfai-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.bfai-badge.active {
    background: rgba(16, 185, 129, 0.12);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.bfai-badge.pending {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.bfai-badge.google {
    background: rgba(66, 133, 244, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(66, 133, 244, 0.2);
}

.bfai-badge.email {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Feature placeholder cards */
.bfai-dashboard-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.bfai-feature-card {
    background: var(--auth-surface);
    border: 1px solid var(--auth-surface-border);
    border-radius: var(--auth-radius-lg);
    padding: 28px;
    backdrop-filter: blur(16px);
    position: relative;
    overflow: hidden;
}

.bfai-feature-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(45deg,
            transparent,
            transparent 10px,
            rgba(255, 255, 255, 0.01) 10px,
            rgba(255, 255, 255, 0.01) 20px);
}

.bfai-feature-card-inner {
    position: relative;
    z-index: 1;
}

.bfai-feature-card-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--auth-primary);
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.bfai-feature-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--auth-text);
    margin: 0 0 6px;
}

.bfai-feature-card p {
    font-size: 13px;
    color: var(--auth-text-muted);
    margin: 0;
    line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .bfai-auth-card {
        padding: 28px 24px;
    }

    .bfai-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .bfai-dashboard-main {
        padding: 24px 16px;
    }

    .bfai-dashboard-header {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .bfai-auth-card {
        padding: 24px 20px;
    }
}

/* --------------------------------------------------------------------------
   Light mode support (matches site theme)
   -------------------------------------------------------------------------- */
[data-theme="light"] {
    --auth-bg: #f8faff;
    --auth-surface: rgba(255, 255, 255, 0.9);
    --auth-surface-border: rgba(99, 102, 241, 0.15);
    --auth-text: #0f172a;
    --auth-text-muted: #475569;
    --auth-text-dim: #94a3b8;
    --auth-input-bg: rgba(0, 0, 0, 0.03);
    --auth-input-border: rgba(0, 0, 0, 0.1);
}