/* ═══════════════════════════════════════════════════════════════════
   Soren CMS — Admin Panel Styles
   استخراج‌شده از adminpanel.html
   ═══════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --primary: #17324D; --primary-dark: #10263A; --primary-soft: #EAF1F6;
  --accent: #D6A84F; --accent-soft: #F8F1DF;
  --bg: #F6F8FA; --surface: #FFFFFF; --border: #E6E9EE;
  --text: #1F2937; --muted: #667085;
  --success: #16A34A; --info: #2563EB; --warning: #B7791F; --danger: #DC2626;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(16,38,58,0.04);
  --shadow: 0 4px 12px rgba(16,38,58,0.06);
  --sidebar-w: 260px; --sidebar-collapsed-w: 75px; --header-h: 68px;
  --font: 'Vazirmatn', system-ui, sans-serif;
}

.dark-mode {
  --primary: #2A4A6B; --primary-dark: #0F1B28; --primary-soft: #1E2A38;
  --accent: #E5B965; --accent-soft: #2A2418;
  --bg: #0B1220; --surface: #121B2B; --border: #1F2A3C;
  --text: #E6EAF0; --muted: #8A95A8;
}

/* ── Reset & Base ── */
* { box-sizing: border-box; }
body { font-family: var(--font); background: var(--bg); color: var(--text); margin: 0; font-size: 14px; line-height: 1.6; overflow: hidden; height: 100vh; }
a { color: var(--primary); text-decoration: none; }

