/* ═══════════════════════════════════════════════════════════════════════════
   Divya Unmilan — components.css
   Preloader, top bar, navbar + mobile drawer, flash, cards, audio player,
   page hero, footer, back-to-top, pagination, error page.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Preloader ─────────────────────────────────────────────────────────── */
.preloader {
  position: fixed; inset: 0; z-index: 9999; background: var(--deep);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}
.preloader.hidden { opacity: 0; visibility: hidden; }
.preloader-symbol {
  width: 92px; height: 92px; color: var(--gold);
  animation: preloaderPulse 1.8s ease-in-out infinite;
}
.preloader-symbol svg { width: 100%; height: 100%; }
@keyframes preloaderPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.08); opacity: 0.7; } }
.no-js .preloader { display: none; }

/* ─── Top bar ───────────────────────────────────────────────────────────── */
.top-bar { background: var(--deep); color: var(--gold-light); font-size: 12px; letter-spacing: 0.5px; padding: 8px 0; }
.top-bar-inner {
  max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter);
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.top-bar-info { display: flex; gap: 22px; flex-wrap: wrap; }
.top-bar-info > * { display: inline-flex; align-items: center; gap: 6px; }
.top-bar a { color: var(--gold-light); text-decoration: none; transition: color 0.3s; }
.top-bar a:hover { color: #fff; }
.tb-ico { width: 12px; height: 12px; opacity: 0.8; }
.top-bar-social { display: flex; gap: 14px; }
.top-bar-social a { display: inline-flex; }
.top-bar-social svg { width: 14px; height: 14px; }
.brand-icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; }

/* ─── Navbar ────────────────────────────────────────────────────────────── */
.navbar {
  background: var(--ivory); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1000; transition: box-shadow 0.3s;
}
.navbar.scrolled { box-shadow: 0 4px 30px rgba(26, 20, 18, 0.08); }
.navbar-inner {
  max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between; height: 80px; gap: 24px;
}
.nav-logo { display: flex; align-items: center; gap: 14px; text-decoration: none; flex-shrink: 0; }
.nav-logo-icon {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--gold), var(--saffron));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 22px; color: #fff; font-weight: 700;
}
.nav-logo-img { width: 52px; height: 52px; object-fit: contain; }
.nav-logo-text { display: flex; flex-direction: column; }
.nav-logo-odia { font-family: var(--font-serif); font-size: 18px; font-weight: 600; color: var(--deep); line-height: 1.1; }
.nav-logo-en { font-size: 10px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--text-light); font-weight: 500; }
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links a {
  text-decoration: none; font-size: 12.5px; font-weight: 500; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--text-secondary); position: relative; padding: 4px 0; transition: color 0.3s; white-space: nowrap;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: -2px; left: 0; width: 0; height: 1.5px;
  background: var(--gold); transition: width 0.3s ease;
}
.nav-links a:hover, .nav-links a.active { color: var(--deep); }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.nav-icon-btn {
  width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text-secondary);
  transition: all 0.3s; text-decoration: none; position: relative;
}
.nav-icon-btn:hover { background: var(--cream); border-color: var(--gold); color: var(--deep); }
.nav-icon-btn svg { width: 16px; height: 16px; }
.nav-burger { display: none; width: 40px; height: 40px; border: 1px solid var(--border); border-radius: 50%; align-items: center; justify-content: center; }
.nav-burger svg { width: 18px; height: 18px; }

