/* ============================================
   تم شب و روز + رنگ‌های پویا
   ============================================ */

/* ─── حالت روشن (پیش‌فرض) ─── */
:root,
[data-theme="light"] {
    --bg: #f5f6f8;
    --bg-2: #eef0f3;
    --surface: #ffffff;
    --surface-2: #f2f3f5;
    --surface-3: #e9ebee;
    --border: #eaecef;
    --border-strong: #dfe1e5;

    --text: #111827;
    --text-2: #374151;
    --text-muted: #6b7280;
    --text-light: #9ca3af;

    --shadow-xs: 0 1px 2px rgba(15,23,42,.04);
    --shadow-sm: 0 2px 6px rgba(15,23,42,.05);
    --shadow: 0 4px 14px rgba(15,23,42,.07);
    --shadow-lg: 0 12px 32px rgba(15,23,42,.12);

    --topbar-bg: rgba(255,255,255,.92);
    --bottomnav-bg: rgba(255,255,255,.96);
    --overlay: rgba(0,0,0,.4);

    --success: #16a34a;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;

    --input-bg: #ffffff;
    --input-placeholder: #9ca3af;
}

/* ─── حالت تاریک ─── */
[data-theme="dark"] {
    --bg: #0b0f14;
    --bg-2: #11161d;
    --surface: #161b22;
    --surface-2: #1c2229;
    --surface-3: #232a33;
    --border: #262d36;
    --border-strong: #333b45;

    --text: #f3f4f6;
    --text-2: #d1d5db;
    --text-muted: #9ca3af;
    --text-light: #6b7280;

    --shadow-xs: 0 1px 2px rgba(0,0,0,.4);
    --shadow-sm: 0 2px 6px rgba(0,0,0,.35);
    --shadow: 0 4px 14px rgba(0,0,0,.4);
    --shadow-lg: 0 12px 32px rgba(0,0,0,.55);

    --topbar-bg: rgba(22,27,34,.88);
    --bottomnav-bg: rgba(22,27,34,.95);
    --overlay: rgba(0,0,0,.65);

    --success: #22c55e;
    --danger: #f87171;
    --warning: #fbbf24;
    --info: #60a5fa;

    --input-bg: #1c2229;
    --input-placeholder: #6b7280;
}

/* ─── اعمال متغیرها ─── */
body {
    background: var(--bg);
    color: var(--text);
}

.app-topbar {
    background: var(--topbar-bg);
    border-bottom-color: var(--border);
}
.topbar-btn { color: var(--text); }
.topbar-btn:active { background: var(--surface-2); }
.topbar-logo { color: var(--text); }

.app-bottomnav {
    background: var(--bottomnav-bg);
    border-top-color: var(--border);
}

.card, .post-card, .shop-card, .product-card,
.plan-card, .stat-card, .user-card {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.form-control {
    background: var(--input-bg);
    border-color: var(--border-strong);
    color: var(--text);
}
.form-control::placeholder { color: var(--input-placeholder); }

.btn-outline {
    background: var(--surface);
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-outline:hover { background: var(--surface-2); color: var(--text); }

.text-muted { color: var(--text-muted); }
.post-name, .shop-card-name, .product-name,
.profile-name, .comment-name, .section-title,
.page-title, h1, h2, h3 { color: var(--text); }

.post-content, .comment-text, .product-desc p,
.profile-bio { color: var(--text-2); }

.post-avatar { border-color: var(--surface); }
.post-username, .comment-time, .msg-time { color: var(--text-light); }

.action-btn { color: var(--text-muted); }
.action-btn:active { background: var(--surface-2); }

.comment-avatar, .user-card-avatar { border-color: var(--surface); }

.tag-chip {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.chat-item:hover, .notif-item:hover { background: var(--surface-2); }

.msg.theirs .msg-bubble {
    background: var(--surface-2);
    color: var(--text);
}

/* ─── تم سوییچر ─── */
.theme-toggle {
    position: relative;
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: opacity .3s, transform .3s;
}
.theme-toggle .icon-sun { opacity: 0; transform: rotate(90deg); }
.theme-toggle .icon-moon { opacity: 1; transform: rotate(0); }

[data-theme="dark"] .theme-toggle .icon-sun { opacity: 1; transform: rotate(0); }
[data-theme="dark"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(-90deg); }

/* ─── اسکرول‌بار در حالت تاریک ─── */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--surface-2);
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}

/* ─── تصاویر در حالت تاریک یه کم محوتر ─── */
[data-theme="dark"] .post-image,
[data-theme="dark"] .product-thumb {
    background: var(--surface-2);
}

/* ─── اینپوت فایل در حالت تاریک ─── */
[data-theme="dark"] input[type="file"] {
    color: var(--text-muted);
}
[data-theme="dark"] input[type="file"]::file-selector-button {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border-strong);
    padding: 6px 12px;
    border-radius: 8px;
    margin-left: 8px;
    cursor: pointer;
}

/* ─── منوهای دراپ‌داون ─── */
[data-theme="dark"] select.form-control option {
    background: var(--surface);
    color: var(--text);
}

/* ─── اعلان‌ها ─── */
[data-theme="dark"] .alert-error,
[data-theme="dark"] .form-error {
    background: rgba(239,68,68,.12);
    color: #fca5a5;
}
[data-theme="dark"] .alert-success,
[data-theme="dark"] .form-success {
    background: rgba(22,163,74,.14);
    color: #86efac;
}
[data-theme="dark"] .alert-info {
    background: rgba(59,130,246,.14);
    color: #93c5fd;
}