/* ================== Reset & Base ================== */
* { margin:0; padding:0; box-sizing:border-box; }

html, body {
  height:100%;
  font-family:"Faruma", Arial, sans-serif;
  background: linear-gradient(165deg, #e8eef6 0%, #f4f7fb 45%, #fafbfc 100%);
  background-attachment: fixed;
  color:#111;
  overflow-x:hidden;
}
html { scroll-behavior:smooth; }

html:has(body.vaahaka-page) {
  overflow-x: visible;
}

body.vaahaka-page {
  overflow-x: visible;
}

/* Topbar */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 150px;
  height: 60px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
  border-bottom: 1px solid rgba(22, 84, 147, 0.14);
  box-shadow: 0 2px 14px rgba(22, 84, 147, 0.07);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 900;
}
.nav {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}
.nav a {
  font-size: 17px; 
  text-decoration: none;
  color: #486581;
  font-family: "Faruma", Arial, sans-serif;
  padding: 8px 14px;
  border-radius: 8px;
  border-bottom: none;
  line-height: 1.3;
  transition: color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}
.nav a:hover {
  color: #165493;
  background: rgba(22, 84, 147, 0.1);
}
.nav a.active,
.nav .active {
  color: #ffffff;
  background: linear-gradient(135deg, #165493 0%, #1e6aab 100%);
  box-shadow: 0 2px 10px rgba(22, 84, 147, 0.28);
}
.nav a.active:hover,
.nav .active:hover {
  color: #ffffff;
  background: linear-gradient(135deg, #1a5fa0 0%, #165493 100%);
}

/* Adjust main content so title isn't hidden */
main.content {
  margin-top: 72px;
  margin-right: 150px;
  padding: 28px 40px 48px;
  max-width: calc(100% - 150px);
  box-sizing: border-box;
}

#vaahakaTitle {
  margin: 0 0 20px;
  text-align: center;
}

/* Vaahaka sidebar — keep logo + name fixed, cart at bottom */
body.vaahaka-page .sidebar {
  overflow: visible;
  padding-bottom: 0;
}

body.vaahaka-page .sidebar .logo-area,
body.vaahaka-page .sidebar .extra-image {
  flex-shrink: 0;
}

body.vaahaka-page .cart-box {
  position: fixed;
  right: 22px;
  bottom: 48px;
  width: 126px;
  height: 40px;
  margin: 0;
  padding: 0 8px 0 12px;
  box-sizing: border-box;
  font-size: 11px;
  transform-origin: 70% 50%;
  clip-path: polygon(20px 0%, 100% 0%, 100% 100%, 20px 100%, 0% 50%);
  border-radius: 0;
  overflow: visible;
  animation: cartBreathe 2.8s ease-in-out infinite;
  z-index: 1100;
  cursor: pointer;
  will-change: transform, filter, box-shadow;
}

body.vaahaka-page .cart-box svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

body.vaahaka-page .cart-box #cartCount {
  display: inline-block;
  min-width: 1ch;
  text-align: center;
}

@keyframes cartBreathe {
  0%, 100% {
    transform: translateX(-28px) scale(1);
    filter: brightness(1) saturate(1);
    box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.2);
  }
  50% {
    transform: translateX(-28px) scale(1.05);
    filter: brightness(1.12) saturate(1.12);
    box-shadow: 0 0 14px 4px rgba(88, 166, 255, 0.45);
  }
}

.topbar .cart-box {
  display: none;
}

