/* ═══════════════════════════════════════════════════════════════
   شبكة الامير التعليمية — النمط الرئيسي
   ثيم: ذهبي × رخامي أبيض  |  Arabic RTL  |  Mobile-first
   ═══════════════════════════════════════════════════════════════ */

/* ── المتغيرات ───────────────────────────────────────────────── */
:root {
  --gold:          #C9A227;
  --gold-light:    #E8C84A;
  --gold-dark:     #9A7A1A;
  --gold-subtle:   rgba(201,162,39,.10);
  --gold-border:   rgba(201,162,39,.30);

  --bg:            #FAFAF8;
  --site-background: radial-gradient(ellipse at 100% 0%, rgba(201,162,39,.13), transparent 46%), var(--surface);
  --surface:       #FFFFFF;
  --surface2:      #F5F2EB;
  --nav-bg:        #FFFFFF;
  --text:          #1A1A1A;
  --text-muted:    #6B6450;
  --border:        #E8E0CC;
  --shadow:        rgba(0,0,0,.07);
  --marble-vein:   rgba(201,162,39,.06);
  --radius:        14px;
  --radius-sm:     8px;

  --font:          'Cairo', sans-serif;
  --transition:    .22s ease;
}

/* ── أساس ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--site-background);
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
}

body > * { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }
.hidden { display: none !important; }

/* ── شريط التنقل ─────────────────────────────────────────────── */
.navbar {
  background: var(--nav-bg);
  border-bottom: 2px solid var(--gold-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(201,162,39,.10);
}

.navbar--home {
  --home-search-input-height: 52px;
  display: grid;
  /* The transparent second row keeps document geometry stable during scrolling. */
  grid-template-rows: auto calc(var(--home-search-input-height) + 1.75rem + 2px);
  background: transparent;
  border-bottom: 0;
  box-shadow: none;
  pointer-events: none;
}
.navbar--home .nav-top {
  grid-row: 1;
  position: relative;
  z-index: 2;
  background: var(--nav-bg);
  box-shadow: 0 2px 16px rgba(201,162,39,.10);
  pointer-events: auto;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.nav-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 50%;
  background: transparent;
}

.nav-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.nav-title small {
  font-size: .72rem;
  font-weight: 400;
  color: var(--gold);
  display: block;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--gold-subtle); color: var(--gold); }

.bot-btn {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--gold);
  color: #111;
  font-size: .82rem;
  font-weight: 700;
  padding: .42rem .9rem;
  border-radius: 20px;
  transition: background var(--transition), transform .15s;
  white-space: nowrap;
}
.bot-btn:hover { background: var(--gold-light); transform: scale(1.03); }

/* ── شريط البحث ──────────────────────────────────────────────── */
.search-bar {
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: none;
  padding: .6rem 1rem;
}
.search-bar.open { display: block; }
.search-bar--persistent {
  display: block;
  grid-row: 2;
  align-self: start;
  min-width: 0;
  position: relative;
  z-index: 1;
  padding: .75rem 1rem 1rem;
  background: linear-gradient(180deg, #fff 0%, #FBF7EE 100%);
  border-bottom: 1px solid var(--gold-border);
  opacity: 1;
  visibility: visible;
  transform: translate3d(0, 0, 0);
  transition: transform .22s ease-out, opacity .22s ease-out, visibility 0s;
  will-change: opacity, transform;
  pointer-events: auto;
}
.home-search-toggle {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(.88);
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
.navbar.home-search-collapsed .home-search-toggle {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: scale(1);
  transition-delay: 0s;
}
.navbar.home-search-collapsed .search-bar--persistent {
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, -12px, 0);
  transition: transform .22s ease-out, opacity .22s ease-out, visibility 0s linear .22s;
  pointer-events: none;
}
.search-bar--persistent #search-input {
  min-height: var(--home-search-input-height, 52px);
  border: 2px solid var(--gold);
  background: #fff;
  box-shadow: 0 4px 16px rgba(201,162,39,.14);
  font-weight: 600;
}
@media (prefers-reduced-motion: reduce) {
  .home-search-toggle,
  .search-bar--persistent,
  .navbar.home-search-collapsed .search-bar--persistent,
  .navbar.home-search-collapsed .home-search-toggle {
    transition-duration: .01ms;
    transition-delay: 0s;
  }
}

