:root {
    --brand-1: #4a4a4a;
    --brand-2: #6b6b6b;
    --brand-3: #8a8a8a;
    --gradient: linear-gradient(135deg, var(--brand-1) 0%, var(--brand-2) 50%, var(--brand-3) 100%);

    --bg: #f5f5f5;
    --bg-grad-1: #e0e0e0;
    --bg-grad-2: #e8e8e8;
    --surface: rgba(255, 255, 255, 0.85);
    --surface-solid: #ffffff;
    --surface-soft: #fafafa;
    --border: rgba(100, 100, 100, 0.16);
    --border-strong: rgba(100, 100, 100, 0.4);

    --text: #1a1a1a;
    --text-muted: #6b7280;
    --text-soft: #9ca3af;

    --danger: #ef4444;
    --success: #10b981;

    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.15);
    --shadow-soft: 0 10px 30px -12px rgba(0, 0, 0, 0.1);
    --ring: 0 0 0 4px rgba(100, 100, 100, 0.18);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg: #1a1a1a;
    --bg-grad-1: #2a2a2a;
    --bg-grad-2: #222222;
    --surface: rgba(40, 40, 40, 0.85);
    --surface-solid: #2d2d2d;
    --surface-soft: #333333;
    --border: rgba(150, 150, 150, 0.16);
    --border-strong: rgba(150, 150, 150, 0.4);

    --text: #e5e5e5;
    --text-muted: #a0a0a0;
    --text-soft: #707070;

    --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
    --shadow-soft: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { color-scheme: light dark; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: radial-gradient(1200px 600px at 10% -10%, var(--bg-grad-1), transparent 60%),
                radial-gradient(1000px 500px at 110% 10%, var(--bg-grad-2), transparent 55%),
                var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow-x: hidden;
    transition: background var(--transition), color var(--transition);
}

/* Animated background orbs */
.bg-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.3; animation: float 18s ease-in-out infinite; }
.orb-1 { width: 360px; height: 360px; background: var(--brand-1); top: -80px; left: -60px; }
.orb-2 { width: 300px; height: 300px; background: var(--brand-3); bottom: -90px; right: -40px; animation-delay: -6s; }
.orb-3 { width: 240px; height: 240px; background: var(--brand-2); top: 40%; right: 20%; animation-delay: -12s; }

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(20px, -30px) scale(1.08); }
}

.container {
    width: 100%;
    max-width: 460px;
    position: relative;
    z-index: 1;
}

/* Brand */
.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
    padding-left: 4px;
}

.brand-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--gradient);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 24px;
    font-weight: 800;
    box-shadow: var(--shadow-soft);
}

