/* ============================================================
   SMM Panel — Premium Luxury Dark Theme · RTL Arabic
   ============================================================ */

:root {
  /* ── Palette ── */
  --bg-base:        #0a0c12;
  --bg-surface:     #12151e;
  --bg-card:        #161a26;
  --bg-card-hover:  #1c2133;
  --bg-input:       #1a1f2e;
  --bg-sidebar:     #0f1219;

  --accent-primary: #6c63ff;
  --accent-glow:    rgba(108,99,255,.25);
  --accent-gold:    #f5c842;
  --accent-gold-glow: rgba(245,200,66,.18);
  --accent-green:   #22c55e;
  --accent-red:     #ef4444;
  --accent-orange:  #f97316;
  --accent-blue:    #38bdf8;

  --text-primary:   #f0f2ff;
  --text-secondary: #8b92a9;
  --text-muted:     #515875;

  --border:         rgba(108,99,255,.15);
  --border-hover:   rgba(108,99,255,.35);

  --sidebar-width:  260px;
  --header-height:  64px;
  --radius:         14px;
  --radius-sm:      8px;
  --radius-lg:      20px;

  --shadow-card:    0 4px 24px rgba(0,0,0,.4);
  --shadow-glow:    0 0 32px var(--accent-glow);
  --transition:     0.22s cubic-bezier(.4,0,.2,1);

  font-size: 15px;
}

/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { direction: rtl; scroll-behavior: smooth; }
body {
  font-family: 'Cairo', 'Segoe UI', Arial, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
button, input, select, textarea { font-family: inherit; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--accent-primary); border-radius: 99px; }

/* ── Typography helpers ───────────────────────────────────── */
.text-primary { color: var(--accent-primary) !important; }
.text-gold    { color: var(--accent-gold) !important; }
.text-green   { color: var(--accent-green) !important; }
.text-red     { color: var(--accent-red) !important; }
.text-orange  { color: var(--accent-orange) !important; }
.text-blue    { color: var(--accent-blue) !important; }
.text-muted   { color: var(--text-secondary) !important; }

/* ── Layout wrapper ───────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; right: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}
.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo img { width: 38px; height: 38px; object-fit: contain; }
.sidebar-logo .logo-text { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.sidebar-logo .logo-sub  { font-size: .7rem; color: var(--text-secondary); }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-group-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .1em;
  color: var(--text-muted); text-transform: uppercase;
  padding: 18px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: .88rem; font-weight: 500;
  margin-bottom: 2px; transition: all var(--transition); cursor: pointer;
  position: relative;
}
.nav-item:hover, .nav-item.active {
  background: var(--accent-glow); color: var(--text-primary);
}
.nav-item.active { color: var(--accent-primary); }
.nav-item.active::before {
  content: '';
  position: absolute; right: 0; top: 20%; bottom: 20%;
  width: 3px; border-radius: 99px;
  background: var(--accent-primary);
}
.nav-item .icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item .badge {
  margin-right: auto; background: var(--accent-primary);
  color: #fff; font-size: .65rem; font-weight: 700;
  padding: 1px 7px; border-radius: 99px; min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 16px 12px; border-top: 1px solid var(--border);
}
.sidebar-user {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
}
.sidebar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-blue));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .9rem; flex-shrink: 0;
}
.sidebar-user .user-info .name { font-size: .85rem; font-weight: 600; }
.sidebar-user .user-info .role { font-size: .7rem; color: var(--text-secondary); }

/* ── Main content ─────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  min-height: 100vh;
  display: flex; flex-direction: column;
}

/* ── Topbar ───────────────────────────────────────────────── */
.topbar {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 28px; gap: 16px;
  position: sticky; top: 0; z-index: 90;
}
.topbar-title { font-size: 1.1rem; font-weight: 700; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); transition: all var(--transition); cursor: pointer;
  font-size: .95rem; position: relative;
}
.topbar-btn:hover { color: var(--text-primary); border-color: var(--border-hover); }
.topbar-btn .notif-dot {
  position: absolute; top: 6px; left: 6px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-red); border: 2px solid var(--bg-surface);
}

/* ── Page content ─────────────────────────────────────────── */
.page-content { flex: 1; padding: 28px; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; }
.page-header .subtitle { color: var(--text-secondary); font-size: .88rem; margin-top: 4px; }