/* Shared cart button look */
.cart-box {
  background: linear-gradient(135deg, #58A6FF, #1f6feb);
  color: #fff;
  font-family: "Faruma", Arial, sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  gap: 4px;
}



/* ================== Topbar ================== */
.topbar {
  position:fixed;
  top:0; left:0; right:150px;
  height:60px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
  border-bottom: 1px solid rgba(22, 84, 147, 0.14);
  box-shadow: 0 2px 14px rgba(22, 84, 147, 0.07);
  display:flex;
  align-items:center;
  padding:0 24px;
  z-index:900;
}
.nav {
  margin-left:auto;
  display:flex;
  gap:6px;
  align-items:center;
}
.nav a {
  text-decoration:none;
  font-size:17px;
  font-family:"Faruma", Arial, sans-serif;
  color:#486581;
  padding:8px 14px;
  border-radius:8px;
  border-bottom:none;
  line-height:1.3;
  transition:color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}
.nav a:hover {
  color:#165493;
  background:rgba(22, 84, 147, 0.1);
}
.nav a.active,
.nav .active {
  color:#ffffff;
  background:linear-gradient(135deg, #165493 0%, #1e6aab 100%);
  box-shadow:0 2px 10px rgba(22, 84, 147, 0.28);
}
.nav a.active:hover,
.nav .active:hover {
  color:#ffffff;
  background:linear-gradient(135deg, #1a5fa0 0%, #165493 100%);
}

/* ================== Page Title ================== */

/* ================== Grid ================== */
#vaahakaGrid {
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:30px;
  max-width:100%;
  width:100%;
  margin:24px auto 60px;
  margin-right:0;
  padding:0 24px;
  justify-items:center;
  box-sizing:border-box;
}
.story-card {
  border: 1px solid #ccc;
  border-radius: 12px;
  padding: 8px;
  background: #fff;
  text-align: center;
  display: inline-grid;
  grid-template-columns: max-content;
  justify-items: stretch;
  font-family: "Faruma", Arial, sans-serif;
  box-sizing: border-box;
}

.story-card .cover-wrap {
  display: block;
  line-height: 0;
  justify-self: center;
  margin-bottom: 10px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.story-card .cover-wrap img {
  display: block;
  width: auto;
  height: auto;
  max-height: 260px;
  max-width: 220px;
}

.story-card h3 {
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  color: #1f84e8;
  margin: 6px 0 2px;
  word-break: break-word;
}

.story-card .price {
  width: 100%;
  box-sizing: border-box;
  color:#e63946;
  font-weight:bold;
  margin: 0 0 6px;
}

.story-card .add-cart {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  font-size: 12px;
  padding: 7px 4px;
  white-space: normal;
  line-height: 1.35;
}

/* Add-to-Cart Button inside book */
.add-cart {
  background: linear-gradient(135deg,#63a4e6,#1d5082);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;

  display: inline-flex;          /* ✅ inline so it sizes naturally */
  flex-direction: row;           /* ✅ force text + icon side by side */
  align-items: center;           /* ✅ vertical alignment */
  justify-content: center;       /* ✅ center content */
  gap: 6px;                      /* ✅ space between icon and text */

  font-family: "Faruma", Arial, sans-serif;
  font-size: 15px;
  line-height: 1;                /* ✅ avoids extra vertical spacing */
  white-space: nowrap;           /* ✅ prevent breaking into 2 lines */
  transition: all 0.25s ease;
}

.add-cart:hover {
  background: linear-gradient(135deg,#0e3c6a,#7daddc);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}



/* Optional subtle pulse if you want book buttons animated too */
@keyframes addCartPulse {
  0%, 100% { filter: brightness(1) saturate(1); }
  50%      { filter: brightness(1.25) saturate(1.15); }
}
.add-cart.pulse {
  animation: addCartPulse 1.8s ease-in-out infinite;
}

.add-cart:hover {
  background:linear-gradient(135deg,#0e3c6a,#165493);
}

/* ================== Book download (after approval) ================== */
.story-card .book-download-btn {
  width: 100%;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #0e6b3a;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-family: "Faruma", Arial, sans-serif;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  animation: bookDownloadPulse 2s ease-in-out infinite;
}

.story-card .book-download-btn:hover {
  background: #0a5230;
  transform: scale(1.04);
}

@keyframes bookDownloadPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(14, 107, 58, 0.4); }
  50% { box-shadow: 0 0 12px 3px rgba(14, 107, 58, 0.55); }
}

/* ================== Order unlock bar ================== */
.order-unlock-bar {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(22, 84, 147, 0.2);
  border-radius: 12px;
  padding: 16px 20px;
  margin: 0 auto 24px;
  max-width: 640px;
  text-align: right;
  font-family: "Faruma", Arial, sans-serif;
}

.order-unlock-bar .unlock-title {
  font-weight: bold;
  color: #165493;
  margin: 0 0 6px;
}

.order-unlock-bar .unlock-hint {
  font-size: 14px;
  color: #555;
  margin: 0 0 12px;
}

.order-unlock-bar .unlock-row {
  display: flex;
  gap: 8px;
  flex-direction: row-reverse;
}

.order-unlock-bar input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #bbb;
  border-radius: 6px;
  font-size: 14px;
}

.order-unlock-bar button {
  background: #165493;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  cursor: pointer;
  font-family: "Faruma", Arial, sans-serif;
  white-space: nowrap;
}

.order-unlock-bar button:hover { background: #0e3c6a; }

.order-unlock-bar .order-status-msg {
  margin: 10px 0 0;
  font-size: 14px;
  color: #165493;
  min-height: 1.2em;
}

/* ================== Cart Popup ================== */
#cartPopup {
  display:none;
  position:fixed;
  top:50%; left:50%;
  transform:translate(-50%,-50%);
  background:#fff;
  border:1px solid #ccc;
  border-radius:8px;
  padding:20px;
  z-index:2000;
  width:400px; max-width:90%;
  box-shadow:0 8px 30px rgba(0,0,0,.3);
  font-family:"Faruma", Arial, sans-serif;
}
#popupCartItems li {
  display:flex;
  align-items:center;
  gap:14px;
  margin-bottom:10px;
}
#popupCartItems img {
  width:40px; height:50px;
  border:1px solid #ccc;
}
#popupCartTotal {
  font-weight:bold;
  color:#e63946;
  margin-top:10px;
  text-align:center;
}

/* ================== Checkout Form ================== */
#checkoutForm {
  margin-top:15px;
  text-align:left;
  direction:ltr;
}
#checkoutForm label {
  display:block;
  margin:6px 0 4px;
  font-size:14px;
}
#checkoutForm input {
  width:100%;
  padding:6px;
  margin-bottom:10px;
  border:1px solid #ccc;
  border-radius:4px;
  font-family:"Faruma", Arial, sans-serif;
}
#checkoutCart {
  background:green;
  color:#fff;
  border:none;
  padding:12px 16px;
  border-radius:6px;
  cursor:pointer;
  margin-top:5px;
  width:100%;
  font-size:16px;
  font-family:"Faruma", Arial, sans-serif;
}
#closeCart {
  background:#165493;
  color:#fff;
  border:none;
  padding:8px 14px;
  border-radius:6px;
  cursor:pointer;
  margin-top:12px;
  font-size:14px;
  display:block;
  margin-left:auto;
  margin-right:auto;
  font-family:"Faruma", Arial, sans-serif;
}