.search-inner {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  right: .9rem;
  width: 18px;
  height: 18px;
  color: var(--gold);
  pointer-events: none;
  flex-shrink: 0;
}

#search-input {
  width: 100%;
  padding: .7rem 2.8rem .7rem 2.5rem;
  border-radius: 24px;
  border: 1.5px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--font);
  font-size: .95rem;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
#search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-subtle);
}
#search-input::placeholder { color: var(--text-muted); }

.clear-btn {
  position: absolute;
  left: .7rem;
  color: var(--text-muted);
  font-size: .9rem;
  padding: .2rem .4rem;
}
.clear-btn:hover { color: var(--text); }

.search-results {
  max-width: 700px;
  margin: .5rem auto 0;
  background: var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px var(--shadow);
}
.search-results:empty { display: none; }

.search-result-item {
  display: block;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: .9rem;
  transition: background var(--transition);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--gold-subtle); color: var(--gold); }
.search-result-subtitle {
  display: block;
  margin-top: .2rem;
  color: var(--text-muted);
  font-size: .76rem;
  line-height: 1.5;
}

/* ── Layout ──────────────────────────────────────────────────── */
.main-content { flex: 1; }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
}
.mb-4 { margin-bottom: 1.5rem; }

/* ── Hero (رخامي ذهبي) ───────────────────────────────────────── */
.hero {
  background:
    linear-gradient(135deg, #fff 0%, #FBF7EE 40%, #F7F0DC 60%, #fff 100%);
  border-bottom: 2px solid var(--gold-border);
  padding: 2.5rem 1rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}
/* بريق رخامي خفيف */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(201,162,39,.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(201,162,39,.06) 0%, transparent 50%);
}
.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.hero-inner { position: relative; }

.hero-title {
  font-size: 1.7rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 50%, var(--gold-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: .4rem;
  text-shadow: none;
}
.hero-sub {
  font-size: .95rem;
  color: var(--text-muted);
}

/* ── زر الرجوع ───────────────────────────────────────────────── */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface);
  border: 1.5px solid var(--border);
  padding: .42rem 1rem;
  border-radius: 20px;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: .9rem;
  font-family: var(--font);
}
.back-btn:hover {
  color: var(--gold);
  border-color: var(--gold-border);
  background: var(--gold-subtle);
  transform: translateX(2px);
}
.back-btn svg { width: 16px; height: 16px; }

/* ── Breadcrumb ──────────────────────────────────────────────── */
.breadcrumb {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: .6rem 0;
}
.breadcrumb .container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .25rem;
  padding-top: .3rem;
  padding-bottom: .3rem;
}
.bc-item {
  font-size: .82rem;
  color: var(--text-muted);
  transition: color var(--transition);
}
.bc-item:hover { color: var(--gold); }
.bc-current { color: var(--text); font-weight: 600; }
.bc-sep {
  font-size: .75rem;
  color: var(--gold);
  margin: 0 .1rem;
}

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  padding: 1.2rem 0 1rem;
  border-bottom: 2px solid var(--gold-border);
  margin-bottom: 1.2rem;
}
.page-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
}
.result-count {
  font-size: .82rem;
  color: var(--gold);
  background: var(--gold-subtle);
  padding: .25rem .75rem;
  border-radius: 20px;
  border: 1px solid var(--gold-border);
}
.gold { color: var(--gold); }

/* ── Section ─────────────────────────────────────────────────── */
.section { padding: 1.2rem 0; }
.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  position: relative;
  padding-right: .75rem;
}
.section-title::before {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 70%;
  background: linear-gradient(to bottom, var(--gold-light), var(--gold-dark));
  border-radius: 4px;
}