.brand-logo-img {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    object-fit: contain;
    box-shadow: var(--shadow-soft);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.brand-tagline { font-size: 13px; color: var(--text-muted); }
.brand-cta {
    margin-left: auto;
    padding: 9px 16px;
    border-radius: 10px;
    background: var(--gradient);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--shadow-soft);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.brand-cta:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

/* Card */
.card {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px;
    animation: card-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Tabs */
.auth-tabs {
    position: relative;
    display: flex;
    gap: 6px;
    margin-bottom: 28px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 6px;
}

.tab-indicator {
    position: absolute;
    top: 6px;
    left: 6px;
    width: calc(50% - 6px);
    height: calc(100% - 12px);
    background: var(--gradient);
    border-radius: 10px;
    box-shadow: var(--shadow-soft);
    transition: transform var(--transition);
    z-index: 0;
}

.tab-indicator.right { transform: translateX(100%); }

.tab-btn {
    position: relative;
    z-index: 1;
    flex: 1;
    padding: 11px;
    background: none;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition);
}

.tab-btn.active { color: #fff; }

.tab-content { display: none; }
.tab-content.active { display: block; animation: fade-in 0.35s ease both; }

@keyframes fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
h3 { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.subtitle { color: var(--text-muted); font-size: 14px; margin: 6px 0 24px; }
.optional { color: var(--text-soft); font-weight: 400; }

.form-group { margin-bottom: 18px; }
.form-row { display: flex; gap: 14px; }
.form-row .form-group { flex: 1; }

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 600;
    font-size: 13px;
}

.input-wrap { position: relative; display: flex; align-items: center; }

.input-icon {
    position: absolute;
    left: 14px;
    font-size: 15px;
    color: var(--text-soft);
    pointer-events: none;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
textarea {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface-soft);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input-wrap input { padding-left: 40px; }
.input-wrap input[type="password"],
.input-wrap input[type="text"].has-toggle { padding-right: 64px; }

input::placeholder, textarea::placeholder { color: var(--text-soft); }

input:focus, textarea:focus {
    outline: none;
    border-color: var(--brand-1);
    box-shadow: var(--ring);
    background: var(--surface-solid);
}

textarea { resize: vertical; min-height: 96px; }

.toggle-password {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--brand-1);
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background var(--transition);
}

.toggle-password:hover { background: rgba(100, 100, 100, 0.1); }

small { display: block; margin-top: 6px; color: var(--text-muted); font-size: 12px; }

/* Password strength */
.strength { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.strength-bar { flex: 1; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.strength-fill { display: block; height: 100%; width: 0; border-radius: 999px; transition: width var(--transition), background var(--transition); }
.strength-label { font-size: 12px; font-weight: 600; min-width: 56px; text-align: right; color: var(--text-muted); }
.strength-fill.weak { width: 33%; background: var(--danger); }
.strength-fill.medium { width: 66%; background: #f59e0b; }
.strength-fill.strong { width: 100%; background: var(--success); }

/* Buttons */
.btn {
    position: relative;
    width: 100%;
    padding: 13px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), opacity var(--transition);
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--gradient); color: #fff; box-shadow: var(--shadow-soft); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -8px rgba(100, 100, 100, 0.55); }

.btn-ghost { background: transparent; color: var(--text); border: 1.5px solid var(--border-strong); }
.btn-ghost:hover { background: var(--surface-soft); }

.btn.loading { pointer-events: none; opacity: 0.85; }
.btn.loading .btn-label { opacity: 0.6; }
.spinner { display: none; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.btn-ghost .spinner { border-color: rgba(100,100,100,0.3); border-top-color: var(--brand-1); }
.btn.loading .spinner { display: inline-block; }

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

/* Inline messages (kept for compatibility) */
.error-message { color: var(--danger); font-size: 13px; margin-top: 12px; display: none; }
.error-message.show { display: block; }
.success-message { color: var(--success); font-size: 13px; margin-top: 12px; display: none; }
.success-message.show { display: block; }

.hidden { display: none !important; }

/* Profile */
.profile-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.profile-identity { display: flex; align-items: center; gap: 14px; }
.avatar {
    width: 52px; height: 52px; border-radius: 16px;
    background: var(--gradient); color: #fff;
    display: grid; place-items: center;
    font-size: 22px; font-weight: 800;
    box-shadow: var(--shadow-soft);
}
.profile-header .btn { width: auto; margin-top: 0; }

.profile-info {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 20px;
    margin-bottom: 20px;
}

.info-group { display: flex; padding: 14px 0; border-bottom: 1px solid var(--border); }
.info-group:last-child { border-bottom: none; }
.info-group label { font-weight: 600; color: var(--text-muted); width: 140px; margin: 0; font-size: 13px; }
.info-group span { color: var(--text); flex: 1; font-weight: 500; font-size: 14px; }

.profile-edit { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--border); }
.form-actions { display: flex; gap: 12px; }

/* Theme toggle */
.theme-toggle {
    position: fixed;
    top: 20px; right: 20px;
    z-index: 5;
    width: 44px; height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(12px);
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow-soft);
    transition: transform var(--transition), background var(--transition);
}
.theme-toggle:hover { transform: translateY(-2px); }
.theme-icon { font-size: 20px; line-height: 1; grid-area: 1 / 1; transition: opacity var(--transition), transform var(--transition); }
.theme-icon-sun { opacity: 1; transform: rotate(0); }
.theme-icon-moon { opacity: 0; transform: rotate(-90deg); }
[data-theme="dark"] .theme-icon-sun { opacity: 0; transform: rotate(90deg); }
[data-theme="dark"] .theme-icon-moon { opacity: 1; transform: rotate(0); }

/* Toasts */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: max-content;
    max-width: calc(100% - 40px);
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 18px;
    border-radius: var(--radius-sm);
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-left: 4px solid var(--brand-1);
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    animation: toast-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.toast.hide { animation: toast-out 0.3s ease forwards; }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--brand-1); }
.toast-icon { font-size: 16px; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes toast-out {
    to { opacity: 0; transform: translateY(-16px); }
}

/* Landing layout */
.page {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1200px;
    min-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 4px 72px 4px 4px;
}

.topbar .brand { margin-bottom: 0; text-decoration: none; color: inherit; }

.topbar-actions { display: flex; align-items: center; }
#authNav, #userNav { display: flex; align-items: center; gap: 12px; }
.topbar-btn { width: auto; margin-top: 0; padding: 10px 18px; font-size: 14px; }
.user-email { font-weight: 600; font-size: 14px; color: var(--text-muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 32px;
    padding: 40px 16px 80px;
}

.hero-title {
    font-size: clamp(34px, 7vw, 68px);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.05;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    max-width: 14ch;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 18px 40px;
    border-radius: 999px;
    background: var(--gradient);
    color: #fff;
    font-size: clamp(17px, 2.4vw, 22px);
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}

.hero-cta:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 20px 44px -10px rgba(100, 100, 100, 0.6); }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 16, 32, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fade-in 0.2s ease both;
}

.modal {
    position: relative;
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: var(--surface-soft);
    color: var(--text-muted);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.modal-close:hover { background: var(--border); color: var(--text); }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* Homepage Content Sections */
.hero-subtitle {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 16px 0 28px;
    max-width: 600px;
}

.hero-features,
.how-it-works {
    margin-top: 48px;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
}

.features-list,
.steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.features-list li,
.steps-list li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    line-height: 1.6;
    color: var(--text);
}

.features-list li:last-child,
.steps-list li:last-child {
    border-bottom: none;
}

.features-list strong,
.steps-list strong {
    color: var(--text);
    font-weight: 600;
}

@media (max-width: 600px) {
    .card { padding: 24px; }
    .form-row { flex-direction: column; gap: 0; }
    .profile-header { flex-direction: column; align-items: flex-start; gap: 16px; }
    .profile-header .btn { width: 100%; }
    .form-actions { flex-direction: column; }
    .topbar { flex-direction: column; align-items: flex-start; gap: 14px; padding: 4px 60px 4px 4px; }
    .brand-tagline { display: none; }
    .user-email { max-width: 150px; }
    .topbar-btn { padding: 9px 14px; font-size: 13px; }
    
    .hero-features,
    .how-it-works {
        padding: 20px;
        margin-top: 32px;
    }
    
    .section-title {
        font-size: 20px;
    }
}
