/* FILE: assets/css/modern.css — modern theme layer for the public site.
 *
 * Loads AFTER style.css and upgrades the look: brand color system,
 * glass navbar, animated gradient hero with floating orbs, 3D card
 * hovers, scroll-reveal animations, gradient buttons and footer.
 * All motion is transform/opacity only, RTL-safe (no directional
 * transforms), and disabled under prefers-reduced-motion.
 */

/* ============ 1. Brand tokens ============ */
:root {
  --brand-1: #4f46e5;              /* indigo  */
  --brand-2: #7c3aed;              /* violet  */
  --brand-3: #06b6d4;              /* cyan    */
  --brand-deep: #1e1b4b;           /* deep indigo for dark surfaces */
  --brand-ink: #0f0d2a;
  --brand-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #06b6d4 130%);
  --shadow-soft: 0 10px 30px rgba(30, 27, 75, 0.10);
  --shadow-lift: 0 22px 48px rgba(79, 70, 229, 0.25);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

html { scroll-behavior: smooth; }

body {
  background:
    radial-gradient(1200px 500px at 85% -5%, rgba(124, 58, 237, 0.06), transparent 60%),
    radial-gradient(1000px 480px at 8% 0%, rgba(6, 182, 212, 0.06), transparent 60%),
    #fbfbfe;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(124, 58, 237, 0.25); }

/* ============ 2. Buttons ============ */
.btn { transition: transform 0.22s var(--ease-out), box-shadow 0.22s var(--ease-out), filter 0.22s; }

.btn-primary {
  background: var(--brand-gradient);
  background-size: 150% 150%;
  border: 0;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
  position: relative;
  overflow: hidden;
}
.btn-primary:hover, .btn-primary:focus {
  filter: brightness(1.07);
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(79, 70, 229, 0.45);
  background-position: 90% 50%;
}
/* shine sweep */
.btn-primary::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  inset-inline-start: -70%;
  width: 45%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-18deg);
  transition: inset-inline-start 0.6s var(--ease-out);
  pointer-events: none;
}
.btn-primary:hover::after { inset-inline-start: 130%; }

.btn-outline-primary {
  color: var(--brand-1);
  border-color: var(--brand-1);
}
.btn-outline-primary:hover, .btn-outline-primary:focus {
  background: var(--brand-gradient);
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.35);
}

/* Buy Hard Copy — deep amber, deliberately darker than the yellow
   btn-warning it replaces, so the order action stands clearly apart
   from the blue Download (btn-primary) button beside it. */
.btn-hardcopy {
  background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
  border: 0;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(146, 64, 14, 0.35);
}
.btn-hardcopy:hover, .btn-hardcopy:focus {
  background: linear-gradient(135deg, #92400e 0%, #78350f 100%);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(146, 64, 14, 0.45);
}

/* ============ 3. Glass navbar ============ */
.main-navbar {
  background: rgba(255, 255, 255, 0.82) !important;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.3s, background 0.3s;
}
.main-navbar.navbar-scrolled {
  background: rgba(255, 255, 255, 0.95) !important;
  box-shadow: 0 8px 30px rgba(30, 27, 75, 0.12);
}
.navbar-brand { transition: transform 0.25s var(--ease-out); }
.navbar-brand:hover { transform: scale(1.04); }

.main-navbar .nav-link { position: relative; transition: color 0.2s; }
.main-navbar .nav-link::after {
  content: "";
  position: absolute;
  inset-inline: 0.9rem;
  bottom: 0.45rem;
  height: 2px;
  border-radius: 2px;
  background: var(--brand-gradient);
  transform: scaleX(0);
  transition: transform 0.28s var(--ease-out);
}
.main-navbar .nav-link:hover::after,
.main-navbar .nav-link.active::after { transform: scaleX(1); }
.main-navbar .nav-link.active { color: var(--brand-1) !important; }

/* top utility bar */
.topbar {
  background: linear-gradient(90deg, var(--brand-ink), #2a2560 60%, var(--brand-ink));
  background-size: 200% 100%;
  animation: topbarShift 14s ease-in-out infinite alternate;
}

/* ============ 4. Animated hero ============ */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(120deg, #312e81, #4f46e5 35%, #7c3aed 65%, #0e7490);
  background-size: 220% 220%;
  animation: heroFlow 16s ease-in-out infinite alternate;
  padding: 5.5rem 0;
}
/* floating orbs */
.hero::before, .hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  pointer-events: none;
}
.hero::before {
  width: 420px; height: 420px;
  background: #06b6d4;
  top: -140px; inset-inline-end: -100px;
  animation: orbFloat 11s ease-in-out infinite alternate;
}
.hero::after {
  width: 360px; height: 360px;
  background: #f472b6;
  bottom: -160px; inset-inline-start: -90px;
  animation: orbFloat 13s ease-in-out infinite alternate-reverse;
}
.hero .container { position: relative; z-index: 2; }

/* entrance */
.hero .row > * { animation: heroUp 0.9s var(--ease-out) both; }
.hero .row > *:nth-child(2) { animation-delay: 0.15s; }

.hero-title {
  font-size: clamp(2.4rem, 1.4rem + 3.2vw, 3.6rem);
  font-weight: 800;
  line-height: 1.15;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  letter-spacing: -0.01em;
}
.hero-subtitle {
  font-size: 1.15rem;
  max-width: 34rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}
.hero .btn { box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28); }
.hero .btn-outline-light {
  border-width: 2px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.hero .btn-outline-light:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.22); }

