/* ── Layout ── */
#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-height: 100vh;
    background: var(--bg-primary);
}
.topbar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    padding: 0 16px;
    min-height: 60px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow-sm);
}
@media (max-width: 768px) {
    .topbar { padding: 0 12px; justify-content: space-between; }
    .topbar-brand { position: absolute; left: 50%; transform: translateX(-50%); font-size: 10px; white-space: nowrap; }
    .topbar-left { display: flex; align-items: center; }
    .topbar-right { margin-left: 0; }
}
@media (min-width: 769px) {
    .mobile-menu-btn { display: none !important; }
}
.topbar-brand { font-family: var(--font-fa); font-size: 13px; font-weight: 600; color: var(--gold-dim); }
.topbar-brand i { color: var(--gold); margin-left: 8px; }
.topbar-left { display: flex; align-items: center; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.topbar-right a { font-family: var(--font-fa); font-size: 13px; color: var(--text-muted); text-decoration: none; display: flex; align-items: center; gap: 6px; padding: 8px 0; transition: color 0.15s; }
.topbar-right a:hover { color: var(--text-primary); }
.topbar-right a:active { color: var(--gold); }
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text-secondary); font-size: 20px; cursor: pointer; padding: 8px; }
@media (max-width: 768px) { .mobile-menu-btn { display: flex; } }
.hide-mobile {}
@media (max-width: 768px) { .hide-mobile { display: none; } }
.content { flex: 1; overflow-y: auto; padding: 20px 16px 32px; direction: rtl; }
@media (min-width: 769px) { .content { padding: 32px 36px 48px; } }

/* ── Page header ── */
.page-header { margin-bottom: 32px; }
.page-title {
    font-size: 1.5rem; font-weight: 700;
    color: var(--text-primary);
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 6px;
}
.page-title i { color: var(--gold); }
.page-subtitle { color: var(--text-muted); font-size: .9rem; }

/* ── Articles grid ── */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ── Article card ── */
.article-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .22s ease, border-color .22s ease, transform .22s ease;
    box-shadow: var(--shadow-sm);
}
.article-card:hover {
    border-color: var(--border-gold);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}