/* Mobile drawer */
.mobile-nav { position: fixed; inset: 0; z-index: 2000; visibility: hidden; }
.mobile-nav.open { visibility: visible; }
.mobile-nav-backdrop { position: absolute; inset: 0; background: rgba(26, 20, 18, 0.6); opacity: 0; transition: opacity 0.3s; }
.mobile-nav.open .mobile-nav-backdrop { opacity: 1; }
.mobile-nav-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 88vw); background: var(--ivory);
  transform: translateX(100%); transition: transform 0.4s var(--ease); display: flex; flex-direction: column; overflow-y: auto;
}
.mobile-nav.open .mobile-nav-panel { transform: none; }
.mobile-nav-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.mobile-nav-links { padding: 8px 0; }
.mobile-nav-links a {
  display: flex; justify-content: space-between; align-items: center; padding: 15px 24px;
  text-decoration: none; font-size: 13px; letter-spacing: 1px; text-transform: uppercase; font-weight: 500; color: var(--text-secondary);
  border-bottom: 1px solid var(--cream-dark);
}
.mobile-nav-links a.active, .mobile-nav-links a:hover { color: var(--deep); background: var(--cream); }
.mobile-nav-links svg { width: 16px; height: 16px; color: var(--gold); }
.mobile-nav-actions { padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.mobile-nav-foot { margin-top: auto; padding: 20px 24px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.mobile-nav-foot a { display: flex; gap: 8px; align-items: center; color: var(--text-secondary); text-decoration: none; }
.mobile-nav-foot svg { width: 14px; height: 14px; color: var(--gold); }
body.nav-open { overflow: hidden; }

/* ─── Flash messages ────────────────────────────────────────────────────── */
.flash-stack { position: fixed; top: 96px; right: 24px; z-index: 3000; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.flash {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: #fff; border-radius: 10px;
  border: 1px solid var(--border); border-left: 4px solid var(--gold); box-shadow: 0 12px 40px rgba(26, 20, 18, 0.15);
  font-size: 14px; color: var(--text-primary); animation: fadeInUp 0.4s var(--ease);
}
.flash svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.flash span { flex: 1; }
.flash-success { border-left-color: var(--success); } .flash-success > svg { color: var(--success); }
.flash-error { border-left-color: var(--danger); } .flash-error > svg { color: var(--danger); }
.flash-warning { border-left-color: var(--warning); } .flash-warning > svg { color: var(--warning); }
.flash-info { border-left-color: var(--deep-blue); } .flash-info > svg { color: var(--deep-blue); }
.flash-close { color: var(--text-light); display: inline-flex; }
.flash-close svg { width: 14px; height: 14px; }
.flash.out { opacity: 0; transform: translateX(20px); transition: all 0.3s; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */
.card {
  background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease); display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-card); border-color: #DFD2C0; }
.card-img { display: block; height: 200px; overflow: hidden; position: relative; background: var(--cream-dark); }
.card-img::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(26,20,18,.18), transparent 45%); opacity: 0; transition: opacity .4s; pointer-events: none; }
.card:hover .card-img::after { opacity: 1; }
.card-img-tall { height: 300px; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s; }
.card:hover .card-img img { transform: scale(1.06); }
.card-img-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--deep-blue), #3A5A7A); color: rgba(255, 255, 255, 0.3);
}
.card-img-placeholder svg { width: 48px; height: 48px; }
.card-img .badge { position: absolute; top: 16px; left: 16px; }
.card-img .badge-right { left: auto; right: 16px; }
.card-lock {
  position: absolute; top: 16px; right: 16px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(26, 20, 18, 0.7); color: var(--gold-light); display: flex; align-items: center; justify-content: center;
}
.card-lock svg { width: 13px; height: 13px; }
.card-body { padding: 24px; flex: 1; display: flex; flex-direction: column; }
.card-title { font-size: 22px; font-weight: 600; color: var(--deep); margin-bottom: 4px; }
.card-title a { text-decoration: none; color: inherit; }
.card-title a:hover { color: var(--saffron); }
.card-meta { font-size: 12px; color: var(--text-light); margin-bottom: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.card-meta svg { width: 12px; height: 12px; }
.card-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.6; margin-bottom: 20px; }
.card-link {
  display: inline-flex; align-items: center; gap: 8px; margin-top: auto;
  font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
  color: var(--saffron); text-decoration: none; transition: gap 0.3s;
}
.card-link:hover { gap: 14px; }
.card-link svg { width: 14px; height: 14px; }
.lib-card-compact .card-img { height: 160px; }
.lib-card-compact .card-body { padding: 20px; }
.lib-card-compact .card-title { font-size: 18px; }
.play-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(26, 20, 18, 0.3); opacity: 0; transition: opacity 0.3s;
}
.card:hover .play-overlay { opacity: 1; }
.play-icon {
  width: 48px; height: 48px; border-radius: 50%; background: var(--saffron); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(212, 120, 58, 0.4);
}
.play-icon svg { width: 18px; height: 18px; margin-left: 2px; fill: currentColor; }

/* Book card */
.book-price-row { display: flex; align-items: center; gap: 10px; margin-top: auto; flex-wrap: wrap; }
.price { font-family: var(--font-serif); font-size: 24px; font-weight: 700; color: var(--deep); }
.price-old { font-size: 13px; color: var(--text-light); text-decoration: line-through; }
.book-price-row form { margin-left: auto; }

