/* ============================================================
   TradeAI — Dark glassmorphism trading UI
   Fonts: Vazirmatn (fa) + Inter (en) | RTL/LTR aware
   ============================================================ */

:root {
    --bg: #070b14;
    --bg-soft: #0d1424;
    --panel: rgba(255, 255, 255, 0.045);
    --panel-strong: rgba(21, 27, 46, 0.9);
    --border: rgba(255, 255, 255, 0.09);
    --border-glow: rgba(59, 130, 246, 0.4);
    --text: #e7ecf5;
    --muted: #8b94ad;
    --primary: #3b82f6;
    --primary-2: #6366f1;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #38bdf8;
    --purple: #a855f7;
    --teal: #14b8a6;
    --radius: 16px;
    --font: 'Inter', 'Vazirmatn', system-ui, -apple-system, sans-serif;
    --mono: 'SFMono-Regular', Consolas, 'Courier New', monospace;
}

/* Dark-mode override for Bootstrap */
[data-bs-theme="dark"] body,
body {
    background-color: var(--bg);
    background-image:
        radial-gradient(900px 500px at 85% -10%, rgba(99, 102, 241, 0.12), transparent 60%),
        radial-gradient(700px 400px at -10% 30%, rgba(56, 189, 248, 0.08), transparent 55%);
    color: var(--text);
    font-family: var(--font);
    min-height: 100vh;
    overflow-x: hidden;
}

[dir="rtl"] body { font-family: 'Vazirmatn', 'Inter', system-ui, sans-serif; }

html { scroll-behavior: smooth; }

