/* =====================================================================
   mail.nizaal.com — Design System
   Brand: nizaal | RTL Arabic
   ===================================================================== */

:root {
  /* Brand */
  --brand-primary: #6366F1;
  --brand-light: #818CF8;
  --brand-soft: #A5B4FC;
  --brand-bg: rgba(99, 102, 241, 0.10);
  --brand-border: rgba(99, 102, 241, 0.25);

  /* Z Moment */
  --moment: #2DD4BF;
  --moment-bg: rgba(45, 212, 191, 0.10);
  --moment-border: rgba(45, 212, 191, 0.25);

  /* Identity Gold (لمسات فقط) */
  --identity: #D4A853;
  --identity-bg: rgba(212, 168, 83, 0.12);
  --identity-border: rgba(212, 168, 83, 0.25);

  /* System */
  --alert: #F87171;
  --alert-bg: rgba(248, 113, 113, 0.10);
  --alert-border: rgba(248, 113, 113, 0.25);
  --success: #4ADE80;
  --success-bg: rgba(74, 222, 128, 0.10);
  --success-border: rgba(74, 222, 128, 0.25);

  /* Backgrounds */
  --bg-base: #0A0C12;
  --bg-surface: #0F1219;
  --bg-elevated: #151821;
  --bg-raised: #1C2030;

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.10);

  /* Text */
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --text-dim: #475569;

  /* Radius */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--text);
  font-family: 'Tahoma', 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  direction: rtl;
  text-align: right;
  min-height: 100vh;
}

a {
  color: var(--brand-light);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Logo */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 500;
  letter-spacing: -0.5px;
}
.logo .l-z { color: var(--moment); }

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

.sidebar {
  width: 240px;
  background: var(--bg-surface);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 0.5px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px 18px;
  border-bottom: 0.5px solid var(--border);
  margin-bottom: 12px;
}

.sidebar-section {
  color: var(--text-dim);
  font-size: 10px;
  padding: 12px 6px 4px;
  letter-spacing: 1px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  border: 0.5px solid transparent;
}

.sidebar-link:hover {
  background: var(--bg-elevated);
  color: var(--text);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--brand-bg);
  border-color: var(--brand-border);
  color: var(--text);
}

.sidebar-link .ti {
  font-size: 15px;
}

.sidebar-link.active .ti {
  color: var(--brand-light);
}

.sidebar-badge {
  margin-right: auto;
  background: var(--brand-primary);
  color: var(--text);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 500;
}

.sidebar-user {
  margin-top: auto;
  padding-top: 16px;
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar {
  width: 32px;
  height: 32px;
  background: var(--brand-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-light);
  font-size: 12px;
  font-weight: 500;
  flex-shrink: 0;
}

.main {
  flex: 1;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-header {
  padding: 18px 22px;
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title {
  font-size: 18px;
  font-weight: 500;
  margin: 0 0 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 12px;
}

.page-content {
  padding: 22px;
  flex: 1;
}

/* Buttons */
.btn {
  background: transparent;
  border: 0.5px solid var(--border-strong);
  color: var(--text);
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  text-decoration: none;
}

.btn:hover {
  background: var(--bg-elevated);
  text-decoration: none;
}

.btn-primary {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--text);
  font-weight: 500;
}

.btn-primary:hover {
  background: var(--brand-light);
  border-color: var(--brand-light);
}

.btn-danger {
  background: var(--alert-bg);
  border-color: var(--alert-border);
  color: var(--alert);
}

.btn-success {
  background: var(--moment-bg);
  border-color: var(--moment-border);
  color: var(--moment);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.7;
}

/* Cards */
.card {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  margin-bottom: 14px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 0.5px solid var(--border);
}

.card-title {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat {
  background: var(--bg-surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px;
}

.stat.accent-brand { border-color: var(--brand-border); }
.stat.accent-moment { border-color: var(--moment-border); }
.stat.accent-identity { border-color: var(--identity-border); }

.stat-label {
  color: var(--text-muted);
  font-size: 11px;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 22px;
  font-weight: 500;
}

.stat-trend {
  font-size: 10px;
  margin-top: 4px;
  color: var(--text-dim);
}
.stat-trend.up { color: var(--moment); }
.stat-trend.down { color: var(--alert); }

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: right;
  padding: 10px 14px;
  background: var(--bg-surface);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  border-bottom: 0.5px solid var(--border);
}

.table td {
  padding: 12px 14px;
  border-bottom: 0.5px solid var(--border);
  font-size: 12px;
}

.table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 10px;
  border: 0.5px solid;
}

.badge-active {
  background: var(--moment-bg);
  border-color: var(--moment-border);
  color: var(--moment);
}

.badge-paused {
  background: var(--identity-bg);
  border-color: var(--identity-border);
  color: var(--identity);
}

.badge-banned {
  background: var(--alert-bg);
  border-color: var(--alert-border);
  color: var(--alert);
}

.badge-new {
  background: var(--brand-bg);
  border-color: var(--brand-border);
  color: var(--brand-light);
}

/* Alerts */
.alert {
  padding: 12px 14px;
  border-radius: var(--r-md);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  border: 0.5px solid;
}

.alert-success {
  background: var(--moment-bg);
  border-color: var(--moment-border);
  color: var(--moment);
}

.alert-danger {
  background: var(--alert-bg);
  border-color: var(--alert-border);
  color: var(--alert);
}

.alert-info {
  background: var(--brand-bg);
  border-color: var(--brand-border);
  color: var(--brand-light);
}

/* Toolbar */
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 22px;
  border-bottom: 0.5px solid var(--border);
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 280px;
}

.search-box input {
  width: 100%;
  background: var(--bg-elevated);
  border: 0.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 32px 8px 12px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
}

.search-box .ti {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 14px;
}

/* Empty states */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty .ti {
  font-size: 48px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

/* Toggle switch */
.switch {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}

.switch.on {
  background: var(--brand-primary);
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  width: 16px;
  height: 16px;
  background: var(--text);
  border-radius: 50%;
  transition: all 0.15s;
  right: 18px;
}

.switch.on::after {
  right: 2px;
}

/* Utility */
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mt-3 { margin-top: 12px; }
.hidden { display: none; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }
  .sidebar-link span:not(.sidebar-badge) { display: none; }
  .sidebar-section { display: none; }
  .sidebar-header { justify-content: center; }
  .sidebar-user { justify-content: center; }
  .sidebar-user > div:not(.avatar) { display: none; }
}
