/* ===========================================================
   Shambani Heritage — Media Center page styles
   =========================================================== */

/* ---- Page hero ---- */
.media-hero {
  position: relative;
  color: #fff;
  padding: 160px 0 70px;
  text-align: center;
  overflow: hidden;
}
.media-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--media-hero-bg, none);
  background-size: cover;
  background-position: center;
}
.media-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, var(--c-primary) 0%, var(--c-bg-dark) 100%);
  opacity: var(--media-hero-overlay-opacity, 1);
}
.media-hero .container { position: relative; z-index: 1; }
.media-hero h1 {
  color: #fff;
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin: 14px 0 16px;
}
.media-hero p {
  max-width: 620px;
  margin: 0 auto;
  color: rgba(242,241,234,0.8);
  font-size: 1.05rem;
}

.media-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 40px;
  flex-wrap: wrap;
}
.media-stats .stat-num {
  display: block;
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
  color: var(--c-accent-light);
}
.media-stats .stat-label {
  font-size: 0.8rem;
  color: rgba(242,241,234,0.75);
}

/* ---- Config notice ---- */
.config-notice {
  background: #fdf3e0;
  border-bottom: 1px solid #f0ddb0;
  color: #7a5a12;
  padding: 14px 0;
  font-size: 0.9rem;
  text-align: center;
}
.config-notice code {
  background: rgba(0,0,0,0.06);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ---- Toolbar ---- */
.media-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 40px;
}

.media-tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.tab-btn {
  background: var(--c-bg-alt);
  border: 1px solid var(--c-border);
  color: var(--c-text-muted);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 10px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
}
.tab-btn:hover { border-color: var(--c-accent); color: var(--c-text); }
.tab-btn.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }

.admin-toggle { font-size: 0.85rem; padding: 10px 20px; }
.admin-toggle svg { width: 16px; height: 16px; }

/* ---- Loading / empty states ---- */
.media-loading, .media-empty {
  text-align: center;
  color: var(--c-text-muted);
  padding: 60px 0;
  font-size: 0.98rem;
}

/* ---- Gallery grid ---- */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.media-card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}
.media-card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }

.media-card .media-thumb {
  width: 100%;
  height: 190px;
  object-fit: cover;
  background: var(--c-bg-alt);
  cursor: pointer;
  display: block;
}

.media-card .video-thumb {
  position: relative;
  height: 190px;
  cursor: pointer;
  background: var(--c-bg-dark);
}
.media-card .video-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-card .play-badge {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.media-card .play-badge span {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgba(255,255,255,0.9);
  display: flex; align-items: center; justify-content: center;
}
.media-card .play-badge svg { width: 22px; height: 22px; color: var(--c-primary); margin-left: 3px; }

.media-card .doc-thumb {
  height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--c-bg-alt);
  color: var(--c-primary);
}
.media-card .doc-thumb svg { width: 44px; height: 44px; }
.media-card .doc-thumb span { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-text-muted); }

.media-card-body { padding: 16px 18px; }
.media-card-body h4 { font-size: 0.95rem; margin-bottom: 4px; line-height: 1.4; }
.media-card-body .media-date { font-size: 0.78rem; color: var(--c-text-muted); }

.media-card-body .doc-download {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px;
  font-size: 0.85rem; font-weight: 600;
  color: var(--c-primary);
}
.media-card-body .doc-download svg { width: 15px; height: 15px; }

.demo-badge {
  position: absolute;
  top: 10px; left: 10px;
  background: rgba(15,46,28,0.85);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  z-index: 2;
}

.media-delete {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(176, 58, 46, 0.92);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  border: none;
  cursor: pointer;
  z-index: 2;
}
.media-delete svg { width: 16px; height: 16px; }

/* ---- Admin overlay / panel ---- */
.admin-overlay {
  position: fixed; inset: 0;
  background: rgba(15,46,28,0.55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.admin-panel {
  background: #fff;
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 440px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}
.admin-panel h3 { font-size: 1.3rem; margin-bottom: 6px; }
.admin-panel > div > p { color: var(--c-text-muted); margin-bottom: 24px; font-size: 0.92rem; }

.admin-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--c-bg-alt);
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.admin-close svg { width: 16px; height: 16px; color: var(--c-text); }

#loginForm, #uploadForm { display: grid; gap: 18px; }

.admin-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--c-bg-alt);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 22px;
  font-size: 0.88rem;
}
.link-btn {
  background: none; border: none;
  color: var(--c-primary);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
}

.field-hint { font-size: 0.78rem; color: var(--c-text-muted); }

.upload-progress {
  height: 8px;
  background: var(--c-bg-alt);
  border-radius: 999px;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--c-accent);
  transition: width 0.2s ease;
}

/* ---- Lightbox ---- */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(10,20,14,0.92);
  z-index: 2100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.lightbox-content {
  max-width: min(90vw, 1000px);
  max-height: 78vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-content img, .lightbox-content video {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 8px;
}
.lightbox-caption {
  color: #fff;
  margin-top: 18px;
  font-size: 0.95rem;
  text-align: center;
}
.lightbox-close {
  position: absolute;
  top: 24px; right: 24px;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.lightbox-close svg { width: 18px; height: 18px; }

@media (max-width: 560px) {
  .media-hero { padding: 130px 0 50px; }
  .admin-panel { padding: 28px 22px; }
}

/* ===========================================================
   v3 — search, empty state, CTA, lightbox navigation
   =========================================================== */
.media-toolbar { gap: 16px; }
.tab-count { opacity: 0.65; font-weight: 500; margin-left: 2px; }
.tab-btn.active .tab-count { opacity: 0.85; }

.media-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  padding: 0 18px;
  min-width: 240px;
  transition: var(--transition);
}
.media-search:focus-within { border-color: var(--c-accent); box-shadow: 0 0 0 3px rgba(185, 143, 57, 0.15); }
.media-search svg { width: 18px; height: 18px; color: var(--c-text-muted); flex-shrink: 0; }
.media-search input {
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  padding: 11px 0;
  width: 100%;
  color: var(--c-text);
}

/* cards: the whole preview is a real button for keyboard users */
.media-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.media-open:focus-visible { outline-offset: -3px; }
.media-card .play-badge { display: flex; }
.media-card a.doc-thumb { text-decoration: none; }

.media-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 70px 20px;
  text-align: center;
}
.media-empty svg { width: 56px; height: 56px; color: var(--c-accent); }
.media-empty h3 { font-size: 1.3rem; }
.media-empty p { max-width: 460px; margin-bottom: 8px; }

/* call-to-action band */
.media-cta { background: var(--c-primary); color: #fff; padding: 64px 0; }
.media-cta-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}
.media-cta h2 { color: #fff; font-size: clamp(1.4rem, 3vw, 2rem); margin-bottom: 8px; }
.media-cta p { color: rgba(242, 241, 234, 0.82); max-width: 560px; }
.media-cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* lightbox prev / next */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.25); }
.lightbox-nav svg { width: 22px; height: 22px; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }
.lightbox-nav[hidden] { display: none; }

@media (max-width: 640px) {
  .media-search { width: 100%; }
  .lightbox-nav { width: 40px; height: 40px; top: auto; bottom: 28px; transform: none; }
  .lightbox-prev { left: 16px; }
  .lightbox-next { right: 16px; }
  .media-cta { padding: 48px 0; }
}