/* ================== Payment Popup (bank transfer) ================== */
#paymentPopup {
  display:none;
  position:fixed;
  top:50%; left:50%;
  transform:translate(-50%,-50%);
  background:#fff;
  border:1px solid #ccc;
  border-radius:10px;
  padding:24px 20px;
  width:400px; max-width:92%;
  text-align:center;
  box-shadow:0 8px 25px rgba(0,0,0,0.4);
  font-family:"Faruma", Arial, sans-serif;
  z-index:3000;
}
#paymentPopupTitle {
  color:#165493;
  font-size:20px;
  margin:0 0 14px;
}
#paymentPopup .bank-details {
  text-align:right;
  direction:rtl;
  margin-bottom:12px;
}
#paymentPopup .bank-dl {
  margin:0;
  font-size:14px;
}
#paymentPopup .bank-dl dt {
  color:#666;
  font-size:12px;
  margin-top:8px;
}
#paymentPopup .bank-dl dd {
  margin:2px 0 0;
  font-weight:bold;
  color:#111;
}
#paymentPopup .copy-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  direction:ltr;
}
#paymentPopup .copy-btn {
  flex-shrink:0;
  background:#eee;
  border:1px solid #ccc;
  border-radius:4px;
  padding:2px 8px;
  font-size:12px;
  cursor:pointer;
  font-family:"Faruma", Arial, sans-serif;
}
#paymentPopup .order-ref {
  font-size:13px;
  color:#b45309;
  font-weight:bold;
  margin:10px 0;
  line-height:1.5;
}
#paymentPopup .payment-note {
  font-size:13px;
  color:#444;
  font-weight:normal;
  line-height:1.6;
  margin-bottom:14px;
}
#paymentPopup .whatsapp-btn {
  display:inline-block;
  margin:8px 0 12px;
  background:#25D366;
  color:#fff;
  padding:10px 18px;
  border-radius:6px;
  text-decoration:none;
  font-size:15px;
  font-family:"Faruma", Arial, sans-serif;
  text-decoration:none;
}
#closePaymentPopup {
  background:#165493;
  color:#fff;
  border:none;
  padding:10px 18px;
  border-radius:6px;
  cursor:pointer;
  font-size:14px;
  margin-top:12px;
  font-family:"Faruma", Arial, sans-serif;
}

#vaahakaTitle {
  margin: 0 0 20px;
  text-align: center;
}

#vaahakaGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: 60px;
  row-gap: 50px;
  max-width: 100%;
  width: 100%;
  margin: 24px auto 60px;
  padding: 0 24px;
  justify-items: center;
  box-sizing: border-box;
}

/* ================== Topbar (duplicate block — keep in sync) ================== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 150px;
  height: 60px;             /* exact same as main page */
  background: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
  border-bottom: 1px solid rgba(22, 84, 147, 0.14);
  box-shadow: 0 2px 14px rgba(22, 84, 147, 0.07);
  display: flex;
  align-items: center;      /* center nav vertically */
  padding: 0 24px;
  z-index: 900;
}

/* ================== Nav ================== */
.nav {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

.nav a {
  text-decoration: none;
  font-size: 17px;
  font-family: "Faruma", Arial, sans-serif;
  color: #486581;
  line-height: 1.3;
  padding: 8px 14px;
  border-radius: 8px;
  border-bottom: none;
  display: flex;
  align-items: center;
  transition: color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.nav a:hover {
  color: #165493;
  background: rgba(22, 84, 147, 0.1);
}

.nav a.active,
.nav .active {
  color: #ffffff;
  background: linear-gradient(135deg, #165493 0%, #1e6aab 100%);
  box-shadow: 0 2px 10px rgba(22, 84, 147, 0.28);
}

.nav a.active:hover,
.nav .active:hover {
  color: #ffffff;
  background: linear-gradient(135deg, #1a5fa0 0%, #165493 100%);
}
