/* ========================================
   MyTradeBlaze — Dark Trading Theme
   ======================================== */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2332;
    --bg-card-hover: #1f2b3d;
    --bg-input: #0f1923;
    --border: #2a3a4e;
    --border-focus: #3b82f6;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-glow: rgba(59, 130, 246, 0.2);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);

    --green: #10b981;
    --red: #ef4444;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --transition: all 0.2s ease;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ---- NAVBAR ---- */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-brand a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
}
.brand-icon { font-size: 1.5rem; }
.nav-links {
    display: flex;
    gap: 0.25rem;
}
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}
.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
    background: var(--bg-card);
}
.nav-logout { color: var(--text-muted); }
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border);
        padding: 1rem;
    }
    .nav-links.open { display: flex; }
    .nav-toggle { display: block; }
}

/* ---- CONTAINER ---- */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}
.container-wide { max-width: 1200px; }

/* ---- CARDS ---- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: var(--transition);
}
.card:hover { border-color: var(--border-focus); }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}
.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 20px var(--accent-glow);
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}
.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); }
.btn-success {
    background: var(--success);
    color: white;
}
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}
.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}
.btn-block { width: 100%; }
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- FORMS ---- */
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label, .form-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8'%3E%3Cpath d='M8 12L2 6h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* ---- CHECKBOX / RADIO GROUPS ---- */
.choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}
.choice-card {
    position: relative;
}
.choice-card input {
    position: absolute;
    opacity: 0;
}
.choice-card .choice-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}
.choice-card input:checked + .choice-label {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.08);
}
.choice-card .choice-label:hover {
    border-color: var(--accent);
}
.choice-indicator {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
input[type="radio"] + .choice-label .choice-indicator {
    border-radius: 50%;
}
.choice-card input:checked + .choice-label .choice-indicator {
    border-color: var(--accent);
    background: var(--accent);
}
.choice-card input:checked + .choice-label .choice-indicator::after {
    content: '\2713';
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
}

/* ---- PROGRESS BAR ---- */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #8b5cf6);
    border-radius: 999px;
    transition: width 0.5s ease;
}

/* ---- ONBOARDING ---- */
.onboarding-wrapper {
    max-width: 640px;
    margin: 0 auto;
    padding-top: 2rem;
}
.onboarding-header {
    text-align: center;
    margin-bottom: 2rem;
}
.onboarding-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}
.onboarding-header p {
    color: var(--text-secondary);
}
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: var(--transition);
}
.step-dot.active { background: var(--accent); }
.step-dot.done { background: var(--success); }
.onboarding-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
}
.onboarding-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
    gap: 1rem;
}

/* ---- ASSESSMENT ---- */
.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.question-number {
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.question-text {
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 1rem;
}
.question-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.option-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.option-label:hover { border-color: var(--accent); }
.option-label input { display: none; }
.option-label input:checked + .option-letter {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.option-label input:checked ~ span:last-child { color: var(--text-primary); }
.option-letter {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: var(--transition);
}

/* ---- ROADMAP REVEAL ---- */
.roadmap-reveal {
    text-align: center;
    padding: 2rem 0;
}
.roadmap-reveal h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
.insight-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
}
.insight-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: left;
}
.insight-card.strengths { border-left: 3px solid var(--success); }
.insight-card.priorities { border-left: 3px solid var(--warning); }
.insight-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.insight-card.strengths .insight-label { color: var(--success); }
.insight-card.priorities .insight-label { color: var(--warning); }
.insight-list {
    list-style: none;
}
.insight-list li {
    color: var(--text-secondary);
    padding: 0.25rem 0;
    font-size: 0.95rem;
}
.habit-card {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    text-align: left;
}
.habit-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #8b5cf6;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

/* ---- WEEK CARDS ---- */
.week-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: var(--transition);
}
.week-card.locked {
    opacity: 0.5;
}
.week-card.current {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}
.week-card.completed {
    border-color: var(--success);
}
.week-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.week-number {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
}
.week-card.completed .week-number { color: var(--success); }
.week-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}
.status-locked { background: var(--bg-input); color: var(--text-muted); }
.status-current { background: var(--accent-glow); color: var(--accent); }
.status-done { background: var(--success-bg); color: var(--success); }
.week-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.week-outcome {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.lesson-list {
    list-style: none;
}
.lesson-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
}
.lesson-item:first-child { border-top: none; }
.lesson-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.lesson-icon.micro_lesson { background: rgba(59, 130, 246, 0.15); color: var(--accent); }
.lesson-icon.practice { background: rgba(139, 92, 246, 0.15); color: #8b5cf6; }
.lesson-icon.journal_hook { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.lesson-icon.action_item { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.lesson-icon.assessment { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.lesson-info { flex: 1; }
.lesson-title-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
}
.lesson-title-link:hover { color: var(--accent); }
.lesson-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.lesson-done {
    color: var(--success);
    font-size: 1.2rem;
}
.explain-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.explain-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.explain-text {
    display: none;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ---- LESSON PAGE ---- */
.lesson-page-header {
    margin-bottom: 2rem;
}
.lesson-page-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}
.lesson-breadcrumb {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.lesson-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    line-height: 1.8;
}
.lesson-content h1, .lesson-content h2, .lesson-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}
.lesson-content h1 { font-size: 1.5rem; }
.lesson-content h2 { font-size: 1.25rem; }
.lesson-content h3 { font-size: 1.1rem; }
.lesson-content p { margin-bottom: 1rem; color: var(--text-secondary); }
.lesson-content ul, .lesson-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}
.lesson-content li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}
.lesson-content strong { color: var(--text-primary); }
.lesson-content code {
    background: var(--bg-input);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.9em;
}

/* ---- DASHBOARD ---- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}
.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* ---- CHAT ---- */
.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    max-height: 700px;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.chat-bubble {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    line-height: 1.5;
    font-size: 0.95rem;
}
.chat-bubble.user {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 4px;
}
.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
    color: var(--text-secondary);
}
.chat-input-area {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
}
.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font);
}
.chat-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* ---- JOURNAL ---- */
.journal-entry {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
}
.journal-entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.journal-pair {
    font-weight: 600;
    font-size: 1.05rem;
}
.journal-direction {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}
.journal-direction.long { background: var(--success-bg); color: var(--success); }
.journal-direction.short { background: var(--danger-bg); color: var(--danger); }
.journal-meta-row {
    display: flex;
    gap: 1.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ---- AUTH PAGES ---- */
.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}
.auth-card h1 {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
}
.auth-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}
.auth-card .form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
}
.auth-card .form-group input:focus {
    outline: none;
    border-color: var(--accent);
}
.auth-link {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.auth-link a {
    color: var(--accent);
    text-decoration: none;
}

/* ---- ALERTS ---- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }

/* ---- FORM ERRORS ---- */
.errorlist {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0 0;
}
.errorlist li {
    color: var(--danger);
    font-size: 0.85rem;
}

/* ---- UTILITIES ---- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* ---- LOADING SPINNER ---- */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- SCROLL ---- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---- RESPONSIVE ---- */
@media (max-width: 640px) {
    .insight-grid { grid-template-columns: 1fr; }
    .container { padding: 1rem; }
    .onboarding-card { padding: 1.25rem; }
    .dashboard-grid { grid-template-columns: 1fr; }
}
