:root {
  --bg-primary: #0F3D34;
  --bg-secondary: #0B2F2A;
  --accent-primary: #C9A24D;
  --accent-secondary: #D8BC7A;
  --text-color: #F5F1E8;
  --bg-decorative: #1E5A4A;
}

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

body {
  font-family: "Cairo", system-ui, "Noto Kufi Arabic", sans-serif;
  background: var(--bg-primary);
  color: var(--text-color);
  line-height: 1.8;
  direction: rtl;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

/* ── Header ── */
header {
  background: var(--bg-secondary);
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--accent-secondary);
}
header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
header h1 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-primary);
}
header a { color: var(--accent-primary); text-decoration: none; }
header nav { display: flex; gap: 1.2rem; font-size: 0.9rem; }
header nav a { color: var(--text-color); }
header nav a:hover { color: var(--accent-primary); }

/* ── Hero ── */
.hero {
  background: var(--bg-secondary);
  padding: 4rem 0 3.5rem;
  text-align: center;
  border-bottom: 1px solid var(--accent-secondary);
}
.hero h2 {
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 0.8rem;
}
.hero p {
  font-size: 1.1rem;
  color: var(--text-color);
  max-width: 600px;
  margin: 0 auto 2rem;
  opacity: 0.9;
}

/* ── About ── */
.about {
  padding: 3rem 0;
  border-bottom: 1px solid rgba(216, 188, 122, 0.15);
}
.about h3 {
  font-size: 1.4rem;
  color: var(--accent-primary);
  margin-bottom: 1rem;
  text-align: center;
}
.about p {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
  opacity: 0.85;
  font-size: 1rem;
}

/* ── CTA Section ── */
.cta-section {
  background: var(--bg-decorative);
  padding: 2.5rem 0;
  text-align: center;
  border-bottom: 1px solid rgba(216, 188, 122, 0.15);
}
.cta-section p {
  font-size: 1.05rem;
  margin-bottom: 1.2rem;
  opacity: 0.9;
}

/* ── Section title ── */
.section-title {
  font-size: 1.3rem;
  color: var(--accent-primary);
  text-align: center;
  margin: 2.5rem 0 1.5rem;
  font-weight: 700;
}

/* ── Search Bar ── */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.search-bar input,
.search-bar select {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--accent-secondary);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  direction: rtl;
  background: var(--bg-secondary);
  color: var(--text-color);
}
.search-bar input::placeholder { color: rgba(245, 241, 232, 0.45); }
.search-bar input[type="text"] { flex: 1; min-width: 200px; }
.search-bar select option { background: var(--bg-secondary); color: var(--text-color); }

/* ── Category Chips ── */
.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}
.cat-chip {
  padding: 0.35rem 0.9rem;
  border: 1px solid rgba(216, 188, 122, 0.35);
  border-radius: 20px;
  background: transparent;
  color: var(--accent-secondary);
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.cat-chip:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}
.cat-chip.active {
  background: var(--accent-primary);
  color: var(--bg-secondary);
  border-color: var(--accent-primary);
  font-weight: 700;
}
.cat-chip-clear {
  border-color: rgba(192, 57, 43, 0.4);
  color: #e74c3c;
  font-size: 0.8rem;
}
.cat-chip-clear:hover {
  border-color: #e74c3c;
  background: rgba(192, 57, 43, 0.15);
  color: #e74c3c;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 0.55rem 1.4rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  font-family: inherit;
  text-decoration: none;
  text-align: center;
}
.btn-primary {
  background: var(--accent-primary);
  color: var(--bg-secondary);
  font-weight: 700;
}
.btn-primary:hover { background: var(--accent-secondary); }
.btn-secondary {
  background: transparent;
  color: var(--accent-secondary);
  border: 1px solid var(--accent-secondary);
}
.btn-secondary:hover {
  background: var(--accent-secondary);
  color: var(--bg-secondary);
}

/* ── PDF Grid ── */
.pdf-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.pdf-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(216, 188, 122, 0.2);
  border-radius: 10px;
  padding: 1.5rem 1.3rem 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.8rem;
  transition: border-color 0.2s, transform 0.2s;
}
.pdf-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}
.pdf-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: rgba(201, 162, 77, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: var(--accent-primary);
  flex-shrink: 0;
}
.pdf-card-info { flex: 1; }
.pdf-card-info h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  line-height: 1.5;
}
.pdf-card-info h3 a {
  color: var(--text-color);
  text-decoration: none;
}
.pdf-card-info h3 a:hover { color: var(--accent-primary); }
.pdf-card .meta {
  color: var(--accent-secondary);
  font-size: 0.78rem;
  opacity: 0.8;
  margin-bottom: 0.2rem;
}
.pdf-card .actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
.pdf-card .actions .btn {
  font-size: 0.85rem;
  padding: 0.45rem 1rem;
}

