@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
  --gold: #b08d3b;
  --gold-light: #d1b266;
  --black: #111111;
  --sidebar: #161616;
  --bg: #f4f3ef;
  --white: #ffffff;
  --gray: #6b7280;
  --border: #e5e2d9;
  --danger: #dc2626;
  --success: #16a34a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Tajawal', Tahoma, sans-serif;
  background: var(--bg);
  color: var(--black);
  direction: rtl;
}
button, input, select, textarea { font-family: inherit; }

/* Login Overlay */
.login-screen {
  min-height: 100vh;
  background: radial-gradient(circle at top, #241e14, #0f0f0f);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--white);
  width: 100%;
  max-width: 420px;
  border-radius: 18px;
  padding: 40px 32px;
  text-align: center;
  border: 1px solid var(--gold);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.45);
}
.login-card img { height: 50px; margin: 0 auto 20px; }
.login-card h2 { font-size: 1.45rem; margin-bottom: 6px; }
.login-card p { color: var(--gray); font-size: 0.92rem; margin-bottom: 24px; }
.login-hint {
  margin-top: 16px;
  font-size: 0.84rem;
  color: var(--gray);
  background: #faf8f2;
  padding: 10px;
  border-radius: 8px;
  border: 1px dashed var(--gold);
}

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

.sidebar {
  width: 265px;
  background: var(--sidebar);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  z-index: 100;
}
.sidebar-logo { padding: 6px 10px 24px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); margin-bottom: 18px; }
.sidebar-logo img { height: 42px; }
.nav-menu { list-style: none; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-item {
  padding: 12px 16px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #cfcfcf;
  font-weight: 500;
  transition: 0.2s;
}
.nav-item:hover, .nav-item.active {
  background: rgba(176, 141, 59, 0.18);
  color: var(--gold-light);
}
.badge-count {
  background: var(--gold);
  color: var(--white);
  font-size: 0.78rem;
  padding: 2px 8px;
  border-radius: 50px;
  font-weight: 700;
}
.sidebar-footer { border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 16px; display: flex; flex-direction: column; gap: 8px; }

.main-content {
  margin-right: 265px;
  flex: 1;
  padding: 28px 34px;
  min-width: 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 28px;
  background: var(--white);
  padding: 16px 24px;
  border-radius: 14px;
  border: 1px solid var(--border);
}
.topbar h1 { font-size: 1.4rem; }
.sync-pill {
  font-size: 0.84rem;
  padding: 6px 14px;
  border-radius: 50px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  font-weight: 600;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}
.kpi-card {
  background: var(--white);
  padding: 22px;
  border-radius: 14px;
  border: 1px solid var(--border);
  border-right: 4px solid var(--gold);
}
.kpi-card span { color: var(--gray); font-size: 0.92rem; }
.kpi-card strong { display: block; font-size: 2rem; margin-top: 6px; color: var(--black); }

/* Panels */
.panel { display: none; }
.panel.active { display: block; }
.card {
  background: var(--white);
  border-radius: 14px;
  padding: 24px;
  border: 1px solid var(--border);
  margin-bottom: 24px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* Forms & Buttons */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; text-align: right; }
.field label { font-weight: 600; font-size: 0.9rem; }
.field input, .field select, .field textarea {
  padding: 10px 14px;
  border: 1px solid #d5d0c3;
  border-radius: 9px;
  font-size: 0.95rem;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); }

.btn {
  padding: 9px 18px;
  border-radius: 9px;
  border: none;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: 0.2s;
}
.btn-gold { background: var(--gold); color: var(--white); }
.btn-gold:hover { background: #96752c; }
.btn-dark { background: var(--black); color: var(--white); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--black); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 14px; text-align: right; border-bottom: 1px solid var(--border); font-size: 0.93rem; }
th { background: #faf9f6; font-weight: 700; color: var(--gray); }
.thumb-sm { width: 54px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.thumb-wide { width: 96px; height: 54px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.status-pill { padding: 3px 10px; border-radius: 50px; font-size: 0.78rem; font-weight: 700; }
.status-new { background: #fef3c7; color: #92400e; }
.status-read { background: #e5e7eb; color: #374151; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--black);
  color: var(--white);
  padding: 13px 22px;
  border-radius: 10px;
  border-right: 4px solid var(--gold);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  z-index: 9999;
  display: none;
}
.toast.show { display: block; }

@media (max-width: 860px) {
  .sidebar { position: static; width: 100%; height: auto; }
  .admin-app.active { flex-direction: column; }
  .main-content { margin-right: 0; padding: 18px; }
}