/* ── Category Cards ──────────────────────────────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
}
@media(min-width:540px) { .cat-grid { grid-template-columns: repeat(3, 1fr); } }
@media(min-width:760px) { .cat-grid { grid-template-columns: repeat(4, 1fr); } }

.cat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem .75rem 1rem;
  text-align: center;
  transition: border-color var(--transition), box-shadow var(--transition), transform .15s;
  position: relative;
  overflow: hidden;
}
.cat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold-light), var(--gold-dark));
  transform: scaleX(0);
  transition: transform var(--transition);
}
.cat-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(201,162,39,.15);
}
.cat-card:hover::before { transform: scaleX(1); }

.cat-card--sm { flex-direction: row; justify-content: flex-start; gap: .6rem; padding: .9rem 1rem; }
.cat-card--sm .cat-arrow { margin-right: auto; }

.cat-icon { font-size: 1.8rem; }
.cat-card--sm .cat-icon { font-size: 1.3rem; }

.cat-label {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}
.cat-card--sm .cat-label { font-size: .9rem; }

.cat-arrow { font-size: .75rem; color: var(--gold); }

/* ── Notes List ──────────────────────────────────────────────── */
.notes-list {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.latest-additions-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
  margin: 1.25rem 0 .25rem;
}
.latest-load-more {
  min-height: 46px;
  padding: .65rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: .92rem;
  font-weight: 700;
  transition: border-color var(--transition), background var(--transition),
    color var(--transition), transform .15s, opacity var(--transition);
}
.latest-load-more:hover:not(:disabled) {
  border-color: var(--gold);
  background: var(--gold);
  color: #111;
}
.latest-load-more:active:not(:disabled) { transform: scale(.98); }
.latest-load-more:disabled { cursor: wait; opacity: .7; }
.latest-load-more[hidden],
.latest-load-sentinel[hidden] { display: none; }
.latest-load-status {
  min-height: 1.4em;
  margin: 0;
  color: var(--text-muted);
  font-size: .85rem;
  text-align: center;
}
.latest-load-sentinel { height: 1px; }

.note-card {
  display: flex;
  align-items: flex-start;
  gap: .9rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem;
  transition: border-color var(--transition), box-shadow var(--transition), transform .15s;
  position: relative;
}
.note-card::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, var(--gold-light), var(--gold-dark));
  border-radius: 0 var(--radius) var(--radius) 0;
  transform: scaleY(0);
  transition: transform var(--transition);
}
.note-card:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 20px rgba(201,162,39,.13);
  transform: translateX(-2px);
}
.note-card:hover::after { transform: scaleY(1); }

/* thumbnail */
.note-thumb {
  flex-shrink: 0;
  width: 72px;
  height: 90px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.note-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.note-thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gold-subtle), var(--surface2));
  border: 1px solid var(--gold-border);
}
.note-thumb-placeholder span {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--gold);
}

/* note info */
.note-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.note-top {
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  flex-wrap: wrap;
}

.note-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  flex: 1;
}

.badge {
  flex-shrink: 0;
  font-size: .68rem;
  font-weight: 700;
  padding: .2rem .5rem;
  border-radius: 20px;
  line-height: 1;
  margin-top: .1rem;
}
.badge--new {
  background: #E8F5E1;
  color: #2D6A1E;
  border: 1px solid #B8DFA8;
}
.note-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .6rem;
}
.meta-item {
  display: flex;
  align-items: center;
  gap: .2rem;
  font-size: .78rem;
  color: var(--text-muted);
}
.meta-stars { color: #E8A020; letter-spacing: .05em; }
.meta-val { font-weight: 600; color: var(--text); }
.meta-dim { color: var(--text-muted); }

.note-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .2rem;
}
.open-btn {
  font-size: .78rem;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-subtle);
  border: 1px solid var(--gold-border);
  padding: .3rem .75rem;
  border-radius: 20px;
  transition: background var(--transition), color var(--transition);
}
.note-card:hover .open-btn { background: var(--gold); color: #111; }

.share-btn-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: color var(--transition), border-color var(--transition);
}
.share-btn-sm svg { width: 14px; height: 14px; }
.share-btn-sm:hover { color: var(--gold); border-color: var(--gold); }

/* ── Note Detail ─────────────────────────────────────────────── */
.note-detail {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem 0 1rem;
}
@media(min-width:600px) {
  .note-detail { flex-direction: row; align-items: flex-start; }
  .note-cover { flex-shrink: 0; width: 220px; }
}