.article-cover {
    width: 100%; height: 160px;
    background: var(--gold-glow);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.article-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.article-cover .placeholder-icon { font-size: 2rem; color: var(--gold); }
.article-card-body { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.article-card-title {
    font-size: 1rem; font-weight: 700; color: var(--text-primary);
    line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.article-card-excerpt {
    font-size: .85rem; color: var(--text-muted); line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
    flex: 1;
}
.article-card-meta {
    display: flex; align-items: center; gap: 14px;
    font-size: .78rem; color: var(--text-muted);
    font-family: var(--font-en);
    margin-top: 4px; padding-top: 12px;
    border-top: 1px solid var(--border-light);
}
.article-card-meta span { display: flex; align-items: center; gap: 5px; }
.article-card-meta i { color: var(--gold); font-size: .75rem; }

/* ── Empty state ── */
.articles-empty {
    text-align: center; padding: 60px 20px;
    color: var(--text-muted);
}
.articles-empty i { font-size: 2.2rem; color: var(--border-medium); margin-bottom: 14px; display: block; }

/* ── Pagination ── */
.pagination {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-top: 36px; flex-wrap: wrap;
}
.page-btn {
    min-width: 36px; height: 36px; padding: 0 10px;
    display: flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-light); border-radius: 9px;
    background: var(--bg-card); color: var(--text-secondary);
    text-decoration: none; font-family: var(--font-en); font-size: .85rem;
    transition: all .15s;
}
.page-btn:hover { border-color: var(--gold); color: var(--gold); }
.page-btn.active { background: var(--gold); border-color: var(--gold); color: #fff; font-weight: 700; }
.page-ellipsis { color: var(--text-muted); padding: 0 4px; }

/* ══════════════ Article detail page ══════════════ */
.article-back {
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--text-muted); text-decoration: none; font-size: .85rem;
    margin-bottom: 20px; transition: color .15s;
}
.article-back:hover { color: var(--gold); }
@media (max-width: 768px) {
    .article-back { font-size: .78rem; margin-bottom: 16px; }
}

.article-hero {
    width: 100%; max-height: 360px; border-radius: 16px;
    overflow: hidden; margin-bottom: 24px;
    background: var(--gold-glow);
}
.article-hero img { width: 100%; max-height: 360px; object-fit: cover; display: block; }
@media (max-width: 768px) {
    .article-hero { max-height: 220px; border-radius: 12px; margin-bottom: 18px; }
    .article-hero img { max-height: 220px; }
}

.article-detail-title {
    font-size: 1.7rem; font-weight: 700; color: var(--text-primary);
    line-height: 1.4; margin-bottom: 14px;
}
@media (max-width: 768px) {
    .article-detail-title { font-size: 1.25rem; margin-bottom: 10px; }
}

.article-detail-meta {
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    font-size: .82rem; color: var(--text-muted); font-family: var(--font-en);
    margin-bottom: 28px; padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}
.article-detail-meta span { display: flex; align-items: center; gap: 6px; }
.article-detail-meta i { color: var(--gold); }
@media (max-width: 768px) {
    .article-detail-meta { gap: 12px; font-size: .75rem; margin-bottom: 20px; padding-bottom: 16px; }
}

.article-share-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; color: var(--text-muted);
    border: none; font-size: .82rem; font-family: var(--font-en);
    cursor: pointer; transition: color 0.2s ease;
    padding: 0; margin-right: auto;
    touch-action: manipulation;
}
.article-share-btn:hover { color: var(--gold); }
.article-share-btn:active { color: var(--gold); transform: scale(0.95); }
.article-share-btn i { color: var(--gold); font-size: .82rem; }
@media (max-width: 768px) {
    .article-share-btn { font-size: .75rem; gap: 4px; }
    .article-share-btn i { font-size: .75rem; }
}

.article-body {
    max-width: 760px;
    margin: 0 auto;
    text-align: justify;
    font-size: .98rem; line-height: 1.9; color: var(--text-secondary);
    direction: rtl;
}
/* Override Quill-generated direction/text-align for RTL */
.article-body * { direction: rtl; text-align: right; }
.article-body [style*="text-align:left"],
.article-body [style*="text-align: left"] { text-align: right !important; }
.article-body [dir="ltr"] { direction: rtl !important; text-align: right !important; }
.article-body h2 { font-size: 1.3rem; font-weight: 700; color: var(--text-primary); margin: 28px 0 14px; }
.article-body h3 { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin: 22px 0 12px; }
.article-body h4 { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin: 18px 0 10px; }
.article-body p { margin-bottom: 16px; }
.article-body p:empty { display: none; }
.article-body p:has(br:only-child) { display: none; }
.article-body ul, .article-body ol { padding-right: 22px; margin-bottom: 16px; }
.article-body li { margin-bottom: 6px; }
.article-body blockquote {
    border-right: 3px solid var(--gold); background: var(--gold-glow);
    padding: 14px 18px; border-radius: 0 10px 10px 0;
    margin: 18px 0; color: var(--text-primary); font-style: italic;
}
.article-body a { color: var(--gold); text-decoration: underline; }
.article-body img { max-width: 100%; border-radius: 10px; margin: 12px 0; display: block; }
.article-body figure { margin: 18px 0; }
.article-body figcaption { font-size: .82rem; color: var(--text-muted); text-align: center !important; margin-top: 6px; }
.article-body figure img { text-align: center !important; }
@media (max-width: 768px) {
    .article-body {
        font-size: .9rem; line-height: 1.85; text-align: right;
        padding: 0 4px;
    }
    .article-body h2 { font-size: 1.15rem; margin: 22px 0 12px; }
    .article-body h3 { font-size: 1.05rem; margin: 18px 0 10px; }
    .article-body h4 { font-size: .95rem; margin: 14px 0 8px; }
    .article-body p { margin-bottom: 14px; }
    .article-body ul, .article-body ol { padding-right: 18px; margin-bottom: 14px; }
    .article-body blockquote { padding: 12px 14px; margin: 14px 0; }
    .article-body figcaption { font-size: .75rem; }
}

/* ── Related articles ── */
.related-section { margin-top: 56px; padding-top: 32px; border-top: 1px solid var(--border-light); max-width: 760px; margin-right: auto; margin-left: auto; }
.related-title { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 18px; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
@media (max-width: 768px) {
    .related-section { margin-top: 40px; padding-top: 24px; }
    .related-title { font-size: 1rem; margin-bottom: 14px; }
    .related-grid { grid-template-columns: 1fr; gap: 12px; }
}

/* ── Winners Mini Cards ── */
.winners-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 600px) { .winners-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; } }
@media (min-width: 900px) { .winners-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; } }
@media (max-width: 480px) {
    .winners-grid { gap: 12px; }
    .winner-card { padding: 16px; gap: 12px; }
    .rank-badge { top: 10px; right: 10px; width: 32px; height: 32px; font-size: 13px; }
    .winner-name { font-size: 15px; }
    .profit-pct { font-size: 36px; }
    .card-stats { gap: 8px; }
    .card-btn { padding: 14px 16px; font-size: 14px; }
}
.winner-card { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 16px; padding: 24px; position: relative; display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow-sm); transition: all 0.2s; text-align: center; }
.winner-card:active { transform: scale(0.98); }
@media (min-width: 769px) { .winner-card { padding: 24px; gap: 18px; text-align: right; } }
.winner-card.rank-1 { border-top: 3px solid var(--gold); }
.winner-card.rank-2 { border-top: 3px solid #6b7280; }
.winner-card.rank-3 { border-top: 3px solid var(--gold-dim); }
.rank-badge { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: var(--font-en); font-size: 15px; font-weight: 700; }
@media (min-width: 769px) { .rank-badge { top: 20px; right: 20px; width: 32px; height: 32px; font-size: 13px; } }
.rank-1 .rank-badge { background: var(--gold-glow); color: var(--gold); border: 1px solid var(--gold-dim); }
.rank-2 .rank-badge { background: rgba(107,114,128,0.12); color: #6b7280; border: 1px solid rgba(107,114,128,0.25); }
.rank-3 .rank-badge { background: rgba(184,148,79,0.1); color: var(--gold-dim); border: 1px solid var(--border-gold); }
.winner-name { font-family: var(--font-fa); font-size: 18px; font-weight: 700; filter: blur(6px); user-select: none; color: var(--text-primary); margin-bottom: 5px; }
@media (min-width: 769px) { .winner-name { font-size: 16px; } }
.winner-since { font-family: var(--font-fa); font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 5px; justify-content: center; }
@media (min-width: 769px) { .winner-since { justify-content: flex-start; font-size: 10px; } }
.winner-since i { color: var(--gold); font-size: 9px; }
.profit-pct { font-family: var(--font-en); font-size: 48px; font-weight: 700; letter-spacing: -1px; line-height: 1; font-variant-numeric: tabular-nums; text-align: center; }
@media (min-width: 769px) { .profit-pct { font-size: 40px; text-align: right; } }
.profit-pct.pos { color: var(--green); }
.profit-pct.neg { color: var(--red); }
.profit-label { font-family: var(--font-en); font-size: 12px; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 500; margin-top: 5px; text-align: center; }
@media (min-width: 769px) { .profit-label { font-size: 9px; text-align: right; } }
.card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box { background: var(--bg-primary); border: 1px solid var(--border-light); border-radius: 10px; padding: 14px 10px; text-align: center; }
@media (min-width: 769px) { .stat-box { padding: 10px; text-align: right; } }
.sb-label { font-family: var(--font-en); font-size: 11px; letter-spacing: 0.5px; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
@media (min-width: 769px) { .sb-label { font-size: 8px; } }
.sb-value { font-family: var(--font-en); font-size: 16px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; word-break: break-word; }
@media (min-width: 769px) { .sb-value { font-size: 14px; } }
.sb-value.pos { color: var(--green); }
.sb-value.neg { color: var(--red); }
.stat-box.full-width { grid-column: 1 / -1; }
.card-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 20px; background: var(--gold-glow); border: 1px solid var(--border-gold); border-radius: 12px; color: var(--gold); font-family: var(--font-fa); font-size: 15px; font-weight: 600; text-decoration: none; transition: all 0.2s; margin-top: 8px; touch-action: manipulation; }
@media (min-width: 769px) { .card-btn { padding: 12px 16px; font-size: 12px; } }
.card-btn:active { background: var(--gold); border-color: var(--gold); color: white; transform: scale(0.97); }
.section-header { display: flex; align-items: center; gap: 12px; margin: 8px 0 4px; }
.section-header i { color: var(--gold); font-size: 18px; }

/* ── Brand Hero (shared with public article pages) ── */
.brand-hero {
    text-align: center;
    padding: 12px 0 8px;
}
.brand-hero-persian {
    font-family: var(--font-fa);
    font-size: clamp(28px, 6vw, 48px);
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--text-primary);
    line-height: 1.2;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--gold-dim) 50%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    position: relative;
    display: inline-block;
}
.brand-hero-persian::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    border-radius: 1px;
}
.brand-hero-sub {
    font-family: var(--font-en);
    font-size: 10px;
    letter-spacing: 5px;
    color: var(--gold-dim);
    text-transform: uppercase;
    margin-top: 8px;
}
@media (max-width: 480px) {
    .brand-hero { padding: 8px 0 4px; }
    .brand-hero-persian { font-size: clamp(22px, 8vw, 32px); letter-spacing: 1px; }
    .brand-hero-sub { font-size: 8px; letter-spacing: 3px; margin-top: 6px; }
}