/* ─── Audio player (compact) ────────────────────────────────────────────── */
.audio-player {
  width: 100%; height: 36px; border-radius: 18px; background: var(--cream);
  display: flex; align-items: center; padding: 0 12px; gap: 10px; margin-top: auto;
}
.audio-play-sm {
  width: 28px; height: 28px; border-radius: 50%; background: var(--saffron); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.audio-play-sm svg { width: 11px; height: 11px; fill: currentColor; margin-left: 1px; }
.audio-progress { flex: 1; height: 3px; background: var(--border); border-radius: 2px; position: relative; cursor: pointer; }
.audio-progress-fill { height: 100%; width: 0; background: var(--saffron); border-radius: 2px; transition: width 0.2s linear; }
.audio-time { font-size: 10px; color: var(--text-light); flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* ─── Page hero (inner pages) ───────────────────────────────────────────── */
.page-hero { position: relative; padding: 100px 0 80px; background: var(--deep); overflow: hidden; text-align: center; }
.page-hero-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(196, 149, 106, .12) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 30%, rgba(212, 120, 58, .08) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 90%, rgba(107, 45, 62, .1) 0%, transparent 50%);
}
.page-hero-grain, .hero-grain {
  position: absolute; inset: 0; opacity: .03; background-size: 200px;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.page-hero-line { position: absolute; top: 0; bottom: 0; width: 1px; background: linear-gradient(to bottom, transparent, var(--gold), transparent); opacity: .15; }
.page-hero-line.l { left: 80px; } .page-hero-line.r { right: 80px; }
.page-hero-inner { max-width: 800px; margin: 0 auto; position: relative; z-index: 2; padding: 0 var(--gutter); animation: fadeInUp 1s ease .2s both; }
.page-hero-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--gold); margin-bottom: 24px; font-weight: 500; }
.page-hero-tag-line { width: 40px; height: 1px; background: var(--gold); }
.page-hero-title { font-size: 56px; font-weight: 300; color: var(--cream); line-height: 1.15; margin-bottom: 16px; }
.page-hero-title-odia { display: block; font-size: 48px; font-weight: 500; color: #fff; margin-bottom: 6px; }
.page-hero-desc { font-size: 16px; color: rgba(255, 255, 255, .5); line-height: 1.7; max-width: 550px; margin: 0 auto; }
.page-hero-quote { font-family: var(--font-serif); font-size: 20px; font-style: italic; color: var(--gold-light); line-height: 1.6; max-width: 640px; margin: 8px auto 0; }
.page-hero-quote-author { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: rgba(255, 255, 255, .4); margin-top: 12px; }
.page-hero-breadcrumb { margin-top: 32px; font-size: 12px; color: rgba(255, 255, 255, .55); letter-spacing: 1px; }
.page-hero-breadcrumb a { color: var(--gold-light); text-decoration: none; transition: .3s; }
.page-hero-breadcrumb a:hover { color: #fff; }
.page-hero-breadcrumb .sep { margin: 0 8px; }
.page-hero-breadcrumb .current { color: var(--gold-light); }


/* ─── Footer ────────────────────────────────────────────────────────────── */
.footer { background: var(--deep-warm); color: rgba(255, 255, 255, .6); padding: 80px 0 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.5fr; gap: 48px; margin-bottom: 48px; }
.footer-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.footer-brand .nav-logo-icon { width: 48px; height: 48px; font-size: 20px; }
.footer-brand img { width: 48px; height: 48px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; }
.footer-brand-odia { display: block; font-family: var(--font-serif); font-size: 18px; color: var(--cream); font-weight: 600; }
.footer-brand-en { display: block; font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold-light); }
.footer-brand-desc { font-size: 13px; line-height: 1.7; margin-top: 20px; max-width: 300px; }
.footer-brand-desc strong { color: var(--cream); }
.footer-rni { font-size: 11px; color: rgba(255, 255, 255, .5); margin-top: 10px; letter-spacing: .5px; }
.footer-social { display: flex; gap: 12px; margin-top: 20px; }
.footer-social a { width: 36px; height: 36px; border: 1px solid rgba(196, 149, 106, .25); border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: .3s; color: var(--gold-light); }
.footer-social a:hover { background: var(--gold); border-color: var(--gold); color: var(--deep); }
.footer-social svg { width: 15px; height: 15px; }
.footer-heading { font-size: 18px; font-weight: 600; color: var(--gold); margin-bottom: 20px; }
.footer-links li { margin-bottom: 10px; }
.footer-links a { color: rgba(255, 255, 255, .5); text-decoration: none; font-size: 13px; transition: color .3s; }
.footer-links a:hover { color: var(--gold-light); }
.footer-contact-item { display: flex; gap: 10px; font-size: 13px; margin-bottom: 12px; align-items: flex-start; }
.footer-contact-item svg { width: 14px; height: 14px; color: var(--gold); flex-shrink: 0; margin-top: 3px; }
.footer-contact-item a { color: inherit; text-decoration: none; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .08); padding: 24px 0; font-size: 12px; color: rgba(255, 255, 255, .48); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-bottom strong { color: rgba(255, 255, 255, .5); }
.footer-payments { display: inline-flex; align-items: center; gap: 6px; }
.footer-payments svg { width: 14px; height: 14px; color: var(--sage); }

/* ─── Back to top ───────────────────────────────────────────────────────── */
.back-to-top {
  position: fixed; bottom: 32px; right: 32px; width: 48px; height: 48px; border-radius: 50%;
  background: var(--gold); color: var(--deep); display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: all .4s; z-index: 100; box-shadow: 0 8px 24px rgba(196, 149, 106, .3);
}
.back-to-top.show { opacity: 1; visibility: visible; }
.back-to-top:hover { background: var(--saffron); color: #fff; transform: translateY(-4px); }
.back-to-top svg { width: 18px; height: 18px; }

/* ─── Pagination ────────────────────────────────────────────────────────── */
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 56px; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 40px; height: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 20px; font-size: 13px; text-decoration: none; color: var(--text-secondary); transition: .3s;
}
.pagination a:hover { border-color: var(--gold); color: var(--deep); }
.pagination .current { background: var(--deep); color: var(--cream); border-color: var(--deep); }
.pagination svg { width: 14px; height: 14px; }

/* ─── Empty state ───────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty svg { width: 44px; height: 44px; color: var(--gold); margin: 0 auto 16px; }
.empty h3 { font-size: 24px; color: var(--deep); margin-bottom: 8px; }

/* ─── Error page ────────────────────────────────────────────────────────── */
.error-page { min-height: 70vh; display: flex; align-items: center; justify-content: center; background: var(--deep); text-align: center; padding: 80px var(--gutter); }
.error-symbol { color: var(--gold); opacity: .55; margin: 0 auto 4px; }
.error-symbol svg { width: 72px; height: 72px; margin: 0 auto; }
.error-code { font-family: var(--font-serif); font-size: 120px; font-weight: 300; color: var(--cream); line-height: 1; }
.error-title { font-size: 32px; color: var(--gold-light); font-weight: 400; margin-top: 8px; }
.error-message { color: rgba(255, 255, 255, .5); margin-top: 12px; max-width: 480px; margin-left: auto; margin-right: auto; }
.error-actions { display: flex; gap: 12px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.error-trace { text-align: left; margin-top: 40px; background: rgba(0, 0, 0, .4); color: #e8a06a; padding: 20px; border-radius: 8px; font-size: 12px; overflow: auto; max-width: 900px; }

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  .nav-links { gap: 18px; }
  .nav-links a { font-size: 11.5px; letter-spacing: .5px; }
  .nav-donate span { display: none; }
}
@media (max-width: 1024px) {
  .nav-links, .nav-login, .nav-donate { display: none; }
  .nav-burger { display: inline-flex; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .page-hero-line { display: none; }
}
@media (max-width: 768px) {
  .top-bar-inner { font-size: 10px; }
  .top-bar-info > :not(:first-child) { display: none; }
  .navbar-inner { height: 64px; }
  .nav-logo-icon { width: 42px; height: 42px; font-size: 18px; }
  .nav-logo-odia { font-size: 16px; }
  .page-hero { padding: 64px 0 56px; }
  .page-hero-title { font-size: 36px; }
  .page-hero-title-odia { font-size: 34px; }
  .footer-grid { grid-template-columns: 1fr; gap: 36px; }
  .footer-bottom { justify-content: center; text-align: center; }
  .flash-stack { top: 72px; right: 16px; }
  .back-to-top { bottom: 20px; right: 20px; width: 42px; height: 42px; }
  .error-code { font-size: 80px; }
}
@media (max-width: 480px) {
  .nav-logo-text { display: none; }
  .top-bar-social { display: none; }
}

/* ─── Print ─────────────────────────────────────────────────────────────────
   Policy pages and articles are often printed or saved as PDF. */
@media print {
  .top-bar, .navbar, .mobile-nav, .footer, .cta-strip, .back-to-top,
  .share-row, .preloader, .skip-link, .page-hero-breadcrumb, .flash-stack { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .page-hero { background: #fff; padding: 0 0 18pt; text-align: left; }
  .page-hero-bg, .page-hero-grain, .page-hero-line { display: none; }
  .page-hero-title, .page-hero-title-odia { color: #000; font-size: 22pt; }
  .page-hero-tag, .page-hero-desc { color: #444; }
  .section { padding: 0; }
  .prose { max-width: none; color: #000; }
  .prose a::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
  .card, .adm-card { break-inside: avoid; }
  a { text-decoration: underline; }
}