/* ── Detail Page ── */
.detail {
  background: var(--bg-secondary);
  padding: 2rem;
  border-radius: 6px;
  border: 1px solid rgba(216, 188, 122, 0.2);
  margin: 2rem 0;
}
.detail h2 {
  color: var(--accent-primary);
  margin-bottom: 0.75rem;
  font-size: 1.5rem;
}
.detail .meta {
  color: var(--accent-secondary);
  margin-bottom: 1.2rem;
  font-size: 0.9rem;
  opacity: 0.8;
}
.detail-description {
  color: var(--text-color);
  opacity: 0.9;
  font-size: 0.95rem;
  line-height: 1.9;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: 6px;
  border: 1px solid rgba(216, 188, 122, 0.1);
  white-space: pre-wrap;
}
.detail .actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; flex-wrap: wrap; }

/* ── Detail Files List ── */
.detail-files {
  margin-top: 1.2rem;
}
.detail-files h3 {
  font-size: 1rem;
  color: var(--accent-primary);
  margin-bottom: 0.6rem;
}
.detail-file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  background: var(--bg-primary);
  border: 1px solid rgba(216, 188, 122, 0.12);
  border-radius: 6px;
  margin-bottom: 0.4rem;
}
.detail-file-row .file-name {
  font-weight: 700;
  font-size: 0.95rem;
}
.detail-file-row .file-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.82rem;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 2.5rem;
}
.pagination a {
  padding: 0.4rem 0.85rem;
  border: 1px solid rgba(216, 188, 122, 0.3);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-color);
  font-size: 0.9rem;
}
.pagination a:hover { border-color: var(--accent-primary); }
.pagination a.active {
  background: var(--accent-primary);
  color: var(--bg-secondary);
  border-color: var(--accent-primary);
  font-weight: 700;
}

/* ── Empty state ── */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--accent-secondary);
  opacity: 0.6;
}

/* ── Separator ── */
.separator {
  width: 60px;
  height: 2px;
  background: var(--accent-secondary);
  margin: 0 auto 1.2rem;
  opacity: 0.4;
}

/* ── Error Page ── */
.error-page {
  text-align: center;
  padding: 5rem 1rem;
}
.error-page .error-code {
  font-size: 6rem;
  font-weight: 700;
  color: var(--accent-primary);
  line-height: 1;
  margin-bottom: 0.5rem;
}
.error-page h2 {
  font-size: 1.4rem;
  color: var(--text-color);
  margin-bottom: 0.75rem;
}
.error-page p {
  color: var(--accent-secondary);
  opacity: 0.7;
  margin-bottom: 2rem;
  font-size: 1rem;
}

/* ── Thanks Page ── */
.thanks-intro {
  text-align: center;
  color: var(--accent-secondary);
  opacity: 0.85;
  margin-bottom: 2rem;
  font-size: 1rem;
}
/* View toggle */
.view-toggle {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}
.view-btn {
  background: var(--bg-secondary);
  border: 1px solid rgba(216, 188, 122, 0.2);
  color: var(--text-secondary);
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s;
}
.view-btn.active {
  background: var(--accent-primary);
  color: var(--bg-primary);
  border-color: var(--accent-primary);
}

/* List view (default) */
.contributors-list {
  display: flex;
  flex-direction: column;
  margin-bottom: 2.5rem;
}
.contributors-list .contributor-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.8rem;
  border-bottom: 1px solid rgba(216, 188, 122, 0.1);
}
.contributors-list .contributor-item:last-child {
  border-bottom: none;
}

/* Grid view */
.contributors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.6rem;
  margin-bottom: 2.5rem;
}
.contributors-grid .contributor-item {
  background: var(--bg-secondary);
  border: 1px solid rgba(216, 188, 122, 0.2);
  border-radius: 8px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.4rem;
}

.contributor-name {
  font-weight: 700;
  font-size: 0.95rem;
}
.contributor-link {
  color: var(--accent-primary);
  font-size: 0.8rem;
  text-decoration: none;
}
.contributor-link:hover {
  text-decoration: underline;
}

/* ── Footer ── */
footer {
  background: var(--bg-secondary);
  text-align: center;
  padding: 1.5rem 0;
  color: var(--accent-secondary);
  font-size: 0.82rem;
  margin-top: 3rem;
  border-top: 1px solid rgba(216, 188, 122, 0.15);
  opacity: 0.7;
}
