/* =========================================================
   پنل توییتر و تلگرام – Style.css
   طراحی دارک با شیشه‌ای، هماهنگ با تصاویر مرجع
   ========================================================= */

/* ================ متغیرهای رنگی ================ */
:root {
    --bg-1: #0b1221;
    --bg-2: #0e1628;
    --bg-3: #131c33;
    --surface: #182241;
    --surface-2: #1c2848;
    --surface-3: #20305a;
    --border: #243156;
    --border-soft: rgba(255,255,255,0.06);
    --text: #e8edf7;
    --text-muted: #95a3c2;
    --text-soft: #6c7a99;

    --primary: #4a5cff;
    --primary-2: #5b6dff;
    --primary-grad: linear-gradient(135deg, #5b6dff 0%, #7c4dff 100%);

    --green: #10c97e;
    --green-2: #1de8a0;
    --green-grad: linear-gradient(135deg, #10c97e 0%, #1de8a0 100%);

    --blue: #2ea3f2;
    --blue-2: #3eb6ff;
    --blue-grad: linear-gradient(135deg, #2ea3f2 0%, #3eb6ff 100%);

    --purple: #8a4cff;
    --purple-2: #a86bff;
    --purple-grad: linear-gradient(135deg, #8a4cff 0%, #a86bff 100%);

    --orange: #ff9a3c;
    --orange-2: #ffb766;
    --orange-grad: linear-gradient(135deg, #ff9a3c 0%, #ffb766 100%);

    --shadow-sm: 0 4px 12px rgba(0,0,0,0.25);
    --shadow-md: 0 10px 28px rgba(0,0,0,0.35);
    --shadow-lg: 0 20px 48px rgba(0,0,0,0.45);

    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-pill: 999px;

    --sidebar-w: 260px;
    --topbar-h: 70px;
    --bottom-nav-h: 70px;

    --font: 'Vazirmatn', 'Vazir', 'Tahoma', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ================ ریست ================ */
*, *::before, *::after { box-sizing: border-box; }
html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-1);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
body {
    background: radial-gradient(1200px 600px at 100% -200px, rgba(122, 80, 255, 0.10), transparent 60%),
                radial-gradient(1000px 500px at 0% 80%, rgba(46, 163, 242, 0.08), transparent 60%),
                var(--bg-1);
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; margin: 0; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }
svg { width: 18px; height: 18px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ================ صفحه ورود ================ */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    padding: 20px;
}
.login-bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
}
.blob-1 { width: 480px; height: 480px; background: rgba(122, 80, 255, 0.35); top: -200px; right: -120px; }
.blob-2 { width: 380px; height: 380px; background: rgba(46, 163, 242, 0.30); bottom: -120px; left: -100px; }
.blob-3 { width: 320px; height: 320px; background: rgba(16, 201, 126, 0.18); top: 40%; left: 40%; }
.login-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
}
.login-card {
    background: rgba(24, 34, 65, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    box-shadow: var(--shadow-lg);
}
.login-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 22px;
    background: var(--primary-grad);
    display: grid;
    place-items: center;
    color: #fff;
    box-shadow: 0 12px 30px rgba(122, 80, 255, 0.45);
}
.login-logo svg { width: 32px; height: 32px; }
.login-title {
    text-align: center;
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
}
.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin: 0 0 28px;
    font-size: 13px;
}
.login-form .form-group { margin-bottom: 16px; }
.login-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 13px;
}
.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(11, 18, 33, 0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color .2s, background .2s;
}
.input-wrap:focus-within {
    border-color: var(--primary);
    background: rgba(11, 18, 33, 0.85);
}
.input-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.input-icon svg { width: 18px; height: 18px; }
.input-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    padding: 12px 4px;
    font-size: 14px;
    width: 100%;
}
.input-wrap input::placeholder { color: var(--text-soft); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px; transition: transform .15s, box-shadow .15s, opacity .15s; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-block { width: 100%; }
.btn-gradient { background: var(--primary-grad); color: #fff; box-shadow: 0 10px 24px rgba(91, 109, 255, 0.35); }
.btn-gradient:hover { box-shadow: 0 14px 32px rgba(91, 109, 255, 0.5); }
.btn-success { background: var(--green-grad); color: #fff; box-shadow: 0 8px 20px rgba(16, 201, 126, 0.35); }
.btn-info    { background: var(--blue-grad);   color: #fff; box-shadow: 0 8px 20px rgba(46, 163, 242, 0.35); }
.btn-purple  { background: var(--purple-grad); color: #fff; box-shadow: 0 8px 20px rgba(138, 76, 255, 0.35); }
.btn-orange  { background: var(--orange-grad); color: #fff; box-shadow: 0 8px 20px rgba(255, 154, 60, 0.35); }
.btn-ghost   { background: rgba(255,255,255,0.05); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,0.08); }
.btn-danger  { background: linear-gradient(135deg, #ff5e7a, #ff3d63); color: #fff; }
.btn-sm { padding: 8px 12px; font-size: 12px; border-radius: 10px; }
.btn-lg { padding: 14px 22px; font-size: 15px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; }

.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid transparent;
}
.alert-error   { background: rgba(255, 70, 100, 0.10); color: #ff7d97; border-color: rgba(255, 70, 100, 0.25); }
.alert-success { background: rgba(16, 201, 126, 0.10); color: #2ee0a3; border-color: rgba(16, 201, 126, 0.25); }
.alert-info    { background: rgba(46, 163, 242, 0.10); color: #5fc0ff; border-color: rgba(46, 163, 242, 0.25); }
.alert-warning { background: rgba(255, 154, 60, 0.10); color: #ffb55a; border-color: rgba(255, 154, 60, 0.25); }

.login-footer { text-align: center; margin-top: 18px; color: var(--text-soft); font-size: 11px; }

/* ================ شِل اصلی برنامه ================ */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ================ Topbar دسکتاپ ================ */
.d-topbar {
    display: flex;
    align-items: center;
    height: var(--topbar-h);
    padding: 0 24px;
    gap: 16px;
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 50;
}
.d-toggle-sidebar {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(74, 92, 255, 0.35);
}
.d-toggle-sidebar svg { width: 22px; height: 22px; }
.d-page-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}
.d-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.lang-switch {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    cursor: pointer;
}
.d-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: color .2s, background .2s;
}
.d-icon-btn:hover { color: var(--text); background: var(--surface-2); }
.d-icon-dot {
    position: absolute;
    top: 8px; right: 8px;
    width: 8px; height: 8px;
    background: #5b6dff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--bg-1);
}
.d-admin {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px 6px 6px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
}
[dir="rtl"] .d-admin { padding: 6px 6px 6px 12px; }
.d-admin-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}
[dir="ltr"] .d-admin-info { align-items: flex-start; }
.d-admin-name { font-size: 13px; font-weight: 600; }
.d-admin-logout { font-size: 11px; color: var(--text-soft); }
.d-admin-logout:hover { color: #ff7d97; }
.d-admin-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--surface-3);
    display: grid; place-items: center;
    color: var(--text-muted);
}

/* ================ Sidebar دسکتاپ ================ */
.d-sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    width: var(--sidebar-w);
    z-index: 40;
    overflow-y: auto;
    transition: transform .25s ease;
}
[dir="rtl"] .d-sidebar { right: 0; }
[dir="ltr"] .d-sidebar { left: 0; }

.d-sidebar.collapsed { transform: translateX(0); }
[dir="rtl"] .d-sidebar.collapsed { transform: translateX(100%); }
[dir="ltr"] .d-sidebar.collapsed { transform: translateX(-100%); }

.d-sidebar-inner {
    padding: 8px 16px 100px;
}
.d-nav-section {
    margin: 22px 8px 10px;
    color: var(--text-soft);
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.d-nav ul {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.d-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 13px;
    transition: background .2s, color .2s;
}
.d-nav a:hover {
    color: var(--text);
    background: rgba(255,255,255,0.04);
}
.d-nav a.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px rgba(74, 92, 255, 0.35);
}
.d-nav .nav-icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}
.d-nav svg { width: 18px; height: 18px; }

/* ================ Main Content ================ */
.app-main {
    flex: 1;
    padding: 12px 24px 40px;
}
[dir="rtl"] .is-desktop .app-main { margin-right: var(--sidebar-w); }
[dir="ltr"] .is-desktop .app-main { margin-left: var(--sidebar-w); }

/* ================ آمار کارت‌ها ================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.stat-card {
    position: relative;
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    color: #fff;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    min-height: 110px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-card.green  { background: var(--green-grad); }
.stat-card.blue   { background: var(--blue-grad); }
.stat-card.purple { background: var(--purple-grad); }
.stat-card.orange { background: var(--orange-grad); }

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: rgba(255,255,255,0.18);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.stat-icon svg { width: 26px; height: 26px; color: #fff; }
.stat-body { flex: 1; min-width: 0; }
.stat-title {
    font-size: 13px;
    opacity: 0.92;
    margin-bottom: 4px;
}
.stat-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 4px;
}
.stat-meta {
    font-size: 11px;
    opacity: 0.85;
}
.stat-spark {
    position: absolute;
    inset: auto 0 0 0;
    height: 32px;
    pointer-events: none;
    opacity: 0.55;
}
.stat-spark svg { width: 100%; height: 100%; }

/* ================ کارت معمولی ================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}
.card-glass {
    background: rgba(24, 34, 65, 0.6);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-soft);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.card-title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}
.card-actions { display: flex; gap: 8px; align-items: center; }

/* ================ فرم جستجو ================ */
.search-form {
    display: grid;
    grid-template-columns: 1fr 1fr 120px;
    gap: 12px;
    align-items: end;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--text-muted); }
.field input,
.field select,
.field textarea {
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 13px;
    outline: none;
    width: 100%;
    transition: border-color .15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 100px; line-height: 1.7; }
.field select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2395a3c2' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: 18px;
    background-position: left 14px center;
    padding-left: 44px;
}
[dir="rtl"] .field select { background-position: left 14px center; padding-right: 14px; padding-left: 44px; }

/* ================ Layout دو ستونی داشبورد ================ */
.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 16px;
    align-items: start;
}
[dir="ltr"] .dashboard-row { grid-template-columns: 1fr 380px; }
.dashboard-side .card { margin-bottom: 16px; }

/* ================ کارت توییت ================ */
.tweet-card {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 18px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 14px;
    cursor: pointer;
    transition: border-color .15s, transform .15s, background .25s;
}
.tweet-card:hover { border-color: var(--primary); }
.tweet-card.is-new {
    border-color: rgba(34, 197, 94, 0.45);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.06) 0%, var(--surface) 100%);
    box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.18) inset, 0 6px 24px rgba(16, 185, 129, 0.08);
}
.tweet-card .new-badge {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    background: linear-gradient(135deg, #10b981, #22c55e);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    z-index: 3;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    letter-spacing: 0.3px;
}

/* Sent state — توییت‌هایی که به تلگرام ارسال شده‌اند */
.tweet-card.is-sent {
    border-color: rgba(139, 92, 246, 0.45);
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.06) 0%, var(--surface) 100%);
    box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.18) inset, 0 6px 24px rgba(139, 92, 246, 0.08);
    opacity: 0.92;
}
.tweet-card.is-sent .tweet-text { color: var(--text-soft); }
.tweet-card .sent-badge {
    position: absolute;
    top: 10px;
    inset-inline-end: 10px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    z-index: 3;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    letter-spacing: 0.3px;
}
.tweet-card .sent-badge svg { width: 14px; height: 14px; }

