@import url('https://fonts.googleapis.com/css2?family=Noto+Naskh+Arabic:wght@400;500;600;700&family=Noto+Kufi+Arabic:wght@400;500;600;700;800&family=Tajawal:wght@300;400;500;700&display=swap');

:root {
  --primary: #1a3a5c;
  --primary-dark: #0f2440;
  --primary-light: #2c5f8a;
  --accent: #c8a951;
  --accent-light: #e8d48b;
  --gold: #b8860b;
  --text: #1a1a2e;
  --text-light: #4a4a5a;
  --bg: #f4f1ea;
  --bg-card: #ffffff;
  --border: #d4c9b0;
  --success: #2d7d46;
  --danger: #b83a3a;
  --warning: #d4a017;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
  --radius: 8px;
  --transition: all 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Tajawal', 'Noto Naskh Arabic', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  direction: rtl;
}

a { color: var(--primary-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }

/* ── Top Bar ── */
.top-bar {
  background: var(--primary-dark);
  color: #ccc;
  font-size: 0.8rem;
  padding: 6px 0;
  border-bottom: 3px solid var(--accent);
}
.top-bar .container {
  display: flex; justify-content: space-between; align-items: center;
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
}
.top-bar .date { color: var(--accent-light); font-weight: 500; }
.top-bar .ai-badge {
  background: var(--accent); color: var(--primary-dark);
  padding: 2px 12px; border-radius: 12px;
  font-size: 0.7rem; font-weight: 700;
}

/* ── Header ── */
.header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 30px 0 20px;
  border-bottom: 4px solid var(--accent);
  position: relative;
  overflow: hidden;
}
.header::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.header .container {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  position: relative; z-index: 1;
  text-align: center;
}
.header .logo {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 2.2rem; font-weight: 800;
  color: white;
  margin-bottom: 5px;
  letter-spacing: -0.5px;
}
.header .logo span { color: var(--accent); }
.header .subtitle {
  font-size: 1rem; color: var(--accent-light);
  font-weight: 400; opacity: 0.9;
}
.header .school-type {
  font-size: 0.85rem; color: #aaa;
  margin-top: 5px;
}

/* ── Navigation ── */
.nav {
  background: white;
  border-bottom: 2px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow);
}
.nav .container {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center;
  padding: 0 10px;
}
.nav a {
  padding: 12px 18px; font-size: 0.9rem;
  font-weight: 500; color: var(--text);
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}
.nav a:hover, .nav a.active {
  color: var(--primary);
  border-bottom-color: var(--accent);
  background: rgba(200,169,81,0.08);
}
.nav .nav-left {
  margin-right: auto;
  display: flex; align-items: center; gap: 10px;
}
.nav .nav-left a { font-size: 0.8rem; padding: 8px 12px; }

/* ── Nav Dropdown ── */
.nav-dropdown { position: relative; display: inline-flex; }
.nav-dropdown-trigger {
  padding: 12px 18px; font-size: 0.9rem;
  font-weight: 500; color: var(--text);
  border-bottom: 3px solid transparent;
  transition: var(--transition);
  white-space: nowrap; cursor: pointer;
  display: flex; align-items: center; gap: 4px;
}
.nav-dropdown:hover .nav-dropdown-trigger {
  color: var(--primary);
  border-bottom-color: var(--accent);
  background: rgba(200,169,81,0.08);
}
.nav-dropdown-menu {
  position: absolute; top: 100%; right: 0;
  background: white; min-width: 200px;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: var(--transition);
  z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1; pointer-events: all;
}
.nav-dropdown-menu a {
  display: block; padding: 10px 16px;
  font-size: 0.85rem; color: var(--text);
  border-bottom: 1px solid #f0eadb;
  transition: var(--transition);
  white-space: nowrap;
}
.nav-dropdown-menu a:last-child { border-bottom: none; }
.nav-dropdown-menu a:hover {
  background: rgba(200,169,81,0.08);
  color: var(--primary);
  padding-right: 22px;
}

/* ── Container ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── Hero Section ── */
.hero {
  margin: 30px 0;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 40px;
  min-height: 350px;
  display: flex; flex-direction: column; justify-content: flex-end;
  position: relative;
}
.hero-card .hero-category {
  display: inline-block;
  background: var(--accent); color: var(--primary-dark);
  padding: 4px 16px; border-radius: 20px;
  font-size: 0.8rem; font-weight: 700;
  margin-bottom: 15px; width: fit-content;
}
.hero-card h2 {
  font-size: 2rem; font-weight: 700;
  margin-bottom: 10px; line-height: 1.4;
}
.hero-card p {
  font-size: 1rem; opacity: 0.9;
  max-width: 700px; line-height: 1.7;
}
.hero-card .hero-meta {
  display: flex; gap: 20px;
  margin-top: 15px; font-size: 0.85rem; opacity: 0.8;
}