/* ── FX Ticker (shared with public article pages) ── */
.fx-ticker-wrap {
    width: 100%;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    min-height: 48px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow-sm);
    touch-action: pan-y pinch-zoom;
    position: relative;
    margin-bottom: 24px;
    direction: ltr;
}
.fx-ticker-track {
    display: flex;
    gap: 0;
    align-items: center;
    white-space: nowrap;
    will-change: transform;
    width: max-content;
    flex-shrink: 0;
}
.fx-ticker-track.animated {
    animation: ticker-scroll 56s linear infinite;
}
.fx-ticker-wrap:hover .fx-ticker-track.animated {
    animation-play-state: paused;
}
@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.fx-pair {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    font-family: var(--font-en);
    font-size: 12px;
    font-weight: 500;
    border-right: 1px solid var(--border-light);
    flex-shrink: 0;
}
@media (max-width: 480px) {
    .fx-pair {
        padding: 0 12px;
        gap: 6px;
        font-size: 10px;
    }
}
.fx-pair .sym { color: var(--gold-dim); font-size: 10px; letter-spacing: 0.5px; font-weight: 600; }
.fx-pair .val { color: var(--text-secondary); font-weight: 500; }
.fx-pair.up .val { color: var(--green); font-weight: 600; }
.fx-pair.dn .val { color: var(--red); font-weight: 600; }
.fx-pair .arr { font-size: 9px; }