.note-cover {
  border-radius: var(--radius);
  overflow: hidden;
  border: 2px solid var(--gold-border);
  box-shadow: 0 8px 32px rgba(201,162,39,.15);
}
.cover-img { width: 100%; display: block; object-fit: cover; min-height: 200px; }
.cover-placeholder {
  background: linear-gradient(135deg, #FBF7EE 0%, #F5ECD0 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: 2.5rem 1rem;
  min-height: 200px;
}
.cover-letter {
  font-size: 3rem;
  font-weight: 900;
  color: var(--gold);
}
.cover-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.note-detail-info { flex: 1; }

.detail-title {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.4;
  margin-bottom: .75rem;
  color: var(--text);
}

.detail-rating {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}
.rating-stars { display: flex; gap: .1rem; }
.star { font-size: 1.1rem; }
.star--full { color: #E8A020; }
.star--half { color: #E8A020; }
.star--empty { color: #ccc; }
.rating-score { font-weight: 700; color: var(--text); font-size: .9rem; }
.rating-count { font-size: .8rem; color: var(--text-muted); }
.no-rating { font-size: .85rem; color: var(--text-muted); margin-bottom: .75rem; }

.detail-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.stat-item {
  display: flex;
  align-items: center;
  gap: .35rem;
  background: var(--gold-subtle);
  border: 1px solid var(--gold-border);
  padding: .4rem .9rem;
  border-radius: 20px;
}
.stat-icon { font-size: 1rem; }
.stat-val { font-weight: 700; font-size: .9rem; }
.stat-label { font-size: .78rem; color: var(--text-muted); }

.note-preview {
  background: var(--surface2);
  border-right: 3px solid var(--gold);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: .9rem 1rem;
  margin-bottom: 1.2rem;
}
.preview-title {
  font-size: .85rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: .4rem;
}
.preview-text {
  font-size: .88rem;
  color: var(--text-muted);
  line-height: 1.7;
  white-space: pre-line;
}

.detail-actions {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--font);
  font-weight: 700;
  font-size: .9rem;
  padding: .65rem 1.4rem;
  border-radius: 24px;
  transition: background var(--transition), transform .15s, box-shadow var(--transition);
  cursor: pointer;
  border: none;
}
.btn:hover { transform: scale(1.03); }
.btn:active { transform: scale(.98); }

.btn--primary {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 50%, var(--gold-light) 100%);
  color: #111;
  box-shadow: 0 3px 12px rgba(201,162,39,.30);
}
.btn--primary:hover {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
  box-shadow: 0 5px 20px rgba(201,162,39,.40);
}

.btn--outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn--outline:hover { border-color: var(--gold); color: var(--gold); }

.btn--lg { font-size: 1rem; padding: .8rem 1.8rem; }

/* ── Preview Gallery ─────────────────────────────────────────── */
.preview-section { margin-top: 2rem; }
.preview-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .6rem;
  margin-top: .75rem;
}
@media(min-width:480px) { .preview-gallery { grid-template-columns: repeat(3, 1fr); } }
.gallery-item {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 3/4;
  background: var(--surface2);
}
.gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.gallery-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  background: var(--gold-subtle);
  border: 1.5px dashed var(--gold-border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  aspect-ratio: 3/4;
}
.gallery-more p { font-size: 1.1rem; font-weight: 700; color: var(--gold); }
.gallery-more a { font-size: .8rem; color: var(--text-muted); }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
}
.empty-icon { font-size: 3rem; }
.empty-state p { color: var(--text-muted); font-size: .95rem; }

.bot-cta {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #111;
  font-weight: 700;
  font-size: .9rem;
  padding: .6rem 1.4rem;
  border-radius: 24px;
  margin-top: .5rem;
  box-shadow: 0 3px 12px rgba(201,162,39,.25);
}
.bot-cta:hover { background: linear-gradient(135deg, var(--gold), var(--gold-light)); }