/* ── Content Grid ── */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
  margin: 30px 0;
}

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 1px solid var(--border);
}
.card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.card-body { padding: 20px; }
.card-category {
  display: inline-block;
  font-size: 0.75rem; font-weight: 700;
  padding: 3px 12px; border-radius: 12px;
  margin-bottom: 10px;
  text-transform: uppercase;
}
.card-category.news { background: #dbeafe; color: #1e40af; }
.card-category.activity { background: #dcfce7; color: #166534; }
.card-category.announcement { background: #fef3c7; color: #92400e; }
.card-category.uncategorized { background: #f3f4f6; color: #6b7280; }
.card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 8px; line-height: 1.5; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--primary-light); }
.card p { font-size: 0.9rem; color: var(--text-light); line-height: 1.7; }
.card-meta {
  display: flex; gap: 15px;
  margin-top: 12px; font-size: 0.8rem; color: #888;
}
.card-meta .ai-tag {
  background: #eef2ff; color: #4338ca;
  padding: 1px 8px; border-radius: 8px;
  font-size: 0.7rem;
}

/* ── News Grid (multi-column) ── */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.section-title {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 1.4rem; font-weight: 700;
  color: var(--primary);
  margin: 30px 0 20px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--accent);
  display: flex; align-items: center; gap: 10px;
}
.section-title .badge {
  background: var(--primary); color: white;
  font-size: 0.8rem; padding: 2px 12px;
  border-radius: 12px; font-weight: 400;
}

/* ── Sidebar ── */
.sidebar > div {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}
.sidebar h3 {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 1rem; font-weight: 700;
  color: var(--primary);
  margin-bottom: 15px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}
.sidebar ul { list-style: none; }
.sidebar li { padding: 8px 0; border-bottom: 1px solid #f0eadb; }
.sidebar li:last-child { border-bottom: none; }
.sidebar li a { font-size: 0.9rem; display: block; }
.sidebar li .date { font-size: 0.75rem; color: #999; }

/* ── Stats Bar ── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
  margin: 25px 0;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card .number {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 2rem; font-weight: 800;
  color: var(--primary);
}
.stat-card .label { font-size: 0.85rem; color: var(--text-light); margin-top: 5px; }

/* ── Timeline ── */
.timeline {
  position: relative;
  padding: 20px 0;
}
.timeline::before {
  content: '';
  position: absolute; right: 20px; top: 0; bottom: 0;
  width: 3px; background: var(--accent);
}
.timeline-item {
  position: relative;
  padding-right: 50px;
  margin-bottom: 25px;
}
.timeline-item::before {
  content: '';
  position: absolute; right: 12px; top: 8px;
  width: 18px; height: 18px;
  background: var(--primary);
  border: 3px solid var(--accent);
  border-radius: 50%;
}
.timeline-item .t-date {
  font-size: 0.8rem; color: var(--gold);
  font-weight: 600;
}
.timeline-item h4 { font-size: 1rem; margin: 5px 0; }
.timeline-item p { font-size: 0.85rem; color: var(--text-light); }

/* ── Year Sections ── */
.year-section { margin: 30px 0; }
.year-section h2 {
  font-family: 'Noto Kufi Arabic', sans-serif;
  font-size: 1.8rem; color: var(--primary);
  margin-bottom: 20px;
  text-align: center;
}
.year-section .month-name {
  font-size: 1.2rem; font-weight: 700;
  color: var(--accent);
  margin: 20px 0 10px;
  padding-right: 10px;
  border-right: 4px solid var(--accent);
}

/* ── Footer ── */
.footer {
  background: var(--primary-dark);
  color: #aaa;
  padding: 30px 0;
  margin-top: 50px;
  border-top: 4px solid var(--accent);
  text-align: center;
}
.footer .container {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
}
.footer h3 { color: white; font-size: 1.1rem; margin-bottom: 5px; }
.footer p { font-size: 0.85rem; }
.footer .ai-note {
  margin-top: 15px; font-size: 0.8rem;
  color: var(--accent-light);
}
.footer .powered {
  margin-top: 8px; font-size: 0.75rem;
  color: #666;
}

/* ── Loading ── */
.loading {
  text-align: center; padding: 40px;
  color: var(--text-light);
}
.loading::after {
  content: '';
  display: inline-block;
  width: 30px; height: 30px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-top: 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 24px; border-radius: var(--radius);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem; font-weight: 600;
  border: none; cursor: pointer;
  transition: var(--transition);
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: var(--primary-dark); }
.btn-accent:hover { background: var(--accent-light); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

/* ── Admin ── */
.admin-body { background: #f0f2f5; direction: rtl; }
.admin-header {
  background: var(--primary-dark);
  color: white; padding: 15px 20px;
  display: flex; justify-content: space-between; align-items: center;
}
.admin-header h1 { font-size: 1.1rem; font-family: 'Noto Kufi Arabic', sans-serif; }
.admin-header .user-info { display: flex; align-items: center; gap: 15px; font-size: 0.85rem; }
.admin-nav {
  background: white;
  display: flex; border-bottom: 2px solid var(--border);
  padding: 0 10px;
}
.admin-nav a {
  padding: 12px 20px; font-size: 0.85rem;
  color: var(--text); font-weight: 500;
  border-bottom: 3px solid transparent;
}
.admin-nav a:hover, .admin-nav a.active {
  color: var(--primary);
  border-bottom-color: var(--accent);
}
.admin-content { padding: 20px; max-width: 1200px; margin: 0 auto; }

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 15px; margin-bottom: 25px;
}
.admin-stat {
  background: white; border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.admin-stat .num { font-size: 2rem; font-weight: 800; color: var(--primary); }
.admin-stat .lbl { font-size: 0.85rem; color: var(--text-light); }

.admin-card {
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  margin-bottom: 20px;
}
.admin-card-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
}
.admin-card-body { padding: 20px; }

.table {
  width: 100%; border-collapse: collapse;
}
.table th, .table td {
  padding: 10px 12px; text-align: right;
  border-bottom: 1px solid #eee;
  font-size: 0.85rem;
}
.table th { background: #f8f9fa; font-weight: 600; color: var(--text); }
.table tr:hover { background: #f8f9fa; }

.status-badge {
  display: inline-block;
  padding: 3px 10px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 600;
}
.status-badge.published { background: #dcfce7; color: #166534; }
.status-badge.draft { background: #f3f4f6; color: #6b7280; }
.status-badge.review { background: #fef3c7; color: #92400e; }
.status-badge.rejected { background: #fee2e2; color: #991b1b; }

/* ── Form Elements ── */
.form-group { margin-bottom: 15px; }
.form-group label {
  display: block; font-weight: 600;
  margin-bottom: 5px; font-size: 0.9rem;
}
.form-control {
  width: 100%; padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem;
  transition: var(--transition);
  background: white;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200,169,81,0.2);
}
textarea.form-control { min-height: 120px; resize: vertical; }
select.form-control { cursor: pointer; }

/* ── Alert ── */
.alert {
  padding: 12px 18px; border-radius: var(--radius);
  margin-bottom: 15px; font-size: 0.9rem;
  display: flex; align-items: center; gap: 10px;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; pointer-events: none;
  transition: var(--transition);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: white; border-radius: var(--radius);
  max-width: 600px; width: 90%;
  max-height: 80vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(0.9); transition: var(--transition);
}
.modal-overlay.active .modal { transform: scale(1); }
.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── Search ── */
.search-box {
  display: flex; gap: 10px;
  margin: 20px 0;
}
.search-box input {
  flex: 1; padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Tajawal', sans-serif;
  font-size: 0.9rem;
}
.search-box input:focus { outline: none; border-color: var(--accent); }

/* ── Media Gallery ── */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
}
.gallery-item {
  position: relative; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  aspect-ratio: 4/3; background: #eee;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--border);
  min-height: 150px;
}
.gallery-item .placeholder-icon {
  font-size: 3rem; opacity: 0.3;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
  .header .logo { font-size: 1.5rem; }
  .hero-card { padding: 25px; min-height: 250px; }
  .hero-card h2 { font-size: 1.4rem; }
  .nav { overflow-x: auto; }
  .nav .container { flex-wrap: nowrap; }
  .nav a { padding: 10px 12px; font-size: 0.8rem; }
  .news-grid { grid-template-columns: 1fr; }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .top-bar .container { flex-direction: column; gap: 5px; }
  .header .logo { font-size: 1.2rem; }
  .header .subtitle { font-size: 0.85rem; }
  .hero-card { padding: 20px; min-height: 200px; }
  .hero-card h2 { font-size: 1.1rem; }
  .news-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .stats-bar { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr 1fr; }
  .search-box { flex-direction: column; }
}

/* ── Source & Importance Badges ── */
.source-badge, .imp-badge {
  display: inline-block;
  padding: 2px 10px; border-radius: 10px;
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.3px;
}
.source-badge.official { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.source-badge.social { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.source-badge.auto { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }
.imp-badge.high { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; animation: pulse-glow 2s ease-in-out infinite; }
.imp-badge.low { background: #f9fafb; color: #9ca3af; border: 1px solid #e5e7eb; }
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(251, 191, 36, 0); }
}

/* ── Official Hero Highlight ── */
.hero-official {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 100%) !important;
  border: 2px solid #fbbf24 !important;
  position: relative;
}
.hero-official::after {
  content: '📜 مصدر رسمي';
  position: absolute; top: 10px; left: 10px;
  background: #fbbf24; color: #064e3b;
  padding: 4px 14px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700;
}

/* ── Highlighted Card ── */
.card-highlight {
  border-right: 4px solid #fbbf24 !important;
  background: linear-gradient(to left, #fffbeb, white) !important;
}
.card-highlight .card-category {
  background: #fef3c7 !important;
  color: #92400e !important;
}

/* ── Card meta improvements ── */
.card-meta .ai-tag {
  background: #eef2ff; color: #4338ca;
  padding: 2px 8px; border-radius: 8px;
  font-size: 0.7rem;
}

/* ── Hero Meta Improvements ── */
.hero-meta span {
  background: rgba(255,255,255,0.1);
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
}