.hero-image {
  animation: heroImageFloat 7s ease-in-out infinite;
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s;
  transform: perspective(900px) rotateY(-4deg);
}
.hero-image:hover {
  transform: perspective(900px) rotateY(0deg) scale(1.03);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}

/* ============ 5. Section titles ============ */
.section-title {
  border-inline-start-color: var(--brand-1);
  transition: padding 0.3s var(--ease-out);
}
.section-title:hover { padding-inline-start: 1.1rem; }

/* ============ 6. Cards with 3D hover ============ */
.home-card, main .card {
  border: 0;
  border-radius: 1rem;
  box-shadow: var(--shadow-soft);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
  overflow: hidden;
}
.home-card:hover, main .card:hover {
  transform: perspective(1000px) rotateX(3deg) translateY(-8px);
  box-shadow: var(--shadow-lift);
}
.home-card .card-img-top, main .card .card-img-top {
  transition: transform 0.5s var(--ease-out);
}
.home-card:hover .card-img-top, main .card:hover .card-img-top { transform: scale(1.06); }

/* gradient accents for badges / highlights */
.badge.bg-primary, .bg-primary {
  background: var(--brand-gradient) !important;
}

/* pagination */
.page-item.active .page-link {
  background: var(--brand-gradient);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}
.page-link { color: var(--brand-1); transition: transform 0.2s, box-shadow 0.2s; }
.page-link:hover { color: var(--brand-2); transform: translateY(-1px); }

/* ============ 7. Scroll-reveal (JS adds .reveal, then .in) ============ */
.reveal {
  opacity: 0;
  translate: 0 26px;
  transition: opacity 0.7s var(--ease-out), translate 0.7s var(--ease-out);
  will-change: opacity, translate;
}
.reveal.in { opacity: 1; translate: 0 0; }

/* ============ 8. Footer ============ */
.site-footer {
  background: linear-gradient(165deg, #232052 0%, var(--brand-ink) 70%);
  position: relative;
  overflow: hidden;
}
.site-footer::before {
  content: "";
  position: absolute;
  top: 0; inset-inline: 0;
  height: 3px;
  background: var(--brand-gradient);
}
.footer-heading { position: relative; padding-bottom: 0.5rem; }
.footer-heading::after {
  content: "";
  position: absolute;
  bottom: 0; inset-inline-start: 0;
  width: 42px; height: 3px; border-radius: 3px;
  background: var(--brand-gradient);
}
.footer-links a { transition: color 0.2s, padding 0.25s var(--ease-out); }
.footer-links a:hover { color: #fff !important; padding-inline-start: 6px; }
.social-links a { transition: transform 0.25s var(--ease-out), background 0.25s, box-shadow 0.25s; }
.social-links a:hover {
  background: var(--brand-gradient);
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 8px 18px rgba(124, 58, 237, 0.45);
}
.footer-bottom { background: rgba(0, 0, 0, 0.35); }

/* ============ 9. Forms ============ */
.form-control, .form-select {
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s var(--ease-out);
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 0.25rem rgba(124, 58, 237, 0.18);
}

/* ============ 10. Wallet donate cards (support page) ============ */
.wallet-card { border-top: 4px solid var(--wallet-color, var(--brand-1)); }
.wallet-icon { color: var(--wallet-color, var(--brand-1)); }
.wallet-number { letter-spacing: 0.05em; }
.wallet-copy-btn {
  background: var(--wallet-color, var(--brand-1));
  color: #fff;
  border: 0;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}
.wallet-copy-btn:hover, .wallet-copy-btn:focus {
  color: #fff;
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}
.wallet-copy-btn.copied-ok { filter: brightness(1.12); }

/* ============ 11. Back to top ============ */.back-to-top {
  background: var(--brand-gradient);
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.45);
}
.back-to-top:hover { background: var(--brand-gradient); filter: brightness(1.1); }

/* ============ 12. Keyframes ============ */
@keyframes heroFlow {
  from { background-position: 0% 40%; }
  to   { background-position: 100% 60%; }
}
@keyframes orbFloat {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(0, 46px, 0) scale(1.12); }
}
@keyframes heroUp {
  from { opacity: 0; translate: 0 30px; }
  to   { opacity: 1; translate: 0 0; }
}
@keyframes heroImageFloat {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 -12px; }
}
@keyframes topbarShift {
  from { background-position: 0% 0; }
  to   { background-position: 100% 0; }
}