/* ── Stats cards ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  transition: all var(--transition);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; right: 0; left: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--card-color, var(--accent-primary)), transparent);
}
.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--accent-glow);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; margin-bottom: 14px;
  color: var(--card-color, var(--accent-primary));
}
.stat-card .stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.stat-card .stat-label { color: var(--text-secondary); font-size: .78rem; margin-top: 4px; }

/* ── Generic card ─────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: .95rem; font-weight: 700; }
.card-body { padding: 22px; }

/* ── Tables ───────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: right; font-size: .73rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .08em;
  padding: 12px 16px; background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid rgba(108,99,255,.06); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg-card-hover); }
tbody td { padding: 13px 16px; font-size: .85rem; }

/* ── Status badges ────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 99px; font-size: .72rem; font-weight: 700;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-pending    { background: rgba(245,200,66,.12); color: var(--accent-gold); }
.badge-processing { background: rgba(56,189,248,.12); color: var(--accent-blue); }
.badge-completed  { background: rgba(34,197,94,.12);  color: var(--accent-green); }
.badge-rejected   { background: rgba(239,68,68,.12);  color: var(--accent-red); }
.badge-cancelled  { background: rgba(139,146,169,.12); color: var(--text-secondary); }
.badge-active     { background: rgba(34,197,94,.12);  color: var(--accent-green); }
.badge-inactive   { background: rgba(139,146,169,.12); color: var(--text-secondary); }
.badge-open       { background: rgba(108,99,255,.12); color: var(--accent-primary); }
.badge-closed     { background: rgba(139,146,169,.12); color: var(--text-secondary); }
.badge-in_progress{ background: rgba(249,115,22,.12); color: var(--accent-orange); }
.badge-info       { background: rgba(108,99,255,.12); color: var(--accent-primary); }
.badge-success    { background: rgba(34,197,94,.12);  color: var(--accent-green); }
.badge-error      { background: rgba(239,68,68,.12);  color: var(--accent-red); }
.badge-warning    { background: rgba(249,115,22,.12); color: var(--accent-orange); }
.badge-offer      { background: rgba(245,200,66,.12); color: var(--accent-gold); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 20px; border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent-primary); color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn-primary:hover {
  background: #7b72ff; box-shadow: 0 0 30px var(--accent-glow);
  transform: translateY(-1px);
}
.btn-gold {
  background: var(--accent-gold); color: #111;
  box-shadow: 0 0 20px var(--accent-gold-glow);
}
.btn-gold:hover { transform: translateY(-1px); }
.btn-outline {
  background: transparent; color: var(--text-primary);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.btn-danger { background: var(--accent-red); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 5px 13px; font-size: .78rem; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

/* ── Forms ────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 7px;
}
.form-control {
  width: 100%; padding: 10px 14px;
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  font-size: .88rem; transition: all var(--transition);
}
.form-control:focus {
  outline: none; border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { resize: vertical; min-height: 90px; }
select.form-control { appearance: none; cursor: pointer; }
.form-check { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.form-check input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--accent-primary); cursor: pointer;
}
.form-hint { font-size: .73rem; color: var(--text-muted); margin-top: 5px; }

/* ── Alert / Flash messages ───────────────────────────────── */
.alert {
  padding: 13px 18px; border-radius: var(--radius-sm);
  font-size: .85rem; margin-bottom: 18px;
  display: flex; align-items: flex-start; gap: 10px;
}
.alert-error   { background: rgba(239,68,68,.08);  border: 1px solid rgba(239,68,68,.25);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.08);  border: 1px solid rgba(34,197,94,.25);  color: #86efac; }
.alert-info    { background: rgba(108,99,255,.08); border: 1px solid rgba(108,99,255,.25); color: #a5b4fc; }
.alert-warning { background: rgba(249,115,22,.08); border: 1px solid rgba(249,115,22,.25); color: #fdba74; }

/* ── Auth pages ───────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-base); padding: 20px;
  background-image: radial-gradient(ellipse at 30% 20%, rgba(108,99,255,.12) 0%, transparent 60%),
                    radial-gradient(ellipse at 70% 80%, rgba(56,189,248,.07) 0%, transparent 60%);
}
.auth-card {
  width: 100%; max-width: 430px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-card);
}
.auth-logo { text-align: center; margin-bottom: 30px; }
.auth-logo img { width: 64px; height: 64px; object-fit: contain; }
.auth-logo h1 { font-size: 1.5rem; font-weight: 800; margin-top: 10px; }
.auth-logo p  { color: var(--text-secondary); font-size: .85rem; margin-top: 4px; }
.auth-divider {
  text-align: center; position: relative; margin: 20px 0; color: var(--text-muted); font-size: .8rem;
}
.auth-divider::before, .auth-divider::after {
  content: ''; position: absolute; top: 50%; width: 40%; height: 1px;
  background: var(--border);
}
.auth-divider::before { right: 0; }
.auth-divider::after  { left: 0; }
.auth-link { color: var(--accent-primary); font-size: .82rem; }
.auth-link:hover { text-decoration: underline; }
.auth-footer-text { text-align: center; font-size: .82rem; color: var(--text-secondary); margin-top: 16px; }

/* ── Notification card ────────────────────────────────────── */
.notif-item {
  display: flex; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid rgba(108,99,255,.06);
  transition: background var(--transition);
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: rgba(108,99,255,.04); }
.notif-icon {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: .95rem;
}
.notif-title { font-size: .85rem; font-weight: 600; }
.notif-msg   { font-size: .8rem; color: var(--text-secondary); margin-top: 2px; }
.notif-time  { font-size: .7rem; color: var(--text-muted); margin-top: 4px; }

/* ── Offer cards ──────────────────────────────────────────── */
.offers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.offer-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: all var(--transition);
}
.offer-card:hover { border-color: var(--border-hover); transform: translateY(-3px); box-shadow: var(--shadow-glow); }
.offer-card img { width: 100%; height: 180px; object-fit: cover; }
.offer-card-no-img {
  width: 100%; height: 180px;
  background: linear-gradient(135deg, rgba(108,99,255,.15), rgba(56,189,248,.1));
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem;
}
.offer-card-body { padding: 18px; }
.offer-card-body h3 { font-size: .95rem; font-weight: 700; }
.offer-card-body p  { font-size: .82rem; color: var(--text-secondary); margin-top: 6px; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  font-size: .82rem; font-weight: 600;
  background: var(--bg-card); border: 1px solid var(--border);
  transition: all var(--transition);
}
.pagination a:hover    { border-color: var(--border-hover); }
.pagination .current   { background: var(--accent-primary); border-color: transparent; color: #fff; }
.pagination .disabled  { opacity: .4; pointer-events: none; }

/* ── Dashboard widgets ────────────────────────────────────── */
.recent-table tbody td:first-child { font-weight: 600; }
.stat-trend { font-size: .75rem; margin-top: 8px; }

/* ── Order search results ─────────────────────────────────── */
.order-item {
  background: var(--bg-input); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 16px;
  display: flex; align-items: center; gap: 14px; margin-bottom: 10px;
  transition: all var(--transition); cursor: pointer;
}
.order-item:hover { border-color: var(--accent-primary); background: var(--accent-glow); }
.order-item input[type="radio"] { accent-color: var(--accent-primary); width: 16px; height: 16px; }
.order-detail span { font-size: .75rem; color: var(--text-secondary); }
.order-detail strong { font-size: .88rem; display: block; }

/* ── Mobile sidebar toggle ────────────────────────────────── */
.sidebar-toggle {
  display: none; background: none; border: none; color: var(--text-primary);
  font-size: 1.3rem; cursor: pointer; padding: 4px;
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 99;
}

/* ── Chat messages ────────────────────────────────────────── */
.chat-bubble {
  max-width: 72%; padding: 10px 15px; border-radius: 14px;
  font-size: .85rem; line-height: 1.6; margin-bottom: 12px;
}
.chat-bubble.from-user {
  background: var(--accent-primary); color: #fff;
  margin-right: auto; border-bottom-right-radius: 4px;
}
.chat-bubble.from-admin {
  background: var(--bg-card); border: 1px solid var(--border);
  margin-left: auto; border-bottom-left-radius: 4px;
}
.chat-bubble.internal {
  background: rgba(249,115,22,.08); border: 1px dashed var(--accent-orange);
  margin-left: auto; border-bottom-left-radius: 4px;
}
.chat-meta { font-size: .7rem; color: var(--text-muted); margin-top: 3px; }

/* ── Loading spinner ──────────────────────────────────────── */
.spinner {
  width: 22px; height: 22px; border: 3px solid var(--border);
  border-top-color: var(--accent-primary); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toasts ───────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; left: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px 18px;
  box-shadow: var(--shadow-card); font-size: .85rem;
  display: flex; align-items: center; gap: 10px;
  animation: slideIn .3s ease;
  min-width: 260px;
}
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast.success { border-color: rgba(34,197,94,.3); }
.toast.error   { border-color: rgba(239,68,68,.3);  }

/* ── Charts placeholder ───────────────────────────────────── */
.chart-container { position: relative; height: 240px; }

/* ── Admin colors override ────────────────────────────────── */
.admin .sidebar { background: #0b0d15; }
.admin-badge {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-blue));
  color: #fff; font-size: .65rem; font-weight: 700; padding: 2px 8px; border-radius: 99px;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root { --sidebar-width: 240px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.open { display: block; }
  .sidebar-toggle { display: block; }
  .main-content { margin-right: 0; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-card { padding: 28px 20px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .offers-grid { grid-template-columns: 1fr; }
  .btn { padding: 8px 14px; font-size: .8rem; }
}

/* ── Utility ──────────────────────────────────────────────── */
.d-flex    { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2     { gap: 8px; }
.gap-3     { gap: 12px; }
.gap-4     { gap: 16px; }
.mb-2      { margin-bottom: 8px; }
.mb-3      { margin-bottom: 12px; }
.mb-4      { margin-bottom: 16px; }
.mb-6      { margin-bottom: 24px; }
.mt-3      { margin-top: 12px; }
.mt-4      { margin-top: 16px; }
.w-100     { width: 100%; }
.fw-600    { font-weight: 600; }
.fw-700    { font-weight: 700; }
.fs-sm     { font-size: .82rem; }
.fs-xs     { font-size: .73rem; }
.rounded   { border-radius: var(--radius); }
.truncate  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Animations ───────────────────────────────────────────── */
.fade-in {
  animation: fadeIn .4s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.card, .stat-card, .notif-item, .offer-card {
  animation: fadeIn .35s ease;
}

/* ── Glow gradient separator ──────────────────────────────── */
.glow-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
  margin: 24px 0; opacity: .3;
}

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px;
}
.empty-state .empty-icon { font-size: 3rem; opacity: .3; margin-bottom: 14px; }
.empty-state p { color: var(--text-secondary); font-size: .9rem; }