/* button spinner */
.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
    margin-inline-end: 6px;
    vertical-align: -3px;
}
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}
.btn.is-loading { opacity: 0.85; cursor: progress; }
.tweet-card .tweet-media {
    flex: 0 0 280px;
    align-self: stretch;
}
.tweet-card .tweet-body { flex: 1 1 auto; }
.tweet-media {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    gap: 6px;
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-2);
    min-height: 200px;
}
@media (max-width: 720px) {
    .tweet-card { flex-direction: column; }
    .tweet-card .tweet-media { flex: 0 0 auto; width: 100%; max-height: 280px; }
}
.tweet-media.has-2 { grid-template-columns: 1fr 1fr; }
.tweet-media.has-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.tweet-media.has-3 .m-item:first-child { grid-row: 1 / 3; }
.tweet-media.has-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.tweet-media .m-item {
    position: relative;
    overflow: hidden;
    background: #0a0e18;
}
.tweet-media .m-item img {
    width: 100%; height: 100%;
    object-fit: cover;
    min-height: 100px;
}
.tweet-media .m-more {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.55);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 800;
}
.tweet-body { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tweet-head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.tweet-author { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tweet-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--surface-2);
    overflow: hidden;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.tweet-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tweet-author-info .a-name { font-weight: 700; font-size: 14px; }
.tweet-author-info .a-user { color: var(--blue-2); font-size: 12px; }
.tweet-time { color: var(--text-soft); font-size: 12px; }
.tweet-text {
    color: var(--text);
    font-size: 14px;
    line-height: 1.85;
    word-break: break-word;
}
.tweet-text .hashtag { color: var(--blue-2); }
.tweet-stats {
    display: flex;
    align-items: center;
    gap: 22px;
    color: var(--text-muted);
    font-size: 12px;
}
.tweet-stat { display: inline-flex; align-items: center; gap: 6px; }
.tweet-stat svg { width: 16px; height: 16px; }
.tweet-stat.like svg     { color: #ff5e7a; }
.tweet-stat.retweet svg  { color: #1de8a0; }
.tweet-stat.reply svg    { color: var(--blue-2); }
.tweet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}
.tweet-actions .btn { flex: 1; min-width: 120px; }

/* ================ Quick grid (هشتگ‌ها + پیج‌ها بالای جستجو) ================ */
.quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 18px;
}
@media (max-width: 900px) {
    .quick-grid { grid-template-columns: 1fr; }
}
.quick-card { margin-bottom: 0; }
.hashtag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.hashtag-chip {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: var(--blue-2);
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all .15s;
}
.hashtag-chip:hover {
    background: rgba(99, 102, 241, 0.25);
    transform: translateY(-1px);
}
.page-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
@media (max-width: 480px) {
    .page-grid { grid-template-columns: 1fr; }
}

/* Chip pager (prev/next within section) */
.chip-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 12px;
}
.chip-pager-btn {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: var(--text);
    display: grid; place-items: center;
    cursor: pointer;
    transition: all .15s;
}
.chip-pager-btn:hover:not(:disabled) { background: rgba(99,102,241,0.18); border-color: var(--primary); }
.chip-pager-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.chip-pager-btn svg { width: 16px; height: 16px; }
.chip-pager-info { font-size: 13px; color: var(--text-muted); font-weight: 600; min-width: 44px; text-align: center; }