::selection { background: rgba(59, 130, 246, 0.35); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: #232c45; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #314066; }

/* ============ Glass & layout ============ */
.glass {
    background: var(--panel);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.glass-inner {
    background: rgba(13, 20, 36, 0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.page-main { padding-top: 88px; min-height: calc(100vh - 60px); }

.section { padding: 72px 0; }
.section-alt { background: rgba(13, 20, 36, 0.35); border-block: 1px solid var(--border); }

.section-title {
    font-weight: 800;
    background: linear-gradient(120deg, #fff 0%, #9db8ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
}

/* ============ Navbar ============ */
.navbar.glass {
    background: rgba(10, 15, 28, 0.82);
    border-bottom: 1px solid var(--border);
    border-radius: 0;
}

.navbar .nav-link {
    color: var(--muted);
    font-weight: 500;
    transition: color .2s;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: #fff;
}

.brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    color: #fff;
    font-size: 17px;
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.4);
}

.brand-icon.lg { width: 58px; height: 58px; font-size: 26px; border-radius: 16px; }
.brand-icon.warning { background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 6px 18px rgba(245, 158, 11, 0.4); }
.brand-icon.small { width: 26px; height: 26px; font-size: 13px; border-radius: 8px; }

.lang-switch { direction: ltr; }

/* Buttons */
.btn-ghost {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }

.btn-primary-glow {
    background: linear-gradient(135deg, var(--primary), var(--primary-2));
    border: none;
    color: #fff;
    font-weight: 600;
    box-shadow: 0 8px 22px rgba(59, 130, 246, 0.35);
    transition: transform .15s, box-shadow .2s;
}
.btn-primary-glow:hover { color: #fff; transform: translateY(-1px); box-shadow: 0 12px 28px rgba(59, 130, 246, 0.5); }

.badge-soft {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 30px;
    font-size: 0.82rem;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.18), rgba(168, 85, 247, 0.16));
    border: 1px solid var(--border-glow);
    color: #dbe7ff;
}

.live-dot {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--success);
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* ============ Flash toasts ============ */
.toast-flash {
    position: fixed;
    top: 82px;
    inset-inline-start: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    min-width: min(420px, 92vw);
    background: rgba(21, 27, 46, 0.92);
    border: 1px solid var(--border);
    border-radius: 12px;
    animation: slideDown .35s ease;
}
@keyframes slideDown { from { opacity: 0; transform: translate(-50%, -16px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============ Hero ============ */
.hero {
    position: relative;
    padding: 90px 0 70px;
    overflow: hidden;
}

.hero-title {
    font-size: clamp(1.9rem, 4.5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.2;
    background: linear-gradient(120deg, #fff 10%, #b6c9ff 55%, #8b5cf6 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle { font-size: 1.05rem; max-width: 560px; line-height: 1.8; }

.hero-stats strong { font-size: 1.4rem; color: #fff; display: block; }
.hero-stats span { color: var(--muted); font-size: 0.8rem; }

/* Floating orbs */
.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; animation: float 9s ease-in-out infinite; }
.orb-1 { width: 320px; height: 320px; background: #3b82f6; top: -60px; inset-inline-end: -40px; }
.orb-2 { width: 220px; height: 220px; background: #8b5cf6; bottom: -40px; inset-inline-start: -30px; animation-delay: -3s; }
.orb-3 { width: 160px; height: 160px; background: #22c55e; top: 40%; inset-inline-start: 35%; opacity: .25; animation-delay: -6s; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-26px); } }

.ticker-card { background: rgba(13, 20, 36, 0.65); }
.ticker-row { border-bottom: 1px dashed var(--border); }
.ticker-row:last-child { border-bottom: none; }
.ticker-row .mono { color: #c7d2fe; }

/* ============ Feature & market cards ============ */
.card-feature { padding: 26px; transition: transform .2s, border-color .2s; animation: fadeUp .5s ease both; }
.card-feature:nth-child(2) { animation-delay: .08s; }
.card-feature:nth-child(3) { animation-delay: .16s; }
.card-feature:nth-child(4) { animation-delay: .24s; }
.card-feature:hover { transform: translateY(-6px); border-color: var(--border-glow); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

.feature-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--purple));
    margin-bottom: 16px;
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.3);
}

.market-card { padding: 26px 12px; transition: transform .2s; }
.market-card:hover { transform: translateY(-5px); }
.market-icon { font-size: 30px; color: var(--info); }

/* ============ Pricing ============ */
.plan-card { position: relative; padding: 32px 26px; transition: transform .2s, border-color .2s; }
.plan-card:hover { transform: translateY(-6px); }
.plan-featured { border-color: var(--border-glow); box-shadow: 0 12px 40px rgba(59, 130, 246, 0.2); }
.plan-price { font-size: 2.4rem; font-weight: 800; }
.plan-features li { padding: 6px 0; color: #cbd5e1; }
.plan-features li i { font-size: 0.9rem; }

.cta-section { padding: 80px 0; }

/* ============ Auth ============ */
.auth-wrap { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 220px); padding: 40px 0; }
.auth-card { width: 100%; max-width: 430px; padding: 34px; background: rgba(13, 20, 36, 0.72); }

/* Bootstrap dark form controls */
.form-control, .form-select, .input-group-text {
    background: rgba(10, 15, 28, 0.8);
    border: 1px solid var(--border);
    color: var(--text);
}
.form-control:focus, .form-select:focus {
    background: rgba(10, 15, 28, 0.95);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.15);
}
.form-control::placeholder { color: #5b657f; }
.form-select option { background: #0d1424; color: #e7ecf5; }
.form-label { color: #c3cce0; font-weight: 500; }

/* Tables (dark) */
.table-dark {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.03);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
}
.table-dark thead th { color: var(--muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .4px; border-color: var(--border); }
.table-dark td { border-color: rgba(255, 255, 255, 0.06); }

/* ============ Dashboard stats ============ */
.stat-card { padding: 20px; display: flex; flex-direction: column; gap: 4px; animation: fadeUp .45s ease both; }
.stat-card:nth-child(2) { animation-delay: .06s; }
.stat-card:nth-child(3) { animation-delay: .12s; }
.stat-card:nth-child(4) { animation-delay: .18s; }
.stat-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff;
    margin-bottom: 10px;
}
.stat-icon.blue   { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.stat-icon.green  { background: linear-gradient(135deg, #22c55e, #16a34a); }
.stat-icon.purple { background: linear-gradient(135deg, #a855f7, #9333ea); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.stat-icon.red    { background: linear-gradient(135deg, #ef4444, #dc2626); }
.stat-icon.teal   { background: linear-gradient(135deg, #14b8a6, #0d9488); }
.stat-value { font-size: 1.5rem; font-weight: 800; }
.stat-label { color: var(--muted); font-size: 0.82rem; }

.welcome-card { background: linear-gradient(120deg, rgba(59,130,246,.14), rgba(168,85,247,.10)), var(--panel); }

/* ============ Signal badges ============ */
.signal-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: .5px;
}
.signal-badge.buy  { background: rgba(34, 197, 94, 0.16); color: #4ade80; border: 1px solid rgba(34,197,94,.35); }
.signal-badge.sell { background: rgba(239, 68, 68, 0.16); color: #f87171; border: 1px solid rgba(239,68,68,.35); }
.signal-badge.wait { background: rgba(245, 158, 11, 0.16); color: #fbbf24; border: 1px solid rgba(245,158,11,.35); }
.signal-badge.img  { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; border: 1px solid rgba(56,189,248,.35); }

.mono { font-family: var(--mono); }

.conf-bar .progress-bar { background: linear-gradient(90deg, #22c55e, #3b82f6); }

.text-purple { color: var(--purple); }

/* ============ Analysis result cards ============ */
.level-cell { text-align: center; padding: 14px 10px; border-radius: 12px; background: rgba(255,255,255,.03); }
.level-label { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.level-value { font-size: 1.05rem; font-weight: 700; margin-top: 4px; }
.level-value.green  { color: #4ade80; }
.level-value.red    { color: #f87171; }
.level-value.blue   { color: #7dd3fc; }
.level-value.orange { color: #fbbf24; }

.signal-banner {
    padding: 20px;
    border-radius: 14px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 1px;
}
.signal-banner.buy  { background: linear-gradient(135deg, rgba(34,197,94,.22), rgba(34,197,94,.08)); border: 1px solid rgba(34,197,94,.45); color: #4ade80; }
.signal-banner.sell { background: linear-gradient(135deg, rgba(239,68,68,.22), rgba(239,68,68,.08)); border: 1px solid rgba(239,68,68,.45); color: #f87171; }
.signal-banner.wait { background: linear-gradient(135deg, rgba(245,158,11,.22), rgba(245,158,11,.08)); border: 1px solid rgba(245,158,11,.45); color: #fbbf24; }

.conf-ring { position: relative; width: 92px; height: 92px; }
.conf-ring svg { transform: rotate(-90deg); }
.conf-ring .conf-text {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; font-weight: 800;
}

.indicator-pill {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 14px;
    border-radius: 10px;
    background: rgba(255,255,255,.03);
    border: 1px solid var(--border);
    font-size: .85rem;
}
.indicator-pill .ok  { color: #4ade80; }
.indicator-pill .bad { color: #f87171; }
.indicator-pill .mid { color: #fbbf24; }

.explanation-box { border-inline-start: 3px solid var(--primary); padding: 6px 0 6px 14px; line-height: 1.9; }

/* ============ Dropzone ============ */
.dropzone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 46px 20px;
    text-align: center;
    color: var(--muted);
    cursor: pointer;
    transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: rgba(59,130,246,.06); }

.chart-preview {
    max-height: 320px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(0,0,0,.25);
}

/* ============ Admin ============ */
.admin-nav { border-bottom: 1px solid rgba(245,158,11,.25); }
.page-link { background: rgba(255,255,255,.04); border-color: var(--border); color: var(--text); }
.page-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.page-item.active .page-link { background: linear-gradient(135deg, var(--primary), var(--primary-2)); border-color: transparent; }
.page-item.disabled .page-link { background: transparent; color: var(--muted); }

/* ============ Modal / footer ============ */
.modal-content.glass { background: #0f1628; border: 1px solid var(--border); }
.modal-header, .modal-footer { border-color: var(--border); }
.btn-close { filter: invert(1); }

.footer { margin-top: 40px; border-top: 1px solid var(--border); border-radius: 0; background: rgba(10, 15, 28, 0.7); }

/* ============ Utilities ============ */
.nav-pills .nav-link { color: var(--muted); }
.nav-pills .nav-link.active { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; }
.nav-pills .nav-link:not(.active):hover { color: #fff; }

@media (max-width: 576px) {
    .page-main { padding-top: 76px; }
    .hero { padding: 56px 0 48px; }
    .section { padding: 48px 0; }
    .stat-value { font-size: 1.2rem; }
}