/* ── Footer ──────────────────────────────────────────────────── */
.footer {
  background: linear-gradient(135deg, #1A1400 0%, #111 100%);
  border-top: 2px solid var(--gold-border);
  padding: 2rem 1rem;
  text-align: center;
  margin-top: auto;
}
.footer-inner { max-width: 600px; margin: 0 auto; }
.footer-brand {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: .3rem;
}
.footer-sub { font-size: .82rem; color: #888; margin-bottom: .75rem; }
.footer-bot-link {
  font-size: .85rem;
  color: var(--gold);
  opacity: .8;
  transition: opacity var(--transition);
}
.footer-bot-link:hover { opacity: 1; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--surface);
  color: var(--gold);
  border: 1px solid var(--gold-border);
  padding: .65rem 1.5rem;
  border-radius: 24px;
  font-size: .9rem;
  font-weight: 600;
  box-shadow: 0 4px 20px var(--shadow);
  transition: transform .3s ease;
  z-index: 1000;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Loading shimmer ─────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.shimmer {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--surface) 50%, var(--surface2) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.6s infinite;
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--gold-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ── Gallery overlay ─────────────────────────────────────────── */
.gallery-item {
  position: relative;
  cursor: zoom-in;
}
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
  border-radius: var(--radius-sm);
  font-size: 1.5rem;
}
.gallery-item:hover .gallery-overlay { opacity: 1; }

/* ── Lightbox ────────────────────────────────────────────────── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 500;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: .75rem;
}
.lightbox.open { display: flex; }

.lightbox #lb-img {
  max-width: min(90vw, 800px);
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius);
  border: 2px solid var(--gold-border);
  box-shadow: 0 0 60px rgba(0,0,0,.6);
}

.lb-close {
  position: absolute;
  top: 1rem;
  left: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.lb-close:hover { background: rgba(255,255,255,.25); }

.lb-prev, .lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}
.lb-prev { right: 1rem; }
.lb-next { left: 1rem; }
.lb-prev:hover, .lb-next:hover { background: rgba(201,162,39,.5); }

.lb-counter {
  color: rgba(255,255,255,.6);
  font-size: .82rem;
  margin: 0;
}

/* ── ملفات الملزمة المتعددة ───────────────────────────────────── */
.attachment-section { margin-top: 2rem; }
.attachment-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  height: 1.7rem;
  margin-inline-start: .35rem;
  padding: 0 .4rem;
  border-radius: 999px;
  background: var(--gold-subtle);
  color: var(--gold-dark);
  font-size: .8rem;
  vertical-align: middle;
}
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.attachment-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.attachment-card:hover {
  border-color: var(--gold-border);
  box-shadow: 0 4px 16px rgba(201,162,39,.10);
}
.attachment-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}
.attachment-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 2.25rem;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--gold-border);
  border-radius: 50%;
  background: var(--gold-subtle);
  color: var(--gold-dark);
  font-weight: 800;
}
.attachment-copy { min-width: 0; }
.attachment-title {
  color: var(--text);
  font-size: .95rem;
  font-weight: 700;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.attachment-meta {
  display: block;
  margin-top: .1rem;
  color: var(--text-muted);
  font-size: .78rem;
}
.attachment-open { flex-shrink: 0; white-space: nowrap; }

@media (max-width: 480px) {
  .attachment-card {
    align-items: stretch;
    flex-direction: column;
  }
  .attachment-open { justify-content: center; }
}

/* ── PDF section ─────────────────────────────────────────────── */
.pdf-section { margin-top: 2rem; }
.attachment-page-meta {
  color: var(--text-muted);
  font-size: .9rem;
  line-height: 1.7;
  margin: -.25rem 0 1rem;
}
.attachment-unavailable {
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-muted);
  line-height: 1.8;
  padding: 2rem;
  text-align: center;
}
.attachment-unavailable strong { color: var(--text); }
.attachment-unavailable p { margin: .5rem 0 0; }

.pdf-wrapper {
  border: 2px solid var(--gold-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface2);
  box-shadow: 0 4px 20px rgba(201,162,39,.10);
}

.pdf-embed {
  display: block;
  width: 100%;
  height: 75vh;
  min-height: 500px;
  border: none;
}

.pdf-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 3rem 1rem;
  text-align: center;
}
.pdf-icon { font-size: 3rem; }
.pdf-fallback p { color: var(--text-muted); }