/* List pager (آخرین توییت‌ها — قبلی/بعدی) */
.list-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.list-pager .btn { display: inline-flex; align-items: center; gap: 6px; }
.list-pager .btn svg { width: 16px; height: 16px; }
.list-pager-info { font-size: 14px; font-weight: 700; color: var(--text-muted); min-width: 50px; text-align: center; }

/* hint زیر فیلدهای فرم */
.field-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--text-muted); line-height: 1.6; }

/* ===== مدیریت کانال‌های تلگرام ===== */
.tg-section-title { margin: 0 0 4px; font-size: 15px; font-weight: 700; color: var(--text); }
.tg-channels-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.tg-channel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
}
.tg-channel-row.is-off { opacity: 0.55; }
.tg-ch-title { font-weight: 700; font-size: 14px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.tg-ch-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.tg-ch-meta code { background: var(--bg-2); padding: 1px 6px; border-radius: 6px; font-size: 11px; }
.tg-ch-actions { display: flex; gap: 6px; flex-shrink: 0; }
.tg-add-form {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 14px;
    margin-top: 8px;
}

/* کلیک روی آیکون داخل دکمه‌ها همیشه به خود دکمه برسد (فیکس Firefox/SVG) */
.table-action-btn svg,
.btn svg,
.chip-pager-btn svg,
.tg-ch-actions svg { pointer-events: none; }

/* نشان کانال منبع روی کارت خبر */
.tg-src-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(46, 163, 242, 0.12);
    color: #5fc0ff;
    border: 1px solid rgba(46, 163, 242, 0.3);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
}
.tg-src-badge svg { width: 14px; height: 14px; }
.page-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    text-align: start;
    transition: all .15s;
}
.page-chip:hover { border-color: var(--primary); background: rgba(255,255,255,0.06); }
.page-chip .page-avatar { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; flex-shrink: 0; display: grid; place-items: center; background: var(--surface-2); }
.page-chip .page-avatar img { width: 100%; height: 100%; object-fit: cover; }
.page-chip .page-info { display: flex; flex-direction: column; min-width: 0; }
.page-chip .page-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-chip .page-username { font-size: 11px; color: var(--blue-2); }

