/* ═══════════════════════════════════════════════════════════════
   المكونات المشتركة
   ═══════════════════════════════════════════════════════════════ */

/* ─── Layout ─── */
.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 100px 0;
}

.section-title {
  font-family: 'Cairo', serif;
  font-size: 42px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 16px;
}

.section-sub {
  color: var(--text2);
  font-size: 17px;
  max-width: 600px;
  line-height: 1.8;
}

/* ─── Glass Card ─── */
.glass {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  transition: background .4s ease, border-color .4s ease;
}

.glass:hover {
  border-color: var(--card-bg-hover);
}

.card {
  padding: 32px;
  transition: all .4s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px var(--shadow);
}

[data-theme="light"] .glass {
  box-shadow: 0 2px 20px rgba(0, 0, 0, .04);
}

/* ─── Gold Text ─── */
.gold-text {
  background: linear-gradient(135deg, var(--gold), var(--gold-mid), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  transition: all .4s ease;
}

.badge-success { background: rgba(34, 197, 94, .1); color: var(--success); border: 1px solid rgba(34, 197, 94, .2); }
.badge-warning { background: rgba(245, 158, 11, .1); color: var(--warning); border: 1px solid rgba(245, 158, 11, .2); }
.badge-danger  { background: rgba(239, 68, 68, .1);  color: var(--danger);  border: 1px solid rgba(239, 68, 68, .2); }
.badge-gold    { background: rgba(212, 168, 16, .1); color: var(--gold);     border: 1px solid rgba(212, 168, 16, .2); }

/* ─── Buttons ─── */
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-mid), var(--gold-light));
  color: #0a0a12;
  font-weight: 700;
  padding: 14px 32px;
  border-radius: 12px;
  border: none;
  font-size: 15px;
  cursor: pointer;
  transition: all .3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-family: inherit;
}

.btn-gold:hover {
  box-shadow: 0 8px 30px rgba(212, 168, 16, .3);
  transform: translateY(-2px);
}

.btn-gold:active { transform: translateY(0) scale(.97); }

.btn-outline {
  border: 1px solid rgba(212, 168, 16, .3);
  color: var(--gold);
  font-weight: 600;
  padding: 14px 32px;
  border-radius: 12px;
  background: transparent;
  cursor: pointer;
  transition: all .3s;
  font-size: 15px;
  text-decoration: none;
  font-family: inherit;
}

.btn-outline:hover {
  background: rgba(212, 168, 16, .08);
  border-color: rgba(212, 168, 16, .5);
}

.btn-sm { padding: 10px 20px; font-size: 13px; border-radius: 10px; }

/* ─── Input ─── */
.input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: all .3s ease;
  outline: none;
}

.input::placeholder { color: var(--text3); }

.input:focus {
  border-color: rgba(212, 168, 16, .4);
  box-shadow: 0 0 0 3px rgba(212, 168, 16, .08);
}

select.input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2372728a' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
  padding-left: 36px;
}

/* ─── Table ─── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  text-align: right;
  padding: 12px 20px;
  font-size: 11px;
  color: var(--text3);
  letter-spacing: .5px;
  font-weight: 700;
  border-bottom: 1px solid var(--card-border);
}

td {
  padding: 14px 20px;
  font-size: 14px;
  border-bottom: 1px solid var(--table-border);
  transition: background .3s ease;
}

tr:hover td { background: var(--table-hover); }

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  width: 100%;
  max-width: 480px;
  animation: fadeUp .3s ease;
}

/* ─── Toggle ─── */
.toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--bg4);
  position: relative;
  cursor: pointer;
  transition: all .3s;
  flex-shrink: 0;
}

.toggle.on { background: var(--gold); }

.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: all .3s;
}

.toggle.on::after { right: 23px; }

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 300;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  animation: fadeUp .3s ease;
  display: none;
  box-shadow: 0 8px 30px var(--shadow);
}

.toast.show { display: flex; align-items: center; gap: 10px; }
.toast-success { background: rgba(34, 197, 94, .15); border: 1px solid rgba(34, 197, 94, .3); color: var(--success); }
.toast-error   { background: rgba(239, 68, 68, .15);  border: 1px solid rgba(239, 68, 68, .3);  color: var(--danger); }

/* ─── Theme Toggle ─── */
.theme-toggle {
  width: 56px;
  height: 28px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: var(--bg4);
  cursor: pointer;
  position: relative;
  transition: all .4s ease;
  display: flex;
  align-items: center;
  padding: 0 4px;
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(212, 168, 16, .15);
}

.theme-toggle .toggle-knob {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gold);
  position: absolute;
  top: 3px;
  right: 3px;
  transition: all .4s cubic-bezier(.68, -.55, .27, 1.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
}

[data-theme="light"] .theme-toggle .toggle-knob {
  right: calc(100% - 23px);
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  font-size: 12px;
  transition: opacity .3s ease;
  top: 50%;
  transform: translateY(-50%);
}

.theme-toggle .icon-sun  { right: 7px; opacity: .4; }
.theme-toggle .icon-moon { left: 7px;  opacity: .4; }

[data-theme="light"] .theme-toggle .icon-sun { opacity: 1; }

/* ─── Sidebar ─── */
.admin-layout { display: flex; min-height: 100vh; }

.admin-sidebar {
  width: 256px;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--card-border);
  padding: 20px;
  position: fixed;
  top: 64px;
  bottom: 0;
  right: 0;
  overflow-y: auto;
  transition: all .4s ease;
}

.admin-main {
  flex: 1;
  margin-right: 256px;
  padding: 32px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text2);
  text-decoration: none;
  transition: all .2s;
  cursor: pointer;
  margin-bottom: 2px;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(212, 168, 16, .08);
  color: var(--gold);
}

/* ─── Stats ─── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 40px 0;
  border-top: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
}

.stat-item { text-align: center; }

.stat-value {
  font-family: 'Cairo', serif;
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--text3);
  letter-spacing: .5px;
}

/* ─── Chart ─── */
.chart-container { position: relative; height: 300px; width: 100%; }

.chart-bar {
  position: absolute;
  bottom: 0;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(to top, rgba(212, 168, 16, .8), rgba(212, 168, 16, .2));
  transition: all .6s ease;
  min-width: 20px;
}

.chart-bar:hover {
  background: linear-gradient(to top, var(--gold), rgba(212, 168, 16, .5));
}

[data-theme="light"] .chart-bar {
  background: linear-gradient(to top, rgba(184, 134, 11, .9), rgba(184, 134, 11, .3));
}

/* ─── Particles ─── */
.particles { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(212, 168, 16, .3);
  border-radius: 50%;
  animation: float 8s ease-in-out infinite;
}

[data-theme="light"] .particle { background: rgba(184, 134, 11, .2); }