/* ============ 13. Reduced motion: calm everything down ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; translate: 0 0; }
}

/* ============ 14. Reader features ============ */
/* Share buttons */
.share-buttons { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.share-label { font-weight: 600; color: var(--bs-secondary-color, #6c757d); margin-inline-end: 0.25rem; }
.share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  color: #fff; font-size: 1.1rem; text-decoration: none;
  transition: transform 0.2s var(--ease-out), filter 0.2s;
}
.share-btn:hover { transform: translateY(-2px); filter: brightness(1.12); color: #fff; }
.share-wa { background: #25d366; }
.share-fb { background: #1877f2; }
.share-x { background: #14171a; }
.share-copy { background: #6c757d; }
.share-copy.copied { background: #198754; }

/* Stars (average + per-review) */
.stars { color: #f5a623; letter-spacing: 0.12em; white-space: nowrap; }
.rating-summary { display: inline-flex; align-items: center; gap: 0.4rem; }

/* Tappable star input (radio group, works LTR + RTL) */
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 0.2rem; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { cursor: pointer; font-size: 1.8rem; color: #ced4da; line-height: 1; margin: 0; }
.star-input label:hover, .star-input label:hover ~ label,
.star-input input:checked ~ label { color: #f5a623; }

/* Comments + reviews */
.comment-item {
  border: 1px solid var(--bs-border-color, #dee2e6); border-radius: 0.75rem;
  padding: 1rem 1.25rem; margin-bottom: 1rem; background: var(--bs-body-bg, #fff);
}
.comment-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.comment-head .bi-person-circle { font-size: 1.4rem; color: var(--bs-secondary-color, #6c757d); }
.comment-form, .reader-flash { max-width: 640px; }

/* Quote of the day */
.quote-section { background: linear-gradient(180deg, rgba(79, 70, 229, 0.07), transparent); }
.quote-mark { font-size: 3rem; color: var(--brand-1); opacity: 0.35; line-height: 1; }
.daily-quote p { font-size: 1.5rem; font-weight: 500; line-height: 1.6; }
.daily-quote footer { margin-top: 0.75rem; color: var(--bs-secondary-color, #6c757d); font-size: 1.05rem; }
html[dir="rtl"] .daily-quote p { line-height: 2.2; }

/* Poll */
.poll-card { border-top: 4px solid var(--brand-1); }
.poll-option { padding: 0.45rem 0.75rem; border-radius: 0.5rem; }
.poll-option:hover { background: rgba(79, 70, 229, 0.07); }
.poll-result-row { margin-bottom: 0.65rem; }
.poll-bar {
  height: 10px; border-radius: 6px; margin-top: 0.25rem; overflow: hidden;
  background: var(--bs-secondary-bg, #e9ecef);
}
.poll-bar span {
  display: block; height: 100%; border-radius: 6px;
  background: var(--brand-gradient);
  transition: width 0.8s var(--ease-out);
}

/* ============ 15. Dark mode ============ */
[data-bs-theme="dark"] body { background-color: #101216; }
[data-bs-theme="dark"] .main-navbar { background: #171a1f; }
[data-bs-theme="dark"] .main-navbar .nav-link { color: #ced4da; }
[data-bs-theme="dark"] .main-navbar .nav-link.active { color: #8ab4ff !important; }
[data-bs-theme="dark"] .navbar-brand { color: #f1f3f5; }
[data-bs-theme="dark"] .text-dark { color: #e9ecef !important; }
[data-bs-theme="dark"] .bg-light { background-color: #16181d !important; }
[data-bs-theme="dark"] .card { background-color: #1a1d23; border-color: #2b303a; }
[data-bs-theme="dark"] .section-title { color: #f1f3f5; }
[data-bs-theme="dark"] .sidebar-widget .card-header { background: #22262e; color: #e9ecef; }
[data-bs-theme="dark"] .sidebar-widget .list-group-item { background-color: #1a1d23; border-color: #2b303a; }
[data-bs-theme="dark"] .sidebar-widget .list-group-item a { color: #e9ecef; }
[data-bs-theme="dark"] .comment-item { background: #1a1d23; }
[data-bs-theme="dark"] .quote-section { background: linear-gradient(180deg, rgba(79, 70, 229, 0.14), transparent); }
[data-bs-theme="dark"] .share-x { background: #e9ecef; color: #14171a; }
[data-bs-theme="dark"] .share-x:hover { color: #14171a; }
[data-bs-theme="dark"] .star-input label { color: #495057; }
[data-bs-theme="dark"] .poll-option:hover { background: rgba(79, 70, 229, 0.16); }
[data-bs-theme="dark"] .breadcrumb-item.active { color: #adb5bd; }

/* ============ 3D book covers ============ */
.book3d-wrap { display: block; padding: 10px 32px 4px; perspective: 1100px; }
a:has(> .book3d-wrap) { display: block; }
.book3d {
  position: relative; display: block; line-height: 0;
  transform: rotateY(24deg);
  transform-style: preserve-3d;
  transition: transform .45s cubic-bezier(.2,.7,.3,1.15);
}
.book3d img { display: block; width: 100%; height: auto; border-radius: 2px 6px 6px 2px; }
/* keep the 3D geometry intact when cards zoom their images on hover */
.home-card:hover .book3d img.book-cover,
main .card:hover .book3d img.book-cover { transform: none; }
/* spine (left edge, recedes back) */
.book3d::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 34px;
  background: linear-gradient(105deg, #1e1e2a 0%, #45455e 50%, #1e1e2a 100%);
  border-radius: 3px 0 0 3px;
  transform: rotateY(84deg); transform-origin: left center;
}
/* page block (right edge, recedes back) */
.book3d::after {
  content: ""; position: absolute; top: 5px; bottom: 5px; right: 0; width: 30px;
  background: repeating-linear-gradient(90deg, #fbfaf5 0 2px, #ddd3ba 2px 4px);
  transform: rotateY(-84deg); transform-origin: right center;
}
/* soft floor shadow */
.book3d-wrap::after {
  content: ""; display: block; height: 20px; margin: 4px 10% 0;
  background: radial-gradient(ellipse at center, rgba(15,15,35,.38) 0%, transparent 70%);
  filter: blur(5px);
}
.book3d-wrap:hover .book3d { transform: rotateY(9deg) translateY(-6px); }
/* larger, more dramatic presentation (single book page) */
.book3d-wrap.book3d-large { padding: 14px 42px 6px; }
.book3d-large .book3d { transform: rotateY(28deg); }
.book3d-large .book3d::before { width: 44px; }
.book3d-large .book3d::after { width: 38px; }
.book3d-wrap.book3d-large:hover .book3d { transform: rotateY(11deg) translateY(-6px); }
/* RTL editions (Urdu/Sindhi): spine on the right */
[dir="rtl"] .book3d { transform: rotateY(-24deg); }
[dir="rtl"] .book3d img { border-radius: 6px 2px 2px 6px; }
[dir="rtl"] .book3d::before {
  left: auto; right: 0; border-radius: 0 3px 3px 0;
  transform: rotateY(-84deg); transform-origin: right center;
}
[dir="rtl"] .book3d::after {
  right: auto; left: 0;
  transform: rotateY(84deg); transform-origin: left center;
}
[dir="rtl"] .book3d-wrap:hover .book3d { transform: rotateY(-9deg) translateY(-6px); }
[dir="rtl"] .book3d-large .book3d { transform: rotateY(-28deg); }
[dir="rtl"] .book3d-wrap.book3d-large:hover .book3d { transform: rotateY(-11deg) translateY(-6px); }
@media (max-width: 576px) {
  .book3d-wrap { padding: 8px 20px 2px; }
  .book3d-wrap.book3d-large { padding: 10px 30px 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .book3d { transition: none; }
  .book3d-wrap:hover .book3d { transform: rotateY(24deg); }
  [dir="rtl"] .book3d-wrap:hover .book3d { transform: rotateY(-24deg); }
  .book3d-wrap.book3d-large:hover .book3d { transform: rotateY(28deg); }
  [dir="rtl"] .book3d-wrap.book3d-large:hover .book3d { transform: rotateY(-28deg); }
}