/* ================ لیست هشتگ‌ها / پیج‌ها ================ */
.list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    transition: background .15s;
}
.list-item:hover { background: rgba(255,255,255,0.03); }
.list-item .li-text { color: var(--blue-2); font-weight: 600; flex: 1; }
.list-item .li-actions { display: flex; gap: 6px; opacity: 0.6; }
.list-item:hover .li-actions { opacity: 1; }

.page-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
}
.page-row:hover { background: rgba(255,255,255,0.03); }
.page-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    overflow: hidden;
    flex-shrink: 0;
}
.page-avatar img { width: 100%; height: 100%; object-fit: cover; }
.page-info { flex: 1; min-width: 0; }
.page-name { font-size: 13px; font-weight: 600; }
.page-username { font-size: 11px; color: var(--blue-2); }

.btn-view-all {
    width: 100%;
    background: transparent;
    border: 1px dashed var(--primary);
    color: var(--primary-2);
    padding: 9px;
    border-radius: 12px;
    margin-top: 10px;
    font-size: 12px;
    font-weight: 600;
}

/* ================ جداول ================ */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th, .table td {
    padding: 12px 14px;
    text-align: start;
    border-bottom: 1px solid var(--border);
}
.table th { color: var(--text-muted); font-weight: 600; font-size: 12px; }
.table tbody tr:hover { background: rgba(255,255,255,0.02); }
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 600;
}
.badge-green  { background: rgba(16, 201, 126, 0.14); color: #2ee0a3; }
.badge-red    { background: rgba(255, 70, 100, 0.12);  color: #ff7d97; }
.badge-blue   { background: rgba(46, 163, 242, 0.14); color: #5fc0ff; }
.badge-yellow { background: rgba(255, 200, 60, 0.12);  color: #ffd06b; }
.badge-purple { background: rgba(139, 92, 246, 0.16); color: #b78cff; }
.badge-orange { background: rgba(255, 154, 60, 0.14); color: #ffb55a; }
.badge-gray   { background: rgba(148, 163, 184, 0.14); color: #94a3b8; }

.table-action-btn {
    width: 32px; height: 32px;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    margin: 0 2px;
}
.table-action-btn.edit:hover { background: rgba(46, 163, 242, 0.18); color: #5fc0ff; }
.table-action-btn.delete:hover { background: rgba(255, 70, 100, 0.18); color: #ff7d97; }
.table-action-btn.toggle:hover { background: rgba(16, 201, 126, 0.18); color: #2ee0a3; }

/* ================ Modal ================ */
.modal {
    position: fixed; inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(5, 8, 18, 0.65);
    backdrop-filter: blur(6px);
}
.modal-dialog {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-close {
    width: 32px; height: 32px;
    border-radius: 10px;
    display: grid; place-items: center;
    background: rgba(255,255,255,0.06);
    color: var(--text);
    font-size: 22px;
    line-height: 1;
}
.modal-close:hover { background: rgba(255, 70, 100, 0.18); color: #ff7d97; }
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}
.loading { text-align: center; color: var(--text-muted); padding: 40px 0; }

/* ================ Toast ================ */
.toast-container {
    position: fixed;
    top: 80px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    pointer-events: none;
}
[dir="rtl"] .toast-container { right: 0; }
[dir="ltr"] .toast-container { left: 0; }
.toast {
    pointer-events: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 16px;
    color: var(--text);
    box-shadow: var(--shadow-md);
    display: flex; align-items: center; gap: 10px;
    min-width: 280px;
    font-size: 13px;
    animation: toast-in .25s ease;
}
.toast.success { border-color: rgba(16, 201, 126, 0.4); }
.toast.error   { border-color: rgba(255, 70, 100, 0.4); }
.toast.info    { border-color: rgba(46, 163, 242, 0.4); }
@keyframes toast-in {
    from { transform: translateY(-12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

/* ================ موبایل: هدر، آمار، ناوبری ================ */
.m-header,
.m-bottom-nav,
.m-drawer,
.m-drawer-backdrop { display: none; }

/* ================ Responsive ================ */
.footer-credit {
    text-align: center;
    padding: 22px 12px;
    color: var(--text-soft);
    font-size: 12px;
    margin-top: 24px;
    border-top: 1px solid var(--border-soft);
}

/* ================ Forms / Settings ================ */
.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
}
.tabs button {
    padding: 9px 16px;
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid var(--border);
    font-size: 12px;
    white-space: nowrap;
    font-weight: 600;
}
.tabs button.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 18px;
}
.form-grid .full { grid-column: 1 / -1; }

/* ================ Empty State ================ */
.empty-state {
    text-align: center;
    padding: 50px 16px;
    color: var(--text-muted);
}
.empty-state svg { width: 56px; height: 56px; opacity: 0.4; margin-bottom: 12px; }

.flex-row { display: flex; gap: 10px; align-items: center; }
.flex-grow { flex: 1; }
.muted { color: var(--text-muted); font-size: 12px; }

/* ================ Switch (toggle) ================ */
.switch {
    position: relative;
    display: inline-block;
    width: 42px; height: 22px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; inset: 0;
    background: var(--border);
    border-radius: 22px;
    cursor: pointer;
    transition: background .2s;
}
.switch .slider::before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(20px); }
[dir="rtl"] .switch input:checked + .slider::before { transform: translateX(-20px); }

/* ================ Tweet Detail Modal — New Design ================ */
.modal-tweet .modal-dialog {
    background: linear-gradient(180deg, #131830 0%, #0c0f1f 100%);
    border: 1px solid rgba(139, 92, 246, 0.18);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(99, 102, 241, 0.08);
    max-width: 760px;
}
.modal-tweet .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.modal-tweet .modal-header .modal-close {
    width: 38px; height: 38px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: #fff;
    display: grid; place-items: center;
    cursor: pointer;
    transition: all .15s;
}
.modal-tweet .modal-header .modal-close:hover { background: rgba(255,255,255,0.1); }
.modal-tweet .modal-header .modal-close svg { width: 18px; height: 18px; }
.modal-header-title {
    display: flex;
    align-items: center;
    gap: 12px;
}
.modal-header-title h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}
.modal-brand-icon {
    width: 42px; height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    display: grid; place-items: center;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}
.modal-brand-icon svg { width: 20px; height: 20px; }

.modal-tweet .modal-body {
    padding: 22px;
    overflow-y: auto;
}

/* Author meta */
.tweet-modal-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    flex-direction: row-reverse;
    justify-content: flex-start;
}
.tweet-avatar-ring {
    width: 64px; height: 64px;
    border-radius: 50%;
    padding: 2.5px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 50%, #3b82f6 100%);
    flex-shrink: 0;
}
.tweet-avatar-ring .tweet-avatar {
    width: 100%; height: 100%;
    background: #0c0f1f;
    border-radius: 50%;
}
.tweet-avatar-ring .tweet-avatar img { width: 100%; height: 100%; object-fit: cover; }
.tweet-modal-author { display: flex; flex-direction: column; gap: 3px; text-align: end; }
.tweet-modal-author .a-name { font-size: 18px; font-weight: 700; color: #fff; }
.tweet-modal-author .a-user { font-size: 14px; color: #a78bfa; }
.tweet-modal-author .a-time {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}
.tweet-modal-author .a-time svg { width: 13px; height: 13px; }

/* Bullets (tweet text) */
.tweet-bullets {
    background: rgba(15, 18, 30, 0.55);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 16px;
    padding: 20px 22px;
    margin-bottom: 18px;
    position: relative;
}
.tweet-bullet {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 12px 0;
    position: relative;
}
.tweet-bullet + .tweet-bullet { border-top: 1px dashed rgba(139, 92, 246, 0.22); }
.tb-marker {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: rgba(139, 92, 246, 0.18);
    color: #a78bfa;
    display: grid; place-items: center;
    flex-shrink: 0;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.06);
}
.tb-marker svg { width: 16px; height: 16px; }
.tb-text {
    flex: 1;
    color: #e2e8f0;
    font-size: 14px;
    line-height: 2;
    word-break: break-word;
}
.tb-text .hashtag { color: #a78bfa; font-weight: 600; }

.tweet-modal-media {
    display: grid;
    gap: 6px;
    margin-bottom: 18px;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}
.tweet-modal-media img { border-radius: 12px; aspect-ratio: 16/10; object-fit: cover; width: 100%; }

/* AI block */
.ai-block { margin-top: 8px; }
.ai-block-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    margin-bottom: 12px;
    flex-direction: row-reverse;
    justify-content: flex-end;
}
.ai-sparkle {
    width: 24px; height: 24px;
    color: #a78bfa;
    display: grid; place-items: center;
}
.ai-sparkle svg { width: 22px; height: 22px; filter: drop-shadow(0 0 6px rgba(167, 139, 250, 0.55)); }

.ai-textarea-wrap { position: relative; }
.ai-textarea-wrap textarea {
    width: 100%;
    background: rgba(15, 18, 30, 0.55);
    border: 1.5px solid rgba(139, 92, 246, 0.45);
    border-radius: 14px;
    color: #e2e8f0;
    padding: 16px 18px 38px;
    font-size: 14px;
    line-height: 1.85;
    font-family: inherit;
    resize: vertical;
    min-height: 140px;
    transition: border-color .15s, box-shadow .15s;
}
.ai-textarea-wrap textarea:focus {
    outline: none;
    border-color: #a78bfa;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}
.ai-textarea-wrap textarea::placeholder { color: var(--text-muted); }
.char-counter {
    position: absolute;
    bottom: 10px;
    inset-inline-end: 16px;
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}

/* Action buttons */
.ai-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-top: 16px;
}
@media (max-width: 600px) {
    .ai-actions { grid-template-columns: 1fr; }
}
.ai-actions .btn {
    height: 52px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    cursor: pointer;
    transition: transform .15s, filter .15s, box-shadow .15s;
}
.ai-actions .btn svg { width: 18px; height: 18px; }
.ai-actions .btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
.ai-actions .btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-gradient-purple {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}
.btn-gradient-blue {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    color: #fff;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35);
}
.ai-actions .btn-success {
    background: linear-gradient(135deg, #10b981, #22c55e);
    color: #fff;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}