/* ── Login ── */
.login-page { min-height: 100vh; display: flex; background: var(--surface); }
.login-brand { flex: 1; background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px; position: relative; overflow: hidden; }
.login-brand::before { content: ""; position: absolute; top: -50%; right: -50%; width: 200%; height: 200%; background: radial-gradient(circle, rgba(214,168,79,0.1) 0%, transparent 60%); }
.login-brand-content { position: relative; z-index: 2; text-align: center; max-width: 480px; }
.login-brand-logo { width: 100px; height: 100px; border-radius: 24px; background: linear-gradient(135deg, var(--accent), #b8893d); color: var(--primary-dark); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 48px; margin: 0 auto 24px; box-shadow: 0 20px 40px rgba(214,168,79,0.3); }
.login-brand-title { font-size: 32px; font-weight: 700; margin-bottom: 8px; }
.login-brand-subtitle { font-size: 16px; opacity: 0.8; margin-bottom: 40px; }
.login-features { text-align: right; width: 100%; }
.login-feature { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-top: 1px solid rgba(255,255,255,0.1); }
.login-feature:first-child { border-top: none; }
.login-feature-icon { width: 40px; height: 40px; border-radius: 10px; background: rgba(214,168,79,0.15); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.login-feature-text { font-size: 14px; opacity: 0.9; }
.login-form-side { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.login-form-box { width: 100%; max-width: 420px; }
.login-form-header { margin-bottom: 32px; }
.login-form-header h1 { font-size: 26px; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.login-form-header p { color: var(--muted); margin: 0; font-size: 14px; }
.login-field { margin-bottom: 18px; }
.login-field label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.login-input-wrapper { position: relative; }
.login-input-wrapper i.field-icon { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.login-input-wrapper input { width: 100%; height: 48px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 0 44px 0 14px; font-family: var(--font); font-size: 14px; color: var(--text); transition: all .2s; }
.login-input-wrapper input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23,50,77,0.08); }
.login-input-wrapper .toggle-pass { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 4px; }
.login-input-wrapper .toggle-pass:hover { color: var(--primary); }
.login-options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; font-size: 13px; }
.login-options label { display: flex; align-items: center; gap: 6px; color: var(--text); cursor: pointer; }
.login-forgot-link { background: none; border: none; padding: 0; color: var(--primary); font-size: 13px; font-family: var(--font); cursor: pointer; text-decoration: none; transition: color .2s; }
.login-forgot-link:hover { color: var(--primary-dark); text-decoration: underline; }
.login-back-link { background: none; border: none; padding: 0; color: var(--muted); font-size: 13px; font-family: var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: color .2s; margin-bottom: 20px; }
.login-back-link:hover { color: var(--primary); }
.login-btn { width: 100%; height: 48px; background: var(--primary); color: #fff; border: none; border-radius: 10px; font-family: var(--font); font-size: 15px; font-weight: 600; cursor: pointer; transition: all .2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.login-btn:hover { background: var(--primary-dark); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.login-alert { padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.login-alert.error { background: rgba(220,38,38,0.08); color: var(--danger); border: 1px solid rgba(220,38,38,0.2); }
.login-alert.success { background: rgba(22,163,74,0.08); color: var(--success, #16a34a); border: 1px solid rgba(22,163,74,0.2); }
.login-spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-google-btn { width: 100%; height: 48px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s; display: flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; }
.login-google-btn:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.login-google-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.login-google-btn:disabled { opacity: 0.6; cursor: not-allowed; pointer-events: none; }
@media (max-width: 992px) { .login-brand { display: none; } .login-form-side { padding: 24px; } }

/* ── App Loading ── */
.app-loading { position: fixed; inset: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; z-index: 9999; flex-direction: column; gap: 16px; }
.app-loading-spinner { width: 48px; height: 48px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* ── Animations ── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Header ── */
.app-header { position: fixed; top: 0; right: 0; left: 0; height: var(--header-h); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; z-index: 1000; gap: 16px; }
.header-right, .header-left { display: flex; align-items: center; gap: 10px; }
.header-center { flex: 1; max-width: 520px; }
.btn-icon { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all .2s; position: relative; }
.btn-icon:hover { background: var(--primary-soft); color: var(--primary); }
.badge-dot { position: absolute; top: -4px; left: -4px; background: var(--danger); color: #fff; font-size: 10px; min-width: 18px; height: 18px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.global-search { position: relative; width: 100%; }
.global-search i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.global-search input { width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); padding: 0 42px 0 14px; font-family: var(--font); color: var(--text); font-size: 13.5px; }
.global-search input:focus { outline: none; border-color: var(--primary); background: var(--surface); }
.user-btn { display: flex; align-items: center; gap: 10px; background: transparent; border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px 6px 6px; cursor: pointer; color: var(--text); }
.user-btn:hover { background: var(--primary-soft); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.user-info { text-align: right; line-height: 1.2; }
.user-name { font-weight: 600; font-size: 13px; }
.user-status { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.status-dot.online { background: var(--success); }
.breadcrumb-nav .breadcrumb { font-size: 13px; margin-bottom: 0; }
.breadcrumb-nav .breadcrumb-item a { color: var(--muted); }
.breadcrumb-nav .breadcrumb-item + .breadcrumb-item::before { content: "›"; color: var(--muted); }

/* ── Layout ── */
.app-layout { display: flex; padding-top: var(--header-h); height: 100vh; overflow: hidden; }
.app-sidebar { width: var(--sidebar-w); background: var(--surface); border-left: 1px solid var(--border); position: fixed; top: var(--header-h); right: 0; bottom: 0; display: flex; flex-direction: column; transition: width .25s ease; overflow: hidden; z-index: 900; }
.sidebar-collapsed .app-sidebar { width: var(--sidebar-collapsed-w); }
.sidebar-collapsed .brand-text,
.sidebar-collapsed .nav-title,
.sidebar-collapsed .nav-item span,
.sidebar-collapsed .nav-badge,
.sidebar-collapsed .sidebar-search-wrap { display: none; }
.sidebar-collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar-collapsed .nav-section-toggle-icon { display: none; }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 18px; border-bottom: 1px solid var(--border); }
.brand-logo { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: var(--accent); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; flex-shrink: 0; }
.brand-title { font-weight: 700; font-size: 15px; color: var(--text); }
.brand-subtitle { font-size: 11px; color: var(--muted); }

/* ── Sidebar Search ── */
.sidebar-search-wrap { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.sidebar-search-inner { position: relative; }
.sidebar-search-inner i { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; pointer-events: none; }
.sidebar-search-inner input { width: 100%; height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); padding: 0 30px 0 10px; font-family: var(--font); font-size: 12.5px; color: var(--text); }
.sidebar-search-inner input:focus { outline: none; border-color: var(--primary); background: var(--surface); }
.sidebar-expand-btns { margin-top: 6px; display: flex; }
.sidebar-expand-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; padding: 5px 8px; font-family: var(--font); font-size: 11.5px; color: var(--muted); cursor: pointer; transition: all .15s; }
.sidebar-expand-btn:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.sidebar-expand-btn i { font-size: 10px; }

/* ── Sidebar Nav ── */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 8px; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.nav-section { margin-bottom: 4px; }
.nav-title { font-size: 11px; font-weight: 600; color: var(--muted); padding: 8px 12px 5px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; border-radius: 8px; user-select: none; transition: background .15s; }
.nav-title:hover { background: var(--primary-soft); color: var(--primary); }
.nav-section-toggle-icon { font-size: 10px; transition: transform .2s; flex-shrink: 0; }
.nav-section.collapsed .nav-section-toggle-icon { transform: rotate(-90deg); }
.nav-section-body { overflow: hidden; transition: max-height .35s ease, opacity .2s ease; max-height: 2000px; opacity: 1; }
.nav-section.collapsed .nav-section-body { max-height: 0; opacity: 0; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--text); font-size: 13.5px; font-weight: 500; margin-bottom: 2px; cursor: pointer; position: relative; }
.nav-item i { width: 18px; text-align: center; color: var(--muted); font-size: 14px; }
.nav-item:hover { background: var(--primary-soft); color: var(--primary); }
.nav-item.active { background: linear-gradient(90deg, var(--primary-soft), transparent); color: var(--primary); font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; right: 0; top: 6px; bottom: 6px; width: 3px; background: var(--accent); border-radius: 3px; }
.nav-item.active i { color: var(--accent); }
.nav-item.nav-item-hidden { display: none; }
.nav-badge { margin-right: auto; background: var(--danger); color: #fff; font-size: 10px; padding: 2px 7px; border-radius: 10px; font-weight: 700; }
.app-main { flex: 1; margin-right: var(--sidebar-w); padding: 24px; transition: margin .25s; min-width: 0; overflow-y: auto; height: 100%; }
.sidebar-collapsed .app-main { margin-right: var(--sidebar-collapsed-w); }
.view-container { animation: fadeIn .25s ease; }

/* ── Page Header ── */
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; position: sticky; top: -24px; margin: -24px -24px 22px -24px; padding: 16px 24px; background: var(--bg); border-bottom: 1px solid var(--border); z-index: 100; }
.page-title { font-size: 22px; font-weight: 700; color: var(--text); margin: 0; }
.page-header-divider { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }

/* ── Buttons ── */
.btn { font-family: var(--font); font-weight: 500; border-radius: 10px; padding: 9px 16px; font-size: 13.5px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent; cursor: pointer; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-accent { background: var(--accent); color: var(--primary-dark); }
.btn-outline { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-icon-sm { width: 32px; height: 32px; padding: 0; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 1px solid var(--border); color: var(--muted); cursor: pointer; }
.btn-icon-sm:hover { background: var(--primary-soft); color: var(--primary); }
.btn-icon-sm.text-danger { color: var(--danger); }
.btn-icon-sm.text-danger:hover { background: rgba(220,38,38,0.1); }
.btn-icon-sm.text-success { color: var(--success); }
.btn-icon-sm.text-success:hover { background: rgba(22,163,74,0.1); }
.btn-icon-sm.text-info { color: var(--info); }
.btn-icon-sm.text-info:hover { background: rgba(37,99,235,0.1); }
.btn-icon-sm.text-warning { color: var(--warning); }

/* ── Cards ── */
.card { background: var(--surface);    padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm);    padding: 10px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-title { font-size: 15px; font-weight: 600; margin: 0; color: var(--text); }
.card-body { padding: 20px; }

/* ── Stats ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.stat-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.stat-icon.blue { background: rgba(37,99,235,0.1); color: var(--info); }
.stat-icon.gold { background: var(--accent-soft); color: var(--accent); }
.stat-icon.green { background: rgba(22,163,74,0.1); color: var(--success); }
.stat-icon.red { background: rgba(220,38,38,0.1); color: var(--danger); }

/* ── Table ── */
.table-wrapper { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.app-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.app-table thead th { background: var(--bg); color: var(--muted); font-weight: 600; font-size: 12px; padding: 12px 16px; text-align: right; border-bottom: 1px solid var(--border); }
.app-table tbody td { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.app-table tbody tr:hover { background: var(--primary-soft); }

/* ── Badges ── */
.badge-status { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600; }
.badge-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: rgba(22,163,74,0.1); color: var(--success); }
.badge-warning { background: rgba(183,121,31,0.1); color: var(--warning); }
.badge-danger { background: rgba(220,38,38,0.1); color: var(--danger); }
.badge-muted { background: var(--primary-soft); color: var(--muted); }
.badge-info { background: rgba(37,99,235,0.1); color: var(--info); }
.badge-active { background: rgba(22,163,74,0.1); color: var(--success); }
.badge-inactive { background: rgba(156,163,175,0.15); color: var(--muted); }
.badge-outline { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 12px; }

/* ── Forms ── */
.form-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-control, .form-select { width: 100%; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 10px 14px; font-family: var(--font); font-size: 13.5px; color: var(--text); }
.form-control:focus, .form-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(23,50,77,0.08); }
.form-hint { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ── Editor Layout ── */
.editor-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
@media (max-width: 992px) { .editor-layout { grid-template-columns: 1fr; } }
.ql-toolbar { border-radius: 10px 10px 0 0 !important; border-color: var(--border) !important; }
.ql-container { border-radius: 0 0 10px 10px !important; border-color: var(--border) !important; font-family: var(--font) !important; min-height: 250px; }
#map { height: 300px; border-radius: 10px; border: 1px solid var(--border); z-index: 1; }

/* ── Media ── */
.media-manager { display: flex; gap: 0; min-height: 500px; }
.media-sidebar { width: 220px; flex-shrink: 0; border-left: 1px solid var(--border); padding: 12px 10px; overflow-y: auto; }
.media-sidebar-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; padding: 0 4px; }
.media-main { flex: 1; padding: 16px; overflow-y: auto; min-width: 0; }
.media-storage-bar { padding: 8px 0 0; }
.media-storage-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 4px; }

/* ── Media Toolbar ── */
.media-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.media-toolbar-search { position: relative; flex: 1; min-width: 160px; }
.media-toolbar-search-icon { position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; pointer-events: none; }
.media-view-switcher { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 3px; flex-shrink: 0; }
.media-view-btn { background: none; border: none; cursor: pointer; width: 32px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; transition: background .12s, color .12s; }
.media-view-btn:hover { background: var(--primary-soft); color: var(--primary); }
.media-view-btn.active { background: var(--primary); color: #fff; }

/* ── Shared media names/meta ── */
.media-name { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Shared action buttons (preview / icon hover overlay / detail row) ── */
.media-act-btn { background: none; border: none; cursor: pointer; width: 26px; height: 26px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; transition: background .12s, color .12s; }
.media-act-btn.media-act-preview { color: #2563eb; }
.media-act-btn.media-act-preview:hover { background: rgba(37,99,235,.12); }
.media-act-btn.media-act-rename  { color: #059669; }
.media-act-btn.media-act-rename:hover  { background: rgba(5,150,105,.12); }
.media-act-btn.media-act-move    { color: var(--primary); }
.media-act-btn.media-act-move:hover    { background: var(--primary-soft); }
.media-act-btn.media-act-delete  { color: #dc2626; }
.media-act-btn.media-act-delete:hover  { background: rgba(220,38,38,.1); }

/* ─────────────────────────────────────────
   Icon mode  (small card grid — original)
───────────────────────────────────────── */
.media-grid-icon { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.media-grid-icon .media-item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; position: relative; cursor: pointer; transition: box-shadow .15s; }
.media-grid-icon .media-item:hover { box-shadow: var(--shadow); }
.media-grid-icon .media-item.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(23,50,77,.18); }
.media-thumb { aspect-ratio: 1/1; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; font-size: 36px; color: var(--primary); overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-info { padding: 10px 12px; }
/* Icon-mode overlay buttons */
.media-delete { position: absolute; top: 8px; left: 8px; background: rgba(220,38,38,0.9); color: #fff; border: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 5; }
.media-move-btn { position: absolute; top: 8px; left: 42px; background: rgba(23,50,77,0.85); color: #fff; border: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 5; font-size: 12px; opacity: 0; transition: opacity .15s; }
.media-grid-icon .media-item:hover .media-move-btn { opacity: 1; }
.media-rename-btn { position: absolute; top: 8px; left: 76px; background: rgba(5,150,105,0.88); color: #fff; border: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 5; font-size: 12px; opacity: 0; transition: opacity .15s; }
.media-grid-icon .media-item:hover .media-rename-btn { opacity: 1; }
.media-preview-btn { position: absolute; top: 8px; left: 110px; background: rgba(37,99,235,0.88); color: #fff; border: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 5; font-size: 12px; opacity: 0; transition: opacity .15s; }
.media-grid-icon .media-item:hover .media-preview-btn { opacity: 1; }
.media-info-btn { position: absolute; bottom: 8px; left: 8px; background: rgba(124,58,237,0.88); color: #fff; border: none; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 5; font-size: 11px; opacity: 0; transition: opacity .15s; }
.media-grid-icon .media-item:hover .media-info-btn { opacity: 1; }

/* ─────────────────────────────────────────
   Preview mode  (large cards with footer)
───────────────────────────────────────── */
.media-grid-preview { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.media-item-preview { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; cursor: pointer; transition: box-shadow .15s, border-color .15s; display: flex; flex-direction: column; }
.media-item-preview:hover { box-shadow: var(--shadow); }
.media-item-preview.selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(23,50,77,.18); }
.media-item-preview-thumb { aspect-ratio: 4/3; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; font-size: 48px; color: var(--primary); overflow: hidden; flex-shrink: 0; }
.media-item-preview-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-item-preview-footer { display: flex; align-items: center; gap: 4px; padding: 8px 10px 4px; min-width: 0; }
.media-item-preview-footer .media-name { font-size: 12.5px; }
.media-item-actions { display: flex; gap: 2px; flex-shrink: 0; opacity: 0; transition: opacity .15s; }
.media-item-preview:hover .media-item-actions { opacity: 1; }
.media-item-preview-meta { font-size: 11px; color: var(--muted); padding: 0 10px 8px; }

/* ─────────────────────────────────────────
   Detail mode  (table-like list rows)
───────────────────────────────────────── */
.media-detail-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.media-detail-header { display: grid; grid-template-columns: 44px 1fr 80px 70px 120px; align-items: center; padding: 8px 14px; background: var(--bg); border-bottom: 1px solid var(--border); font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; gap: 12px; }
.media-detail-row { display: grid; grid-template-columns: 44px 1fr 80px 70px 120px; align-items: center; padding: 8px 14px; gap: 12px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; }
.media-detail-row:last-child { border-bottom: none; }
.media-detail-row:hover { background: var(--primary-soft); }
.media-detail-row.selected { background: rgba(23,50,77,.07); border-color: var(--primary); }
.mdc-thumb { width: 44px; height: 36px; border-radius: 7px; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--primary); overflow: hidden; flex-shrink: 0; }
.mdc-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 7px; }
.mdc-name { min-width: 0; }
.mdc-type { font-size: 12px; }
.mdc-size { font-size: 12px; color: var(--muted); white-space: nowrap; }
.mdc-actions { display: flex; gap: 2px; justify-content: flex-end; opacity: 0; transition: opacity .15s; }
.media-detail-row:hover .mdc-actions { opacity: 1; }

/* ── Folder ── */
.folder-node { list-style: none; padding: 0; margin: 0; }
.folder-node li { margin: 0; }
.folder-btn { display: flex; align-items: center; gap: 7px; width: 100%; background: none; border: none; border-radius: 8px; padding: 7px 8px; font-size: 13px; cursor: pointer; color: var(--text); text-align: right; transition: background .12s; }
.folder-btn:hover { background: var(--primary-soft); }
.folder-btn.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.folder-btn .badge-count { margin-right: auto; background: var(--border); color: var(--muted); font-size: 10px; padding: 1px 6px; border-radius: 20px; flex-shrink: 0; }
.folder-children { padding-right: 14px; border-right: 1px dashed var(--border); margin: 0; }
.folder-actions { transition: opacity .12s; }
.folder-btn:hover .folder-actions { opacity: 1; }
.folder-action-btn { background: none; border: none; cursor: pointer; color: var(--muted); padding: 2px 4px; border-radius: 4px; font-size: 11px; }
.folder-action-btn:hover { color: var(--primary); background: var(--primary-soft); }

/* ── Active folder actions bar (top of sidebar) ── */
.media-folder-actions-bar { background: var(--primary-soft); border: 1px solid rgba(23,50,77,.12); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 7px; }
.media-folder-actions-bar-name { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--primary); min-width: 0; }
.media-folder-actions-bar-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-folder-actions-bar-btns { display: flex; gap: 6px; }
.new-folder-form { display: flex; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.new-folder-form input { flex: 1; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); padding: 5px 9px; font-family: var(--font); font-size: 12.5px; color: var(--text); min-width: 0; }
.new-folder-form input:focus { outline: none; border-color: var(--primary); }

/* ── Media Picker ── */
.picker-dialog { display: flex; height: 520px; overflow: hidden; }
.picker-sidebar { width: 200px; flex-shrink: 0; border-left: 1px solid var(--border); overflow-y: auto; padding: 8px; }
.picker-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.picker-toolbar { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.picker-grid-wrap { flex: 1; overflow-y: auto; padding: 14px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.picker-item { border: 2px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; transition: border-color .12s; }
.picker-item:hover { border-color: var(--primary); }
.picker-item.selected { border-color: var(--primary); background: var(--primary-soft); }
.picker-item .pi-thumb { aspect-ratio: 1/1; background: var(--primary-soft); display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--primary); overflow: hidden; }
.picker-item .pi-thumb img { width: 100%; height: 100%; object-fit: cover; }
.picker-item .pi-name { font-size: 11px; padding: 5px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-folder-btn { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: none; border-radius: 7px; padding: 6px 8px; font-size: 12.5px; cursor: pointer; color: var(--text); }
.picker-folder-btn:hover { background: var(--primary-soft); }
.picker-folder-btn.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.picker-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--muted); gap: 10px; }

/* ── Insert Image Modal Tabs ── */
.insert-img-tab { flex: 1; background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 16px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 7px; transition: color .15s, border-color .15s; }
.insert-img-tab:hover { color: var(--text); background: var(--primary-soft); }
.insert-img-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-soft); }
/* آیکون سفارشی عکس در toolbar کوییل */
.ql-toolbar .ql-page-image { padding: 2px 4px; }
.ql-toolbar .ql-page-image:hover { color: var(--primary); }
.ql-toolbar .ql-page-image .fa-image { font-size: 14px; vertical-align: middle; }
/* آیکون سفارشی ویدیو در toolbar کوییل */
.ql-toolbar .ql-page-video { padding: 2px 4px; }
.ql-toolbar .ql-page-video:hover { color: var(--primary); }
.ql-toolbar .ql-page-video .fa-film { font-size: 14px; vertical-align: middle; }
/* دکمه‌های color picker پیشرفته در toolbar */
.ql-toolbar .ql-page-color { padding: 2px 5px; }
.ql-toolbar .ql-page-color:hover { color: var(--primary); }
.ql-toolbar .ql-page-color .fa-palette,
.ql-toolbar .ql-page-color .fa-fill-drip { font-size: 13px; vertical-align: middle; }
/* thumbnail ویدیو در picker */
.pi-thumb-video { background: #1e293b !important; color: #60a5fa !important; font-size: 32px !important; }
.picker-item-video:hover .pi-thumb-video { background: #1e3a5f !important; }

/* ── Color Picker Modal ── */
.color-picker-modal { background: var(--surface); border-radius: 14px; overflow: hidden; width: 340px; max-width: 96vw; box-shadow: 0 20px 60px rgba(0,0,0,.25); position: relative; z-index: 1; }
.color-swatches-grid { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; }
.color-swatch { width: 100%; aspect-ratio: 1/1; border-radius: 3px; cursor: pointer; border: 2px solid transparent; transition: transform .1s, border-color .1s; }
.color-swatch:hover { transform: scale(1.25); z-index: 1; position: relative; border-color: rgba(255,255,255,.6); }
.color-swatch.selected { border-color: var(--primary); transform: scale(1.2); box-shadow: 0 0 0 2px var(--primary-soft); }
.color-native-preview { width: 48px; height: 48px; border-radius: 10px; border: 2px solid var(--border); cursor: pointer; position: relative; transition: border-color .15s; }
.color-native-overlay { position: absolute; inset: 0; border-radius: 10px; cursor: pointer; }
.color-native-preview:hover { border-color: var(--primary); }
.color-hex-input { height: 34px; font-size: 13px; letter-spacing: .5px; }
.color-rgb-input { height: 34px; font-size: 12px; text-align: center; padding: 0 6px; }
.color-preview-bar { border-radius: 8px; border: 1px solid var(--border); padding: 12px 16px; text-align: center; font-size: 15px; font-weight: 600; transition: background .15s; }
/* alignment دکمه‌ها در toolbar کوییل */
.ql-toolbar .ql-align .fa-solid { font-size: 13px; vertical-align: middle; pointer-events: none; }

/* ── Media Tooltip ── */
.media-tooltip-box { position: fixed; z-index: 999999; pointer-events: none; background: #1a2332; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; padding: 0; min-width: 200px; max-width: 280px; box-shadow: 0 12px 32px rgba(0,0,0,.35), 0 2px 8px rgba(0,0,0,.2); opacity: 0; transform: translateY(6px) scale(.97); transition: opacity .18s ease, transform .18s ease; overflow: hidden; }
.media-tooltip-box.visible { opacity: 1; transform: translateY(0) scale(1); }
.mt-section { padding: 10px 13px; }
.mt-section-file { background: rgba(255,255,255,.04); }
.mt-divider { height: 1px; background: rgba(255,255,255,.08); margin: 0; }
/* نام فایل */
.mt-file-name { display: flex; align-items: flex-start; gap: 8px; }
.mt-icon-file { color: rgba(255,255,255,.4); font-size: 12px; margin-top: 2px; flex-shrink: 0; }
.mt-file-name span { font-size: 12px; font-weight: 700; font-family: monospace; color: #fff; word-break: break-all; line-height: 1.5; }
/* ردیف‌های اطلاعات */
.mt-row { display: flex; align-items: flex-start; gap: 9px; margin-top: 7px; }
.mt-row:first-child { margin-top: 0; }
.mt-icon-wrap { width: 22px; height: 22px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 10px; flex-shrink: 0; }
.mt-c-blue  { background: rgba(37,99,235,.25);   color: #93c5fd; }
.mt-c-teal  { background: rgba(13,148,136,.25);  color: #5eead4; }
.mt-c-green { background: rgba(22,163,74,.25);   color: #86efac; }
.mt-c-amber { background: rgba(217,119,6,.25);   color: #fcd34d; }
.mt-col { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mt-label { font-size: 10px; font-weight: 700; color: rgba(255,255,255,.4); text-transform: uppercase; letter-spacing: .05em; }
.mt-val { font-size: 12px; color: rgba(255,255,255,.88); line-height: 1.45; word-break: break-word; }
.mt-italic { font-style: italic; color: rgba(255,255,255,.65); }
.mt-date { font-size: 11.5px; color: rgba(255,255,255,.75); direction: rtl; }

/* ── Limit Badge ── */
.limit-badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 3px 10px; white-space: nowrap; }
.limit-badge.at-limit { color: #dc2626; border-color: #fca5a5; background: #fff1f1; }

/* ── Resource Monitor ── */
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 6px; }
.res-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .15s; }
.res-card:hover { box-shadow: var(--shadow); }
.res-card-head { display: flex; align-items: center; gap: 10px; }
.res-icon { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.res-icon.blue   { background: rgba(23,50,77,.1);   color: #17324d; }
.res-icon.purple { background: rgba(124,58,237,.1);  color: #7c3aed; }
.res-icon.gold   { background: rgba(214,168,79,.15); color: #b45309; }
.res-icon.green  { background: rgba(22,163,74,.1);   color: #16a34a; }
.res-icon.teal   { background: rgba(20,184,166,.1);  color: #0d9488; }
.res-icon.indigo { background: rgba(99,102,241,.1);  color: #4f46e5; }
.res-icon.orange { background: rgba(234,88,12,.1);   color: #ea580c; }
.res-icon.pink   { background: rgba(236,72,153,.1);  color: #db2777; }
.res-icon.cyan   { background: rgba(6,182,212,.1);   color: #0891b2; }
.res-icon.rose   { background: rgba(225,29,72,.1);   color: #e11d48; }
.res-icon.slate  { background: rgba(100,116,139,.1); color: #475569; }
.res-label { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
.res-display { font-size: 12px; color: var(--muted); margin-top: 1px; }
.res-bar-wrap { height: 7px; background: var(--border); border-radius: 4px; overflow: hidden; }
.res-bar { height: 100%; border-radius: 4px; transition: width .4s ease; }
.res-bar.ok     { background: #16a34a; }
.res-bar.warn   { background: #f59e0b; }
.res-bar.danger { background: #dc2626; }
.res-pct { font-size: 11px; font-weight: 700; display: flex; justify-content: space-between; }
.res-pct .pct-num.ok     { color: #16a34a; }
.res-pct .pct-num.warn   { color: #f59e0b; }
.res-pct .pct-num.danger { color: #dc2626; }

/* ── Toast ── */
.toast-container { position: fixed; top: 84px; left: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.app-toast { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; font-size: 13.5px; min-width: 260px; }
.toast-success i { color: var(--success); }
.toast-error i { color: var(--danger); }
.toast-info i { color: var(--info); }

/* ── Modal ── */
.modal-backdrop-custom { position: fixed; inset: 0; background: rgba(16,38,58,0.5); backdrop-filter: blur(4px); z-index: 1500; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: var(--surface); border-radius: 16px; width: 100%; max-width: 460px; box-shadow: var(--shadow); overflow: hidden; }
.modal-box.lg { max-width: 800px; }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 22px; max-height: 70vh; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; }

/* ── Utility ── */
.text-muted { color: var(--muted) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.ms-auto { margin-right: auto; }
.w-100 { width: 100%; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-info { color: var(--info) !important; }
.text-warning { color: var(--warning) !important; }
.opacity-50 { opacity: .5; }
.p-0 { padding: 0 !important; }

/* ── Product ── */
.product-thumb { width: 42px; height: 42px; border-radius: 8px; background: var(--primary-soft); display: inline-flex; align-items: center; justify-content: center; color: var(--primary); font-size: 16px; flex-shrink: 0; overflow: hidden; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
/* کلاس قدیمی — نگه‌داشته می‌شود برای سازگاری با کدهای غیر-AngularJS */
.stars { color: var(--accent); font-size: 12px; }

/* ── star-rating directive ────────────────────────────────────────────────── */
.star-rating { display: inline-flex; align-items: center; gap: 1px; line-height: 1; direction: ltr; }
.star-rating__star { color: var(--border, #ddd); transition: color .12s, transform .1s; user-select: none; }
.star-rating__star.filled  { color: var(--accent, #f59e0b); }
.star-rating__star.hovered { color: var(--accent, #f59e0b); opacity: .75; }

/* اندازه‌ها */
.star-rating--sm .star-rating__star { font-size: 12px; }
.star-rating--md .star-rating__star { font-size: 15px; }
.star-rating--lg .star-rating__star { font-size: 22px; letter-spacing: 2px; }

/* در حالت input کرسر نشان داده می‌شود و hover scale دارد */
.star-rating--input .star-rating__star { cursor: pointer; }
.star-rating--input .star-rating__star:hover,
.star-rating--input .star-rating__star:focus { transform: scale(1.2); outline: none; }
.star-rating--input .star-rating__star:focus-visible { outline: 2px solid var(--accent, #f59e0b); border-radius: 2px; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 16px; font-size: 13.5px; font-weight: 500; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--primary); border-bottom-color: var(--accent); font-weight: 600; }

/* ── Inbox ── */
.inbox-layout { display: grid; grid-template-columns: 380px 1fr; gap: 16px; min-height: 500px; }
@media (max-width: 992px) { .inbox-layout { grid-template-columns: 1fr; } }
.inbox-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-y: auto; max-height: 600px; }
.inbox-item { padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; }
.inbox-item:hover { background: var(--primary-soft); }
.inbox-item.active { background: var(--primary-soft); border-right: 3px solid var(--accent); }
.inbox-head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.inbox-name { font-weight: 600; font-size: 13.5px; }
.inbox-date { font-size: 11px; color: var(--muted); }
.inbox-subject { font-size: 13px; margin-bottom: 4px; }
.inbox-preview { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; }
.inbox-detail-head { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.inbox-detail-body { flex: 1; padding: 22px; overflow-y: auto; line-height: 1.8; }
.inbox-reply { border-top: 1px solid var(--border); padding: 14px 18px; display: flex; gap: 10px; }
.inbox-reply textarea { flex: 1; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; font-family: var(--font); resize: none; min-height: 56px; }

/* ── Map ── */
.map-hint { background: var(--accent-soft); color: var(--primary-dark); padding: 8px 12px; border-radius: 8px; font-size: 12px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }

/* ── Preview ── */
.preview-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; background: var(--surface); }
.preview-title { font-size: 24px; font-weight: 700; margin-bottom: 16px; }
.preview-content { line-height: 1.8; }
.preview-content img { max-width: 100%; border-radius: 8px; }

/* ── Range Switcher ── */
.range-switcher { display: inline-flex; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 4px; gap: 2px; }
.range-btn { padding: 6px 14px; border-radius: 7px; background: transparent; border: none; color: var(--muted); font-family: var(--font); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.range-btn.active { background: var(--surface); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ── Code Editor ── */
.code-editor { width: 100%; min-height: 400px; border: 1px solid var(--border); border-radius: 10px; background: #1e1e1e; color: #d4d4d4; padding: 16px; font-family: 'Consolas', monospace; font-size: 13px; line-height: 1.6; resize: vertical; direction: ltr; text-align: left; }
.code-editor:focus { outline: none; border-color: var(--accent); }

/* ── Profile ── */
.profile-card { text-align: center; padding: 20px; }
.profile-avatar { width: 100px; height: 100px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 40px; margin: 0 auto 16px; overflow: hidden; position: relative; }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.profile-avatar-wrap { position: relative; width: 100px; margin: 0 auto 16px; }
.profile-avatar-upload { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,0.55); color: #fff; font-size: 11px; text-align: center; padding: 5px 0; border-radius: 0 0 50px 50px; cursor: pointer; opacity: 0; transition: opacity .2s; }
.profile-avatar-wrap:hover .profile-avatar-upload { opacity: 1; }
.profile-avatar-uploading { opacity: 0.5; pointer-events: none; }
.profile-info-item { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.profile-info-item:last-child { border-bottom: none; }

/* ── Crop Modal ── */
.crop-modal-box { width: 480px; max-width: 96vw; }
.crop-wrap { position: relative; width: 100%; background: #111; border-radius: 10px; overflow: hidden; touch-action: none; user-select: none; cursor: crosshair; }
.crop-wrap canvas { display: block; width: 100%; }
.crop-hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 8px; }

/* ── FAQ ── */
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; overflow: hidden; }
.faq-item.inactive { opacity: 0.6; }
.faq-question { padding: 16px 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.faq-question .faq-number { width: 32px; height: 32px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.faq-question .faq-text { flex: 1; font-weight: 600; font-size: 14px; min-width: 200px; }
.faq-question .faq-actions { display: flex; gap: 6px; }
.faq-answer { padding: 16px 20px 20px 64px; line-height: 1.8; font-size: 14px; border-top: 1px dashed var(--border); }
.faq-category-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--accent-soft); color: var(--primary-dark); }

/* ── Dropdown ── */
.dropdown-menu { border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; min-width: 200px; }
.dropdown-item { border-radius: 7px; padding: 8px 12px; font-size: 13px; display: flex; align-items: center; gap: 10px; color: var(--text); }
.dropdown-item:hover { background: var(--primary-soft); color: var(--primary); }
.dropdown-item i { width: 16px; color: var(--muted); }

/* ── Notification Dropdown ── */
.notif-dropdown { position: absolute; top: calc(100% + 8px); left: 0; width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 1100; overflow: hidden; }
.notif-dropdown-header { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--bg); }
.notif-dropdown-header h4 { margin: 0; font-size: 14px; font-weight: 700; color: var(--text); }
.notif-dropdown-header .count-badge { background: var(--danger); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 20px; font-weight: 600; }
.notif-dropdown-list { max-height: 400px; overflow-y: auto; }
.notif-item { padding: 12px 18px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .15s; display: flex; gap: 12px; }
.notif-item:hover { background: var(--primary-soft); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: rgba(23,50,77,0.03); }
.notif-item.unread::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--info); margin-top: 8px; flex-shrink: 0; }
.notif-item:not(.unread)::before { content: ""; width: 6px; height: 6px; flex-shrink: 0; }
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: 13px; color: var(--text); margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-desc { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 4px; }
.notif-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); }
.notif-footer { padding: 10px 18px; border-top: 1px solid var(--border); background: var(--bg); text-align: center; }
.notif-footer a { color: var(--primary); font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.notif-footer a:hover { color: var(--accent); }
.notif-empty { padding: 30px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.notif-empty i { font-size: 32px; opacity: 0.3; margin-bottom: 8px; display: block; }
.notif-icon-wrap { width: 36px; height: 36px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 14px; }
.notif-icon-wrap.blue  { background: rgba(37,99,235,0.1);  color: var(--info); }
.notif-icon-wrap.green { background: rgba(22,163,74,0.1);  color: var(--success); }
.notif-icon-wrap.gold  { background: var(--accent-soft);   color: var(--accent); }
.notif-icon-wrap.red   { background: rgba(220,38,38,0.1);  color: var(--danger); }
.header-notif-wrap { position: relative; }

/* overlay پشت dropdown روی موبایل — برای بستن با لمس بیرون */
.notif-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1150;
  background: transparent;
}
@media (max-width: 768px) {
  .notif-overlay { display: block; }

  /* dropdown خودش باید بالاتر از overlay باشه */
  .notif-dropdown { z-index: 1200; }
}

/* ── Slider ── */
.slider-thumb { width: 72px; height: 46px; border-radius: 8px; background: #17324d; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; border: 1px solid var(--border); }
.slider-row-title { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.slider-row-subtitle { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.slider-modal-preview { width: 100%; height: 240px; border-radius: 14px; overflow: hidden; position: relative; display: flex; align-items: flex-end; }
.slider-modal-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(10,24,38,.82) 0%, rgba(10,24,38,.18) 60%, transparent 100%); }
.slider-modal-content { position: relative; z-index: 2; padding: 20px 22px; width: 100%; }
.slider-modal-title { color: #fff; font-size: 22px; font-weight: 800; margin-bottom: 6px; line-height: 1.3; }
.slider-modal-subtitle { color: #d0e4f4; font-size: 13.5px; margin-bottom: 14px; line-height: 1.6; }
.slider-modal-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 20px; border-radius: 10px; background: #d6a84f; color: #17212b; font-size: 13px; font-weight: 700; text-decoration: none; }
.slider-modal-meta { display: flex; align-items: center; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.slider-modal-meta-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.slider-preview { width: 100%; height: 210px; border-radius: 12px; overflow: hidden; position: relative; display: flex; align-items: flex-end; background: #17324d; }
.slider-preview-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(10,24,38,.85) 0%, rgba(10,24,38,.15) 65%, transparent 100%); }
.slider-preview-content { position: relative; z-index: 2; padding: 18px 20px; width: 100%; }
.slider-preview-title { color: #fff; font-size: 18px; font-weight: 800; margin-bottom: 5px; line-height: 1.35; }
.slider-preview-subtitle { color: #d0e4f4; font-size: 12.5px; margin-bottom: 12px; line-height: 1.6; }
.slider-preview-btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 16px; border-radius: 8px; background: #d6a84f; color: #17212b; font-size: 12px; font-weight: 700; }
.slider-preview-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: rgba(255,255,255,.35); font-size: 13px; z-index: 1; }

/* ── Cleanup ── */
.cleanup-item { border: 2px solid var(--border); border-radius: 12px; padding: 16px 18px; cursor: pointer; transition: border-color .18s, background .18s; background: var(--surface); user-select: none; }
.cleanup-item:hover { border-color: var(--primary); background: var(--primary-soft); }
.cleanup-item.selected { border-color: var(--primary); background: rgba(23,50,77,0.06); }
.cleanup-checkbox { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background .15s, border-color .15s; font-size: 12px; color: #fff; }
.cleanup-item.selected .cleanup-checkbox { background: var(--primary); border-color: var(--primary); }

/* ── Upload Dialog ── */
.upload-dialog-dropzone { border: 2px dashed var(--border); border-radius: 12px; padding: 32px 20px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; background: var(--bg); position: relative; }
.upload-dialog-dropzone:hover,
.upload-dialog-dropzone.drag-over { border-color: var(--primary); background: var(--primary-soft); }
.upload-dialog-dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.upload-file-card { background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; align-items: flex-start; gap: 14px; }
.upload-file-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.upload-file-icon.img   { background: rgba(37,99,235,0.1);  color: var(--info); }
.upload-file-icon.vid   { background: rgba(220,38,38,0.1);  color: var(--danger); }
.upload-file-icon.aud   { background: rgba(214,168,79,0.15); color: var(--accent); }
.upload-file-icon.doc   { background: rgba(22,163,74,0.1);  color: var(--success); }
.upload-file-icon.arc   { background: rgba(124,58,237,0.1); color: #7c3aed; }
.upload-file-icon.other { background: var(--primary-soft);  color: var(--primary); }
.upload-progress-bar { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.upload-progress-fill { height: 100%; border-radius: 4px; transition: width .25s ease; background: var(--primary); }
.upload-progress-fill.done  { background: var(--success); }
.upload-progress-fill.error { background: var(--danger); }
.upload-folder-option { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; transition: background .12s; border: 1px solid transparent; }
.upload-folder-option:hover { background: var(--primary-soft); }
.upload-folder-option.active { background: var(--primary-soft); border-color: var(--primary); font-weight: 600; color: var(--primary); }

/* ── Health Check ── */
.hc-healthy { border-right: 4px solid #22c55e !important; }
.hc-warning  { border-right: 4px solid #f59e0b !important; }
.hc-error    { border-right: 4px solid #ef4444 !important; }
.border-success-soft { border-color: #bbf7d0 !important; }
.border-warning-soft { border-color: #fde68a !important; }
.border-danger-soft  { border-color: #fecaca !important; }

/* ── Connection Overlay ── */
#connection-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: rgba(11,18,32,0.82);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s ease;
}
#connection-overlay.visible { opacity: 1; pointer-events: all; }
.conn-box {
  background: var(--surface, #121B2B);
  border: 1px solid rgba(220,38,38,0.35);
  border-radius: 20px; padding: 40px 48px;
  text-align: center; max-width: 420px; width: 90%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45);
  animation: connPulse 2.4s ease-in-out infinite;
}
@keyframes connPulse {
  0%, 100% { box-shadow: 0 24px 64px rgba(220,38,38,0.18); }
  50%       { box-shadow: 0 24px 64px rgba(220,38,38,0.42); }
}
.conn-icon { width: 72px; height: 72px; border-radius: 50%; background: rgba(220,38,38,0.12); color: #DC2626; display: flex; align-items: center; justify-content: center; font-size: 30px; margin: 0 auto 20px; }
.conn-title { font-size: 18px; font-weight: 700; color: var(--text, #E6EAF0); margin-bottom: 8px; }
.conn-subtitle { font-size: 13.5px; color: var(--muted, #8A95A8); line-height: 1.7; margin-bottom: 24px; }
.conn-dots { display: flex; justify-content: center; gap: 8px; }
.conn-dots span { width: 9px; height: 9px; border-radius: 50%; background: rgba(220,38,38,0.45); animation: connDot 1.4s ease-in-out infinite; }
.conn-dots span:nth-child(2) { animation-delay: .18s; }
.conn-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes connDot {
  0%, 80%, 100% { transform: scale(.7); opacity: .5; }
  40%           { transform: scale(1);  opacity: 1;  }
}
.conn-box.reconnected { border-color: rgba(22,163,74,0.45); animation: none; box-shadow: 0 24px 64px rgba(22,163,74,0.25); }
.conn-box.reconnected .conn-icon { background: rgba(22,163,74,0.12); color: #16A34A; }
.conn-box.reconnected .conn-dots span { background: rgba(22,163,74,0.6); animation: none; }

/* ══════════════════════════════════════════════════════════════════
   Tag Picker Directive
   ══════════════════════════════════════════════════════════════════ */
.tag-picker { font-size: 13.5px; }

/* ── حالت نمایش ── */
.tag-picker--view .tp-view-wrap { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; align-items: center; }
.tp-no-tags { color: var(--muted); font-size: 12.5px; font-style: italic; }
.tp-chip--view { display: inline-flex; align-items: center; gap: 5px; background: var(--primary-soft); color: var(--primary); border: 1px solid rgba(23,50,77,0.15); border-radius: 20px; padding: 3px 10px 3px 8px; font-size: 12.5px; font-weight: 500; }
.tp-chip--view i { font-size: 10px; opacity: .7; }
.tp-chip-group { color: var(--muted); font-size: 11px; margin-right: 2px; }

/* ── تگ‌های انتخاب‌شده در edit ── */
.tp-selected-wrap { display: flex; flex-wrap: wrap; gap: 6px; min-height: 34px; padding: 6px 0; align-items: center; }
.tp-chip { display: inline-flex; align-items: center; gap: 5px; background: var(--primary-soft); color: var(--primary); border: 1px solid rgba(23,50,77,0.2); border-radius: 20px; padding: 4px 6px 4px 10px; font-size: 12.5px; font-weight: 500; transition: background .15s; }
.tp-chip i.fa-hashtag { font-size: 10px; opacity: .65; }
.tp-chip-remove { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; border: none; background: rgba(23,50,77,0.12); color: var(--primary); cursor: pointer; padding: 0; margin-right: 2px; transition: background .15s; }
.tp-chip-remove:hover { background: var(--danger); color: #fff; }
.tp-chip-remove i { font-size: 9px; }
.tp-placeholder { color: var(--muted); font-size: 12.5px; font-style: italic; padding: 4px 0; }

/* ── input و dropdown ── */
.tp-input-wrap { position: relative; }
.tp-search-bar { display: flex; align-items: center; gap: 0; border: 1.5px solid var(--border); border-radius: 8px; background: var(--bg); transition: border-color .15s; overflow: hidden; }
.tp-input-wrap.open .tp-search-bar { border-color: var(--primary); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.tp-search-icon { padding: 0 10px; color: var(--muted); font-size: 12px; flex-shrink: 0; }
.tp-input { flex: 1; border: none; background: transparent; outline: none; padding: 8px 0; font-size: 13px; font-family: inherit; color: var(--text); }
.tp-clear-btn { border: none; background: transparent; padding: 0 10px; color: var(--muted); cursor: pointer; font-size: 12px; }
.tp-clear-btn:hover { color: var(--danger); }

/* ── dropdown ── */
.tp-dropdown { position: absolute; right: 0; left: 0; top: 100%; background: var(--card); border: 1.5px solid var(--primary); border-top: none; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; z-index: 900; box-shadow: 0 8px 24px rgba(0,0,0,.12); }

/* فیلتر گروه */
.tp-group-filter { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--bg-alt, var(--bg)); }
.tp-gf-btn { border: 1.5px solid var(--border); border-radius: 20px; background: transparent; color: var(--muted); font-size: 11.5px; padding: 2px 10px; cursor: pointer; font-family: inherit; transition: all .15s; white-space: nowrap; }
.tp-gf-btn:hover { border-color: var(--primary); color: var(--primary); }
.tp-gf-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* لیست تگ‌ها */
.tp-drop-list { max-height: 220px; overflow-y: auto; padding: 4px 0; }
.tp-drop-loading, .tp-drop-empty { padding: 14px 16px; color: var(--muted); font-size: 13px; text-align: center; }
.tp-drop-item { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: transparent; padding: 8px 14px; cursor: pointer; font-family: inherit; font-size: 13px; color: var(--text); text-align: right; transition: background .12s; }
.tp-drop-item:hover { background: var(--primary-soft); }
.tp-drop-item.selected { background: var(--primary-soft); color: var(--primary); font-weight: 500; }
.tp-check-icon { color: var(--primary); font-size: 11px; width: 14px; }
.tp-hash-icon { color: var(--muted); font-size: 10px; width: 14px; opacity: .6; }
.tp-drop-name { flex: 1; }
.tp-drop-group { font-size: 11px; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 1px 7px; white-space: nowrap; }
.tp-drop-item.selected .tp-drop-group { background: rgba(23,50,77,0.1); }

/* ── دکمه‌های ذخیره ── */
.tp-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ── tagPicker: دکمه toggle و پیام خطا ── */
.tp-toggle-btn { border: none; background: transparent; padding: 0 10px; color: var(--muted); cursor: pointer; font-size: 11px; flex-shrink: 0; transition: color .15s; }
.tp-toggle-btn:hover { color: var(--primary); }
.tp-drop-error { padding: 12px 16px; color: var(--danger, #e53e3e); font-size: 13px; text-align: center; display: flex; align-items: center; justify-content: center; gap: 8px; }
.tp-drop-error .btn { font-size: 11.5px; padding: 2px 10px; }

/* ── tagPicker: keyboard navigation focus ── */
.tp-drop-item.focused { background: var(--primary-soft); outline: 2px solid var(--primary); outline-offset: -2px; }
.tp-drop-item.focused.selected { background: rgba(23,50,77,0.15); }

/* ── Mobile Sidebar (Hamburger Drawer) ── */
@media (max-width: 992px) {
  /* روی موبایل sidebar کاملاً از صفحه بیرون می‌رود (سمت راست) */
  .app-sidebar {
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1), width .25s ease;
    width: var(--sidebar-w) !important;
    box-shadow: none;
  }

  /* وقتی همبرگری زده شد، sidebar می‌آید */
  .sidebar-mobile-open .app-sidebar {
    transform: translateX(0);
    box-shadow: -8px 0 32px rgba(16,38,58,0.18);
  }

  /* محتوا روی موبایل نباید margin داشته باشد */
  .app-main {
    margin-right: 0 !important;
  }

  /* overlay تاریک پشت sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 20, 35, 0.45);
    z-index: 899;
    backdrop-filter: blur(2px);
    animation: fadeIn .2s ease;
  }
  .sidebar-mobile-open .sidebar-overlay {
    display: block;
  }

  /* در حالت collapsed روی موبایل: همان رفتار drawer — نه حالت icon-only */
  .sidebar-collapsed .app-sidebar {
    width: var(--sidebar-w) !important;
    transform: translateX(100%);
  }
  .sidebar-collapsed.sidebar-mobile-open .app-sidebar {
    transform: translateX(0);
  }
  .sidebar-collapsed .brand-text,
  .sidebar-collapsed .nav-title,
  .sidebar-collapsed .nav-item span,
  .sidebar-collapsed .nav-badge,
  .sidebar-collapsed .sidebar-search-wrap {
    display: flex !important;
  }
  .sidebar-collapsed .nav-item span { display: inline !important; }
  .sidebar-collapsed .nav-item { justify-content: flex-start !important; padding: 9px 12px !important; }
  .sidebar-collapsed .nav-section-toggle-icon { display: inline-block !important; }
}

/* ══════════════════════════════════════════════════════════════════
   Mobile Responsive — پنل مدیریت
   ══════════════════════════════════════════════════════════════════ */

/* ── تبلت: ≤ 768px ── */
@media (max-width: 768px) {

  /* Header: مخفی کردن جستجوی سراسری و کوچک کردن */
  .header-center { display: none; }
  .app-header { padding: 0 12px; gap: 8px; }
  .user-info { display: none; }
  /* .user-btn { padding: 6px; border-radius: 50%; } */
  .breadcrumb-nav { display: none; }

  /* محتوا: padding کمتر */
  .app-main { padding: 14px 12px; }

  /* Page header: عنوان و دکمه زیر هم */
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; margin: -14px -12px 16px -12px; padding: 12px; top: -14px; }
  .page-title { font-size: 18px; }

  /* کارت‌ها */
  .card-body { padding: 14px; }
  .card-header { padding: 12px 14px; }

  /* grid دو ستونه → یک ستون */
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  /* grid چهار ستونه (کارت‌های وضعیت) → دو ستون */
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns:repeat(4"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* grid سه ستونه → یک ستون */
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: repeat(3"],
  [style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr !important;
  }

  /* جدول‌ها: اسکرول افقی */
  .table-responsive, .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* modal: تمام عرض */
  .modal-dialog, .modal-content { width: 100% !important; max-width: 100% !important; margin: 0; border-radius: 16px 16px 0 0; position: fixed; bottom: 0; left: 0; right: 0; }

  /* فرم‌های افقی: عمودی شوند */
  .form-row { flex-direction: column !important; }

  /* دکمه‌های header page */
  .page-header .btn { width: 100%; justify-content: center; }

  /* editor layout */
  .editor-layout { grid-template-columns: 1fr !important; }

  /* media manager */
  .media-manager { flex-direction: column; }
  .media-sidebar { width: 100%; border-left: none; border-bottom: 1px solid var(--border); }
}

/* ── موبایل کوچک: ≤ 480px ── */
@media (max-width: 480px) {

  :root { --header-h: 56px; }

  .app-header { padding: 0 10px; }
  .app-main { padding: 10px 8px; }
  .page-title { font-size: 16px; }
  .page-header { margin: -10px -8px 14px -8px; padding: 10px 8px; top: -10px; }

  /* کارت‌های وضعیت: یک ستون */
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns:repeat(4"],
  [style*="grid-template-columns: repeat(2"],
  [style*="grid-template-columns:repeat(2"] {
    grid-template-columns: 1fr 1fr !important;
  }

  /* دکمه‌های کوچک */
  .btn { padding: 8px 12px; font-size: 13px; }
  .btn-sm { padding: 5px 10px; font-size: 12px; }

  /* badge در header */
  .badge-dot { font-size: 9px; min-width: 15px; height: 15px; }

  /* nav badge */
  .nav-badge { display: none; }

  /* جدول: فونت کوچکتر */
  .app-table, table { font-size: 12px; }
  .app-table thead th, table thead th { padding: 8px; }
  .app-table td, table td { padding: 8px; }
}

/* ── Notification Dropdown: موبایل ── */
@media (max-width: 768px) {
  /* dropdown پیام‌ها و نظرات: تمام عرض صفحه، ثابت زیر header */
  .notif-dropdown {
    position: fixed;
    top: var(--header-h);
    right: 0;
    left: 0;
    width: 100% !important;
    max-width: 100%;
    border-radius: 0 0 var(--radius) var(--radius);
    border-left: none;
    border-right: none;
    z-index: 1200;
  }

  /* ارتفاع لیست کمتر تا روی صفحه‌های کوچک همه چیز نمایان باشد */
  .notif-dropdown-list { max-height: 55vh; }

  /* آیتم‌ها کمی فشرده‌تر */
  .notif-item { padding: 10px 14px; gap: 10px; }
  .notif-dropdown-header { padding: 12px 14px; }
  .notif-footer { padding: 10px 14px; }

  /* آیکون کوچکتر */
  .notif-icon-wrap { width: 32px; height: 32px; font-size: 13px; }
}


/* ═══════════════════════════════════════════════════════════════════
   Rich Editor — Image / Video resize & settings dialog
   ═══════════════════════════════════════════════════════════════════ */

/* ── wrapper داخل Quill که روی عکس/ویدیو انتخاب‌شده می‌نشینه ─── */
.re-media-overlay {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid var(--primary, #2563eb);
  border-radius: 3px;
  pointer-events: none;   /* کلیک‌ها از زیرش رد می‌شن */
  z-index: 10;
}

/* ── هشت handle گوشه / وسط اضلاع ────────────────────────────── */
.re-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #fff;
  border: 2px solid var(--primary, #2563eb);
  border-radius: 2px;
  box-sizing: border-box;
  pointer-events: all;
  z-index: 11;
}
/* موقعیت‌ها */
.re-handle[data-pos="nw"] { top:-5px;  left:-5px;  cursor:nw-resize; }
.re-handle[data-pos="n"]  { top:-5px;  left:calc(50% - 5px); cursor:n-resize; }
.re-handle[data-pos="ne"] { top:-5px;  right:-5px; cursor:ne-resize; }
.re-handle[data-pos="e"]  { top:calc(50% - 5px); right:-5px; cursor:e-resize; }
.re-handle[data-pos="se"] { bottom:-5px; right:-5px; cursor:se-resize; }
.re-handle[data-pos="s"]  { bottom:-5px; left:calc(50% - 5px); cursor:s-resize; }
.re-handle[data-pos="sw"] { bottom:-5px; left:-5px; cursor:sw-resize; }
.re-handle[data-pos="w"]  { top:calc(50% - 5px); left:-5px; cursor:w-resize; }

/* ── نوار ابزار کوچک بالای المان انتخاب‌شده ─────────────────── */
.re-toolbar {
  position: absolute;
  top: -36px;
  left: 0;
  display: flex;
  gap: 4px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  padding: 3px 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  pointer-events: all;
  white-space: nowrap;
  z-index: 12;
}
.re-toolbar button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--text, #111);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background .12s;
}
.re-toolbar button:hover { background: var(--bg, #f3f4f6); }
.re-toolbar button.re-tb-danger:hover { background:#fee2e2; color:#dc2626; }
.re-toolbar .re-tb-sep { width:1px; background:var(--border,#e5e7eb); margin:2px 2px; }

/* ── عکس/ویدیو انتخاب‌شده: outline ──────────────────────────── */
.ql-editor img.re-selected,
.ql-editor video.re-selected {
  outline: 2px solid var(--primary, #2563eb);
  outline-offset: 1px;
}

/* ── dialog تنظیمات ──────────────────────────────────────────── */
.re-dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.re-dialog {
  background: var(--surface, #fff);
  border-radius: 14px;
  width: 520px;
  max-width: 96vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: flex;
  flex-direction: column;
}
.re-dialog-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  background: var(--surface, #fff);
  z-index: 1;
}
.re-dialog-head h3 { margin: 0; flex: 1; font-size: 15px; }
.re-dialog-body { padding: 20px 18px; display: flex; flex-direction: column; gap: 16px; }
.re-dialog-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border, #e5e7eb);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  position: sticky;
  bottom: 0;
  background: var(--surface, #fff);
}

/* ── سکشن‌های داخل dialog ────────────────────────────────────── */
.re-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted, #6b7280);
  margin-bottom: 10px;
}
.re-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.re-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ── color swatch row ────────────────────────────────────────── */
.re-color-row { display: flex; align-items: center; gap: 8px; }
.re-color-row input[type=color] {
  width: 36px; height: 36px;
  border: 1px solid var(--border,#e5e7eb);
  border-radius: 8px;
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
}
.re-color-row .form-control { flex: 1; }

/* ── align buttons ───────────────────────────────────────────── */
.re-align-btns { display: flex; gap: 6px; }
.re-align-btn {
  flex: 1;
  padding: 7px 4px;
  border: 1px solid var(--border,#e5e7eb);
  border-radius: 8px;
  background: var(--bg,#f9fafb);
  cursor: pointer;
  font-size: 12px;
  text-align: center;
  transition: all .12s;
}
.re-align-btn:hover { border-color: var(--primary,#2563eb); background: var(--bg,#f9fafb); }
.re-align-btn.active {
  border-color: var(--primary,#2563eb);
  background: rgba(37,99,235,.08);
  color: var(--primary,#2563eb);
  font-weight: 600;
}

/* ── preview strip ───────────────────────────────────────────── */
.re-preview-strip {
  background: var(--bg,#f9fafb);
  border: 1px solid var(--border,#e5e7eb);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  overflow: hidden;
}
.re-preview-strip img, .re-preview-strip video {
  max-width: 100%;
  max-height: 160px;
  object-fit: contain;
  display: block;
}

/* ── دکمه toggle code/visual در sorenRichEditor ─────────────────── */
.re-code-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 26px;
  border: 1px solid var(--border, #d1d5db);
  border-radius: 6px;
  background: var(--bg, #f9fafb);
  color: var(--text, #374151);
  cursor: pointer;
  font-size: 12px;
  transition: all .15s;
  margin: 4px 6px 0 0;
  flex-shrink: 0;
  vertical-align: middle;
}
.re-code-toggle:hover {
  background: var(--surface, #fff);
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}
.re-code-toggle.re-code-active {
  background: var(--primary, #2563eb) !important;
  color: #fff !important;
  border-color: var(--primary, #2563eb) !important;
}
.re-code-area {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  direction: ltr;
  text-align: left;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border, #e5e7eb);
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 12px 14px;
  background: var(--bg, #f9fafb);
  color: var(--text, #111);
  line-height: 1.6;
  outline: none;
}
.re-code-area:focus {
  border-color: var(--primary, #2563eb);
  box-shadow: 0 0 0 2px rgba(37,99,235,.1);
}
