/* 
 * ORGANIZED CSS STRUCTURE
 * 1. Variables
 * 2. Base Styles
 * 3. Typography
 * 4. Layout & Sections
 * 5. Components
 *    - Buttons
 *    - Cards
 *    - Navigation
 *    - Footer
 *    - Modals
 *    - Chat Interface
 *    - Story Display
 *    - Parameters & Form Elements
 *    - Progress Indicators
 *    - Audio Player
 *    - Book Reader (NEW)
 * 6. Utilities
 * 7. Animations
 * 8. Media Queries
 */

/* ======================
   1. Variables - Updated color scheme 
   ====================== */
:root {
  --c01: #0c6e7f;
  --c02: #0A5E6E;
  --c03: #FF6B35;
  --c04: #E85A2A;
  --c05: #D6A680;
  --c06: #E8C4A9;
  --c07: #061C27;
  --c08: #FFFFFF;
  --c09: #333333;
  --c10: #ccc;
  --c11: rgba(0,0,0,0.6);
  --c12: #fff;
  --c13: rgba(12, 110, 127, 0.5);
  --c14: rgba(0, 0, 0, 0.1);
  --c15: rgba(0, 0, 0, 0.2);
  --c16: rgba(46, 134, 171, 0.1);
  --c17: rgba(0, 0, 0, 0.15);
  --c18: rgba(0, 0, 0, 0.12);
  --c19: rgba(0, 0, 0, 0.03);
  --c20: rgba(0, 0, 0, 0.125);
  --c21: rgba(255, 255, 255, 0.1);
  --c22: rgba(0, 0, 0, 0.25);
  --c23: rgba(46, 134, 171, 0.3);
  --c24: rgba(255, 255, 255, 0.3);
  --c25: rgba(255, 255, 255, 1);
  --c26: rgba(6, 28, 39, 0.95);
  --c27: rgba(0, 0, 0, .45);
  --c28: rgba(255, 255, 255, .05);
  --c29: rgba(0, 0, 0, .35);
  --c30: #000;
  --c31: rgba(6, 28, 39, 0.96);
  --c32: rgba(255, 255, 255, .07);
  --c33: rgba(255, 255, 255, 0.05);
  --c34: #000000;
  --c35: #6c757d;
  --c36: rgba(0,0,0,0.2);
  --c37: #EFF7FB;
  --c38: #C7E4F2;
  --c39: #E6F7FF;
  --c40: #9FDDFF;
  --c41: #9E9EA1;
  --c42: rgba(255, 108, 53, 0.05);
  --c43: #F7FAFC;
  --c44: rgba(0,0,0,0.05);
  --c45: rgba(0,0,0,0.1);
  --c46: #333;
  --c47: rgba(12, 110, 127, 0.05);
  --c48: rgba(13, 110, 253, 0.1);
  --c49: #e9ecef;
  --c50: #dee2e6;
  --c51: #f8f9fa;
  --c52: #adb5bd;
  --c53: #212529;
  --c54: #495057;
  --c55: #dc3545;
  --c56: rgba(220, 53, 69, 0.25);
  --c57: #198754;
  --c58: #ddd;
  --c59: rgba(0, 0, 0, 0.3);
  --c60: #28a745;
  --c61: #fafafa;
  --c62: #f0f0f0;
  --c63: #999;
  --c64: #666;
  --c65: #f1f1f1;
  --c66: rgba(0, 0, 0, 0.05);
  --c67: rgba(12, 110, 127, 0.2);
  --c68: #D6E9F3;
  --c69: rgba(255, 107, 53, 0.7);
  --c70: rgba(255, 107, 53, 0);
  --c71: #e0e0e0;
  --c72: #f9f9f9;
  --c73: #f5f5f5;
  --c74: #555;
  --c75: #777;
  --c76: rgba(255, 107, 53, 0.2);
  --c77: #f5f7fa;
  --c78: #e4e7eb;
  --c79: rgba(0, 0, 0, 0.07);
  --c80: rgba(0, 0, 0, 0.09);
  --c81: #f3f6fb;
  --c82: rgba(232, 90, 42, 0.3);
  --c83: rgba(35, 108, 138, 0.4);
  --c84: rgba(255, 255, 255, 0);
  --c85: rgba(255, 255, 255, 0.5);
  --c86: rgba(255, 255, 255, 0.9);
  --c87: rgba(232, 90, 42, 0.5);
  --c88: rgba(255, 255, 255, 0.8);
  --c89: rgba(255, 255, 255, 0.2);
  --c90: #90EE90;
  --c91: #FFB6C1;
  --c92: rgba(255, 255, 255, 0.4);
  --c93: #1877F2;
  --c94: #1DA1F2;
  --c95: #0077B5;
  --c96: #00A8E8;
  --c97: #25D366;
  --c98: #0088CC;
  --c99: #f09433;
  --c100: #e6683c;
  --c101: #dc2743;
  --c102: #cc2366;
  --c103: #bc1888;
  --c104: rgba(0, 0, 0, 0.8);
  --c105: #c3cfe2;
  --c106: #667eea;
  --c107: #764ba2;
  --c108: #2d3748;
  --c109: #4a5568;
  --c110: #718096;
  --c111: rgba(0,0,0,.25);
  --c112: rgba(0,0,0,.35);
  --bs-primary: var(--c01) !important;
  --primary-color: var(--c01);
  --primary-dark: var(--c02);
  --secondary-color: var(--c03);
  --secondary-dark: var(--c04);
  --accent-color: var(--c05);
  --accent-light: var(--c06);
  --background-dark: var(--c07);
  --text-color: var(--c08);
  --card-bg: var(--c08);
  --card-text: var(--c09);
  /* One hex + one rgb value so you can recolour with ease */
  --plyx-highlight: var(--c01);          /* 👈 change this to any hex */
  --plyx-highlight-rgb: 12, 110, 127; /* …and update these three numbers */

  /* Feed Bootstrap utilities (.bg-primary, badges, buttons …) */
  --bs-primary-rgb: var(--plyx-highlight-rgb);
}

/* ======================
   2. Base Styles 
   ====================== */
html {
  height: 100%;
}

body {
  font-family: 'Manrope', sans-serif;
  background-color: var(--background-dark);
  color: white;
}

a {
  text-decoration: none;
}

/* Global animated link styling */
a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item) {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.3s ease, transform 0.2s ease;
  position: relative;
  display: inline-block;
}

a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item):hover {
  color: var(--secondary-color);
  transform: translateY(-2px);
}

a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item)::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--secondary-color);
  transition: width 0.3s ease;
}

a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item):hover::after {
  width: 100%;
}

/* For dark background sections like the footer, we need special styling */
.bg-dark a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item),
.footer a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item),
.section a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item) {
  color: white;
}

.bg-dark a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item):hover,
.footer a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item):hover,
.section a:not(.btn):not(.nav-link):not(.navbar-brand):not(.dropdown-item):hover {
  color: var(--secondary-color);
}

/* Exception class if you need to disable the effect on specific links */
a.no-animation {
  transition: none !important;
  transform: none !important;
}

a.no-animation::after {
  display: none !important;
}

/* ======================
   3. Typography 
   ====================== */
blockquote {
  border-left: 4px solid var(--c10);
  padding-left: 20px;
  margin-left: 20px;
  padding-bottom: 10px;
  font-style: italic;
  color: var(--primary-dark);
}

.typingText {
  font-family: "Indie Flower", cursive;
  font-weight: 400;
  font-style: normal;
  font-size: 25px;
  color: black;
}

/* ======================
   4. Layout & Sections 
   ====================== */
.section {
  padding: 64px 0;
  background-color: var(--background-dark);
}

.section h1 {
  color: white;
}

.section h2 {
  color: white;
  font-size: 36px;
  margin-bottom: 32px;
}

.section p {
  color: white;
  font-size: 18px;
  line-height: 1.5;
  margin-bottom: 32px;
}

.section a {
  color: white;
  font-size: 18px;
  font-weight: lighter;
  text-decoration: none;
}

.section a:hover {
  color: var(--primary-color);
}

/* Positioning */
.position-relative {
  position: relative;
}

.overlay-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  width: 100%;
  padding: 20px;
  text-shadow: 2px 2px 4px var(--c11); /* Keeping text shadow only for this overlay text */
}

/* ======================
   5. Components
   ====================== */

/* ---- Buttons ---- */
.button1 {
  background-color: transparent; 
  border: 1px solid white;
  color: white;
  font-size: 3vh;
  font-weight: lighter;
}

.button1:hover {
  background-color: var(--accent-color);
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  font-family: 'Manrope', sans-serif;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  color: white;
}

.btn-primary:disabled,
.btn-primary[disabled] {
  background-color: grey;
  border-color: grey;
  color: white;
  opacity: 0.65;
}

.btn-outline-primary {
  color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
}

.btn-outline-primary:checked + .btn,
.btn-outline-primary.active,
.btn-outline-primary:focus,
.btn-outline-primary:active,
.btn-outline-primary:hover,
.btn-check:checked + .btn-outline-primary {
  background-color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
  color: var(--c12) !important;
}

.btn-outline-primary:focus {
  box-shadow: 0 0 0 0.25rem var(--c13) !important;
}

.btn-check:focus + .btn-outline-primary,
.btn-check:active + .btn-outline-primary {
  background-color: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
  color: var(--c12) !important;
}

.btn-custom {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: white;
  transition: all 0.3s ease;
}

.btn-custom:hover {
  background-color: var(--secondary-dark);
  border-color: var(--secondary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--c14);
  color: white;
}

/* Pulsing button effect */
.pulsing-button {
  animation: pulse 2s infinite;
  background-color: var(--secondary-color);
  color: white;
  border: none;
}

.pulsing-button:hover {
  animation: none;
  background-color: var(--secondary-dark);
  color: white;
  box-shadow: 0 4px 8px var(--c15);
}

/* Reset Button */
#reset-chat-btn {
  border-color: var(--c13);
  color: var(--primary-color);
  background-color: white;
  transition: all 0.2s ease;
  padding: 0.375rem 0.5rem;
  height: 36px;
  width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px var(--c14);
}

#reset-chat-btn:hover {
  background-color: var(--c16);
  transform: scale(1.1);
  box-shadow: 0 4px 8px var(--c15);
}

/* Checkout button styling */
#checkout-button {
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: all 0.3s ease;
}

#checkout-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px var(--c17);
}

#checkout-button:active {
  transform: translateY(0);
}

/* ---- Cards ---- */
.card {
  background-color: white;
  transition: transform .2s;
  color: black;
  box-shadow: 0 4px 6px var(--c14);
  border: none;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px var(--c18);
}

.card label,
.card p,
.card div,
.card h1,
.card h2,
.card h3,
.card h4,
.card h5,
.card h6 {
  color: black;
}

.card_nohover:hover {
  transform: scale(1.00);
}

.card-header {
  background-color: var(--c19);
  border-bottom: 1px solid var(--c20);
}

/* Ensure all card headers with phoenix-header class have white text */
.card-header.phoenix-header h1,
.card-header.phoenix-header h2,
.card-header.phoenix-header h3,
.card-header.phoenix-header h4,
.card-header.phoenix-header h5,
.card-header.phoenix-header h6,
.card-header.phoenix-header .h1,
.card-header.phoenix-header .h2,
.card-header.phoenix-header .h3,
.card-header.phoenix-header .h4,
.card-header.phoenix-header .h5,
.card-header.phoenix-header .h6 {
  color: white;
}

/* Chat card enhancement for dark background */
.chat-card {
  border: 1px solid var(--c21);
  box-shadow: 0 8px 20px var(--c22);
}

/* Enhanced Phoenix Header */
.phoenix-header {
  position: relative;
  background: linear-gradient(135deg, var(--c01) 0%, var(--c02) 100%);
  color: white;
  border: none;
  overflow: hidden;
  padding: 1rem;
  border-top-left-radius: 0.375rem;
  border-top-right-radius: 0.375rem;
  box-shadow: 0 4px 15px var(--c23);
}

.phoenix-header-content {
  position: relative;
  z-index: 2;
}

.phoenix-header h5 {
  font-weight: 600;
  letter-spacing: 0.5px;
  color: white;
}

.phoenix-header-decoration {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjYwIiB2aWV3Qm94PSIwIDAgNTAwIDYwIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPg0KICA8cGF0aCBkPSJNNTAwIDYwSDBWMGg1MDB2NjB6IiBmaWxsPSJub25lIi8+DQogIDxjaXJjbGUgY3g9IjQ4MCIgY3k9IjEwIiByPSIzIiBmaWxsPSJyZ2JhKDI1NSwgMjU1LCAyNTUsIDAuNSkiIC8+DQogIDxjaXJjbGUgY3g9IjQ2MCIgY3k9IjMwIiByPSI0IiBmaWxsPSJyZ2JhKDI1NSwgMjU1LCAyNTUsIDAuNSkiIC8+DQogIDxjaXJjbGUgY3g9IjQ3MCIgY3k9IjUwIiByPSIzIiBmaWxsPSJyZ2JhKDI1NSwgMjU1LCAyNTUsIDAuNCkiIC8+DQogIDxjaXJjbGUgY3g9IjQ5MCIgY3k9IjM1IiByPSIyIiBmaWxsPSJyZ2JhKDI1NSwgMjU1LCAyNTUsIDAuNSkiIC8+DQogIDxjaXJjbGUgY3g9IjQ0MCIgY3k9IjE1IiByPSIyLjUiIGZpbGw9InJnYmEoMjU1LCAyNTUsIDI1NSwgMC40KSIgLz4NCiAgPGNpcmNsZSBjeD0iNDMwIiBjeT0iNDUiIHI9IjIuNSIgZmlsbD0icmdiYSgyNTUsIDI1NSwgMjU1LCAwLjQpIiAvPg0KICA8Y2lyY2xlIGN4PSI0MTAiIGN5PSIyNSIgcj0iMiIgZmlsbD0icmdiYSgyNTUsIDI1NSwgMjU1LCAwLjQpIiAvPg0KICA8Y2lyY2xlIGN4PSI0MDAiIGN5PSI1NSIgcj0iMyIgZmlsbD0icmdiYSgyNTUsIDI1NSwgMjU1LCAwLjMpIiAvPg0KICA8Y2lyY2xlIGN4PSIzODAiIGN5PSIyMCIgcj0iMiIgZmlsbD0icmdiYSgyNTUsIDI1NSwgMjU1LCAwLjM1KSIgLz4NCiAgPGNpcmNsZSBjeD0iMzcwIiBjeT0iNDAiIHI9IjIuNSIgZmlsbD0icmdiYSgyNTUsIDI1NSwgMjU1LCAwLjM1KSIgLz4NCiAgPGNpcmNsZSBjeD0iMzUwIiBjeT0iMTUiIHI9IjMiIGZpbGw9InJnYmEoMjU1LCAyNTUsIDI1NSwgMC4zKSIgLz4NCiAgPGNpcmNsZSBjeD0iMzQwIiBjeT0iMzUiIHI9IjIiIGZpbGw9InJnYmEoMjU1LCAyNTUsIDI1NSwgMC4zKSIgLz4NCiAgPGNpcmNsZSBjeD0iMzIwIiBjeT0iNDUiIHI9IjEuNSIgZmlsbD0icmdiYSgyNTUsIDI1NSwgMjU1LCAwLjI1KSIgLz4NCiAgPGNpcmNsZSBjeD0iMzAwIiBjeT0iMjUiIHI9IjIiIGZpbGw9InJnYmEoMjU1LCAyNTUsIDI1NSwgMC4yNSkiIC8+DQogIDxjaXJjbGUgY3g9IjI4MCIgY3k9IjE1IiByPSIyLjUiIGZpbGw9InJnYmEoMjU1LCAyNTUsIDI1NSwgMC4yKSIgLz4NCiAgPGNpcmNsZSBjeD0iMjYwIiBjeT0iMzUiIHI9IjEuNSIgZmlsbD0icmdiYSgyNTUsIDI1NSwgMjU1LCAwLjIpIiAvPg0KICA8Y2lyY2xlIGN4PSIyNDAiIGN5PSI1NSIgcj0iMiIgZmlsbD0icmdiYSgyNTUsIDI1NSwgMjU1LCAwLjE1KSIgLz4NCiAgPGNpcmNsZSBjeD0iMjIwIiBjeT0iMTUiIHI9IjIiIGZpbGw9InJnYmEoMjU1LCAyNTUsIDI1NSwgMC4xNSkiIC8+DQogIDxjaXJjbGUgY3g9IjIwMCIgY3k9IjI1IiByPSIxLjUiIGZpbGw9InJnYmEoMjU1LCAyNTUsIDI1NSwgMC4xKSIgLz4NCiAgPGNpcmNsZSBjeD0iMTgwIiBjeT0iNDUiIHI9IjEuNSIgZmlsbD0icmdiYSgyNTUsIDI1NSwgMjU1LCAwLjEpIiAvPg0KICA8Y2lyY2xlIGN4PSIxNjAiIGN5PSIzNSIgcj0iMiIgZmlsbD0icmdiYSgyNTUsIDI1NSwgMjU1LCAwLjA1KSIgLz4NCiAgPGNpcmNsZSBjeD0iMTQwIiBjeT0iMTUiIHI9IjEuNSIgZmlsbD0icmdiYSgyNTUsIDI1NSwgMjU1LCAwLjA1KSIgLz4NCiAgPGNpcmNsZSBjeD0iMTIwIiBjeT0iMjUiIHI9IjEuNSIgZmlsbD0icmdiYSgyNTUsIDI1NSwgMjU1LCAwLjA1KSIgLz4NCiAgPGNpcmNsZSBjeD0iMTAwIiBjeT0iNTUiIHI9IjIiIGZpbGw9InJnYmEoMjU1LCAyNTUsIDI1NSwgMC4wNSkiIC8+DQo8L3N2Zz4=');
  background-repeat: repeat-x;
  background-position: right center;
  mask-image: linear-gradient(to right, transparent 0%, var(--c24) 50%, var(--c25) 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, var(--c24) 50%, var(--c25) 100%);
}

/* RTL support for the header decoration */
html[dir="rtl"] .phoenix-header-decoration {
  mask-image: linear-gradient(to left, transparent 0%, var(--c24) 50%, var(--c25) 100%);
  -webkit-mask-image: linear-gradient(to left, transparent 0%, var(--c24) 50%, var(--c25) 100%);
  background-position: left center;
}

/* Library page styles */
.library-book-card {
  transition: all 0.2s ease-in-out;
}

/* Synopsis section */
.synopsis-section {
  clear: both;
  padding-top: 0.5rem;
  border-top: 1px solid var(--c14);
}

/* Cover image hover effect */
#books-container .card img.float-start {
  transition: transform 0.3s ease;
}

#books-container .card:hover img.float-start {
  transform: scale(1.03);
}

/* ============================================================
 * NAVIGATION  – unified & refreshed
 * ============================================================ */

/* --- Base colours -------------------------------------------------- */
.navbar-dark {
  color: var(--c12);
}

/* --- Main bar ------------------------------------------------------ */
#navbar {
  /* Less transparency + blur for legibility */
  background: var(--c26) !important;
  backdrop-filter: blur(6px);

  /* Keep it fixed at the top */
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1050;

  /* Soft shadow for visual separation */
  box-shadow: 0 2px 6px var(--c27);
}

/* Accent gradient line (mirrors footer) */
#navbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--secondary-color) 50%,
    var(--accent-color)
  );
  opacity: .85;
}

/* --- Links --------------------------------------------------------- */
#navbar .nav-link {
  padding: .5rem 1rem;
  transition: color .2s, background-color .2s;
}

#navbar .nav-link:hover {
  color: var(--accent-color);
  background-color: var(--c28);
  border-radius: .25rem;
}

/* --- Left-hand dropdown (unchanged) ------------------------------- */
#navbarLeftMenu {
  position: absolute;
  top: 65px;
  left: 10px;
  background-color: var(--c12);
  box-shadow: 0 8px 16px var(--c29);
  z-index: 1060;
  padding: 5px;
  border-radius: 5px;
  display: none;
}

#navbarLeftMenu.show { display: block; }

#navbarLeftMenu .nav-link { color: var(--c30) !important; }
#navbarLeftMenu .navbar-nav { flex-direction: column; }
#navbarLeftMenu .nav-item   { margin-bottom: .5rem; }

/* --- Generic dropdown menu ---------------------------------------- */
.dropdown-menu {
  max-height: 300px;
  overflow-y: auto;
}

/* --- Mobile collapse panel ---------------------------------------- */
@media (max-width: 991.98px) {
  .navbar-collapse.show {
    background: var(--c31);
    backdrop-filter: blur(8px);
    margin: 0 -1rem 1rem;
    padding: 1rem;
    border-radius: 0 0 .5rem .5rem;
    box-shadow: 0 8px 20px var(--c29);
  }

  .navbar-collapse.show .nav-link {
    color: var(--c12);
  }
  .navbar-collapse.show .nav-link:hover {
    color: var(--accent-color);
    background-color: var(--c32);
  }
}


/* ---- Footer ---- */
.footer {
  background-color: var(--background-dark);
  color: white;
  border-top: 1px solid var(--c33);
  width: 100%;
  /* Remove absolute positioning */
  position: static; /* This overrides the absolute positioning */
  margin-top: 2rem; /* Add some space above the footer */
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, 
    var(--primary-color), 
    var(--secondary-color) 50%, 
    var(--accent-color));
  opacity: 0.7;
}

.footer a {
  color: white;
  text-decoration: none;
  transition: color 0.3s ease, transform 0.2s ease;
  position: relative;
}

.footer a:hover {
  color: var(--secondary-color);
  transform: translateY(-2px);
}

.footer a::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--secondary-color);
  transition: width 0.3s ease;
}

.footer a:hover::after {
  width: 100%;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.server-info {
  font-family: monospace;
  letter-spacing: 0.5px;
}

.footer-decoration {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
  margin-left: auto;
  margin-right: 0;
}

/* For RTL support */
html[dir="rtl"] .footer-decoration {
  margin-left: 0;
  margin-right: auto;
}

/* ---- Modals ---- */
.modal-content,
.modal-content .modal-header,
.modal-content .modal-body,
.modal-content .modal-body label,
.modal-content .modal-body p,
.modal-content .modal-body div,
.modal-content .modal-body h1,
.modal-content .modal-body h2,
.modal-content .modal-body h3,
.modal-content .modal-body h4,
.modal-content .modal-body h5,
.modal-content .modal-body h6 {
  color: black;
}

.modal-content * {
  font-style: normal;
}

.gdpr-modal-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

#gdprAccordion {
  --bs-accordion-color: var(--c34);
}

#gdprAccordion .accordion-body p,
#gdprAccordion .accordion-header button {
  color: var(--c34);
}

/* Fix for modal flickering issue */
.modal-open .modal {
  z-index: 1060 !important; /* Ensure modal is above other elements */
}

/* This prevents hover effects on cards when modal is open */
.modal-open .card:hover {
  transform: none !important;
  box-shadow: 0 4px 6px var(--c14) !important;
}

/* Ensure modal backdrop is below modal but above other content */
.modal-backdrop {
  z-index: 1050 !important;
}

/* Make sure modal content receives the pointer events */
.modal-content {
  position: relative;
  z-index: 2;
  pointer-events: auto !important;
}

/* Modal footer button */
.btn-close-modal {
  background-color: var(--c35);
  color: white;
  border: none;
  border-radius: 0.25rem;
  padding: 0.5rem 1.5rem;
  font-weight: 500;
}

/* Modal Header Styling */
.phoenix-modal-header {
  background: linear-gradient(135deg, var(--c01) 0%, var(--c02) 100%);
  color: white;
  border: none;
}

.phoenix-modal-header .btn-close {
  filter: invert(1) brightness(200%);
}

.phoenix-modal-header .modal-title {
  font-weight: 600;
  color: white;
}

/* Enhanced Parameter Modal */
.parameters-modal {
  border: none;
  box-shadow: 0 10px 30px var(--c36);
}

/* Animation for the modal */
.modal.fade .modal-dialog {
  transform: scale(0.95);
  opacity: 0;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
}

.modal.show .modal-dialog {
  transform: scale(1);
  opacity: 1;
}

/* ---- Chat Interface ---- */
.bg-custom {
  background-color: var(--c10);
  color: white;
}

.chat-message {
  display: flex;
  margin-bottom: 15px;
  max-width: 85%;
  animation: fadeIn 0.3s ease;
}

.phoenix-message {
  align-self: flex-start;
}

.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
  margin-left: auto;
}

.message-avatar {
  flex-shrink: 0;
  margin: 0 10px;
}

.message-content {
  background-color: var(--c12);
  border-radius: 1rem;
  padding: 10px 15px;
  box-shadow: 0 1px 3px var(--c14);
}

.phoenix-message .message-content {
  background-color: var(--c37);
  border: 1px solid var(--c38);
}

.user-message .message-content {
  background-color: var(--c39);
  border: 1px solid var(--c40);
}

.message-content p {
  margin-bottom: 0.5rem;
}

.message-content p:last-child {
  margin-bottom: 0;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  padding: 10px 15px;
}

.typing-indicator span {
  height: 10px;
  width: 10px;
  background-color: var(--c41);
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
  animation: typing 1.5s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

.missing-param {
  border-left: 3px solid var(--secondary-color) !important;
  background-color: var(--c42);
}

#chat-input-area {
    width: 100%;
}

.input-container {
    min-width: 0; /* Critical for flex items to respect flex-grow */
}

#chat-input {
    min-width: 0; /* Critical for proper flex behavior in Firefox */
    flex-grow: 1;
}

/* Message preview box styling */
.message-preview-box {
  background-color: var(--c43);
  border-color: var(--c38);
}

.message-icon i {
  font-size: 24px;
  color: var(--primary-color);
}

/* ---- Story Display ---- */
#story-display {
  background-color: var(--c12);
  border-radius: 8px;
  box-shadow: 0 6px 12px var(--c17);
  padding: 40px;
  font-family: 'Georgia', serif;
  line-height: 1.7;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

#story-display::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -8px;
  width: 8px;
  background: linear-gradient(to right, 
      var(--c44) 0%, 
      var(--c45) 20%, 
      var(--c36) 40%, 
      var(--c45) 80%, 
      var(--c44) 100%);
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

#story-display h3 {
  font-family: 'Playfair Display', serif;
  color: var(--secondary-color);
  text-align: center;
  margin-bottom: 30px;
  font-size: 32px;
  border-bottom: 2px solid var(--accent-light);
  padding-bottom: 15px;
  font-weight: 700;
  text-shadow: 1px 1px 2px var(--c45);
}

#story-display p {
  margin-bottom: 18px;
  font-size: 19px;
  text-align: justify;
  hyphens: auto;
  color: var(--c46);
  text-indent: 30px;
}

#story-display::after {
  content: '✧ ✦ ✧';
  display: block;
  text-align: center;
  color: var(--accent-color);
  font-size: 24px;
  margin-top: 30px;
  opacity: 0.7;
}

/* Styling for story container */
#story-display-container {
  background-color: var(--c12);
  padding: 20px;
  border-radius: 8px;
  font-family: 'Georgia', serif;
  line-height: 1.7;
}

#story-display-container h3 {
  font-family: 'Playfair Display', serif;
  color: var(--secondary-color);
  text-align: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--accent-light);
  font-weight: 700;
  text-shadow: 1px 1px 2px var(--c45);
}

#story-display-container p {
  margin-bottom: 18px;
  font-size: 18px;
  text-align: justify;
  hyphens: auto;
  color: var(--c46);
}

#story-display-container p:first-of-type::first-letter {
  font-size: 3.5em;
  font-family: 'Playfair Display', serif;
  float: left;
  margin-right: 10px;
  line-height: 0.85;
  color: var(--secondary-color);
  padding: 4px;
  text-shadow: 1px 1px 2px var(--c36);
}

/* ---- Parameters & Form Elements ---- */
/* Parameter Styles */
.parameter-item {
  border-radius: 8px;
  transition: all 0.3s ease;
  position: relative;
  margin-bottom: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--c14);
}

.parameter-item:last-child {
  border-bottom: none;
}

.parameter-item:hover {
  background-color: var(--c47);
}

.parameter-item.editing {
  background-color: var(--c48);
}

.parameter-item.param-updated {
  animation: highlight-blue 1s ease;
}

/* Parameter status indicators */
.parameter-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  margin-right: 10px;
  flex-shrink: 0;
}

.status-complete {
  background-color: var(--primary-color);
  color: white;
}

.status-incomplete {
  background-color: var(--c49);
  border: 1px solid var(--c50);
}

.status-optional {
  background-color: var(--c51);
  border: 1px dashed var(--c52);
}

.param-label {
  font-weight: 600;
  color: var(--c53);
}

.param-value {
  font-weight: 500;
  color: var(--c54);
  transition: all 0.3s ease;
}

.param-value.completed {
  color: var(--primary-color);
}

/* Optional field styling */
.optional-label {
  color: var(--c35);
  font-style: italic;
}

/* Parameter theme badges styling */
.theme-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.theme-badge {
  background-color: var(--accent-color);
  color: white;
  border-radius: 16px;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 2px 4px var(--c45);
}

/* Progress bar in parameters */
.parameter-progress {
  margin-bottom: 1.5rem;
}

.completion-badge {
  background-color: var(--primary-color) !important;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
}

.parameter-progress .progress-bar {
  transition: width 0.5s ease;
  background-color: var(--primary-color);
}

/* Styling for the additional details section */
#param-additional-details .param-value.completed {
    white-space: pre-line;
    line-height: 1.4;
    font-size: 0.9rem;
    background-color: var(--c51);
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid var(--primary-color);
    margin-top: 8px;
    max-height: 120px;
    overflow-y: auto;
}

/* Animation for when details are updated */
#param-additional-details.param-updated .param-value.completed {
    animation: highlight-details 1s ease-in-out;
}

/* Version Navigation */
.version-navigation {
  background-color: transparent;
  color: var(--c12);
  padding: 0.75rem;
  margin-bottom: 1.5rem;
  width: 100%;
  text-align: center;
}

.version-navigation button {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.version-navigation button:hover,
.version-navigation button:focus {
  background-color: var(--primary-dark);
  color: white;
  border-color: var(--primary-dark);
}

.version-navigation span {
  color: var(--c12);
  font-weight: 500;
}

#version-nav-container {
  width: 100%;
  margin-bottom: 1rem;
  max-width: 1320px;
  margin-left: auto;
  margin-right: auto;
}

/* Form validation styling */
.form-control.is-invalid {
  border-color: var(--c55);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right calc(0.375em + 0.1875rem) center;
  background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
  box-shadow: 0 0 0 0.25rem var(--c56);
}

/* Rating feedback styles */
.rating-feedback {
  display: inline-block;
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.rating-feedback.show {
  opacity: 1;
}

.rating-feedback.success {
  color: var(--c57);
}

.rating-feedback.error {
  color: var(--c55);
}

/* Input star rating system */
.star-rating {
  display: inline-flex;
  justify-content: center;
  font-size: 1.25em;
}

.star-rating input[type="radio"] {
  display: none;
}

.star-rating label {
  cursor: pointer;
  padding: 0 2px;
  color: var(--c58); /* Unselected star color */
  transition: all 0.2s ease;
  display: inline-block;
  margin: 0 2px; /* Better spacing between stars */
}

.star-rating label i.fas,
.star-rating label i.far {
  display: inline-block;
  width: 1em;
  height: 1em;
  overflow: hidden;
  text-align: center;
  vertical-align: middle;
}

/* Pagination Styles - library page specific */
.pagination-controls .pagination .page-link {
  color: var(--primary-color);
  border-color: var(--c49);
}

.pagination-controls .pagination .page-item.active .page-link {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

.pagination-controls .pagination .page-link:hover {
  color: var(--c12);
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.pagination-controls .pagination .page-item.disabled .page-link {
  color: var(--c35);
}

/* Loading indicator for AJAX pagination */
.books-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}

/* Filter button styles */
.clear-filter {
  display: inline-block;
  background-color: var(--secondary-color) !important;
  border-color: var(--secondary-color) !important;
  color: white !important;
  position: absolute;
  width: 24px;
  height: 24px;
  padding: 0;
  line-height: 1;
  text-align: center;
  font-size: 18px;
  border-radius: 50%;
  z-index: 10;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.clear-filter:hover {
  background-color: var(--secondary-dark) !important;
  border-color: var(--secondary-dark) !important;
  transform: scale(1.1);
}

.filter-section select + .clear-filter {
  right: 30px;
  top: 38px;
}

/* ---- Progress Indicators ---- */
/* Progress Wheel with improved color transitions */
.progress-wheel-container {
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background-color 0.5s ease;
  background-color: var(--primary-color);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  box-shadow: 0 2px 5px var(--c15);
}

.progress-wheel-container:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px var(--c59);
}

.progress-wheel {
  transform: rotate(-90deg);
}

.progress-wheel-bg {
  fill: none;
  stroke: var(--c24);
  stroke-width: 3;
}

.progress-wheel-fill {
  fill: none;
  stroke: white;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 0.5s ease;
}

.progress-wheel-fill.progress-updated {
  transition: stroke-dashoffset 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.progress-text {
  transform: rotate(90deg);
  font-weight: bold;
  font-family: 'Manrope', sans-serif;
  fill: white;
}

/* Progress states - background color should match the ring color */
.progress-low {
  background-color: var(--primary-color);
}

.progress-medium {
  background-color: var(--accent-color);
}

.progress-high {
  background-color: var(--c60);
}

/* Progress */
.progress {
  cursor: pointer;
  background-color: var(--c49);
  box-shadow: inset 0 1px 2px var(--c14);
  height: 0.75rem;
  border-radius: 0.5rem;
}

.progress-bar {
  transition: width 0.1s ease;
}

/* Checkout progress bar */
.checkout-progress {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 5px var(--c14);
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 1;
  width: 25%;
  text-align: center;
}

.step-icon {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background-color: var(--c49);
  color: var(--c35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-bottom: 0.5rem;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.step-label {
  font-size: 0.8rem;
  color: var(--c35);
  transition: all 0.3s ease;
}

.progress-step.active .step-icon {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-dark);
}

.progress-step.active .step-label {
  color: var(--primary-color);
  font-weight: bold;
}

.progress-step.completed .step-icon {
  background-color: var(--c60);
  color: white;
}

.progress-connector {
  flex-grow: 1;
  height: 3px;
  background: var(--c49);
  margin: 0 -5px;
  margin-top: -50px;
  z-index: 0;
}

.progress-connector.completed {
  background: var(--c60);
}

/* ---- Audio Player ---- */
.audio-player-container {
  background-color: var(--c51);
  border-radius: 8px;
  padding: 15px;
  box-shadow: 0 2px 5px var(--c14);
}

.player-controls {
  background-color: #ffffff;
  padding: 12px;
  border-radius: 6px;
  box-shadow: 0 1px 3px var(--c14);
}

.track-info {
  transition: background-color 0.3s;
}

.volume-control {
  width: 150px;
}

.form-range::-webkit-slider-thumb {
  background: var(--primary-color);
}

.form-range::-moz-range-thumb {
  background: var(--primary-color);
}

/* ---- Book Reader (NEW) ---- */
/* Book Reader Styles - Based on your existing color scheme */

/* Book Reader Container */
.book-reader-container {
  display: flex;
  min-height: 80vh;
  gap: 2rem;
  padding: 1rem;
  background: var(--c61);
  border-radius: 8px;
}

/* Main Content Area */
.book-content {
  flex: 1;
  max-width: 800px;
  background: white;
  padding: 2rem;
  box-shadow: 0 4px 12px var(--c14);
  border-radius: 8px;
  overflow-y: auto;
  max-height: 80vh;
}

/* Chapter Image Sidebar */
.chapter-image-sidebar {
  flex: 0 0 300px;
  position: sticky;
  top: 1rem;
  height: fit-content;
  max-height: 80vh;
}

.chapter-image-container {
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px var(--c14);
}

.chapter-image {
  width: 100%;
  height: auto;
  display: block;
  transition: opacity 0.3s ease;
}

.chapter-image-placeholder {
  width: 100%;
  height: 200px;
  background: var(--c62);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--c63);
  font-style: italic;
  text-align: center;
  padding: 1rem;
}

.chapter-image-placeholder i {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

/* Typography Styles */
.book-title {
  font-family: 'Manrope', sans-serif;
  font-weight: bold;
  font-size: 2.5rem;
  color: var(--secondary-color);
  text-align: center;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.personal-message {
  font-family: 'Indie Flower', cursive;
  font-size: 1.1rem;
  text-align: center;
  margin: 2rem 0;
  padding: 2rem;
  background: var(--c47);
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  line-height: 1.6;
  color: var(--card-text);
}

.synopsis-section {
  margin: 2rem 0;
}

.synopsis-title {
  font-family: 'Manrope', sans-serif;
  font-weight: bold;
  font-size: 1.3rem;
  color: var(--secondary-color);
  margin-bottom: 1rem;
  text-align: center;
}

.synopsis-text {
  font-family: 'Manrope', sans-serif;
  font-style: italic;
  font-size: 1rem;
  line-height: 1.5;
  text-align: center;
  color: var(--card-text);
  margin-bottom: 1.2em;
}

.synopsis-text.has-drop-cap {
  text-align: left;
}

/* Character Section */
.character-section {
  margin: 3rem 0;
  page-break-inside: avoid;
}

.character-name {
  font-family: 'Manrope', sans-serif;
  font-weight: bold;
  font-size: 1.2rem;
  color: var(--secondary-color);
  text-align: center;
  margin-bottom: 1rem;
}

.character-image {
  width: 100%;
  max-width: 400px;
  height: auto;
  display: block;
  margin: 0 auto 1rem auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--c14);
}

/* Chapter Styles */
.chapter-section {
  margin: 3rem 0;
  scroll-margin-top: 2rem;
}

.chapter-title {
  font-family: 'Manrope', sans-serif;
  font-weight: bold;
  font-size: 1.5rem;
  color: var(--secondary-color);
  text-align: center;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.chapter-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent-light), transparent);
  margin-bottom: 2rem;
}

.chapter-text {
  font-family: 'Manrope', sans-serif;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--card-text);
  text-align: left;
}

.chapter-paragraph {
  margin-bottom: 1.2em;
  text-indent: 0;
}

.chapter-paragraph.has-drop-cap {
  text-indent: 0;
}

/* Drop Cap Styling */
.drop-cap {
  float: left;
  font-family: 'Manrope', sans-serif;
  font-weight: bold;
  font-size: 3.5rem;
  line-height: 0.8;
  color: var(--secondary-color);
  margin: 0.1em 0.1em 0 0;
  text-shadow: 1px 1px 2px var(--c14);
}

/* RTL Language Support */
.rtl {
  direction: rtl;
  text-align: right;
}

.rtl .drop-cap {
  float: right;
  margin: 0.1em 0 0 0.1em;
}

.rtl .chapter-text {
  text-align: right;
}

/* Language-specific font families */
.lang-arabic {
  font-family: 'NotoNaskhArabic', 'Manrope', sans-serif;
}

.lang-chinese {
  font-family: 'NotoSansSC', 'Manrope', sans-serif;
}

.lang-japanese {
  font-family: 'NotoSansJP', 'Manrope', sans-serif;
}

.lang-korean {
  font-family: 'NotoSansKR', 'Manrope', sans-serif;
}

/* Decorative Elements */
.decorative-separator {
  text-align: center;
  color: var(--accent-color);
  font-size: 1.2rem;
  margin: 2rem 0;
  font-family: 'Manrope', sans-serif;
}

.decorative-separator::before {
  content: "✧ ✦ ✧";
}

/* Loading and transition states */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

.loading-text {
  text-align: center;
  color: var(--c64);
  font-style: italic;
  padding: 2rem;
}

/* Scrollbar styling for better reading experience */
.book-content::-webkit-scrollbar {
  width: 8px;
}

.book-content::-webkit-scrollbar-track {
  background: var(--c65);
  border-radius: 4px;
}

.book-content::-webkit-scrollbar-thumb {
  background: var(--accent-light);
  border-radius: 4px;
}

.book-content::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* ---- Product Display & Order Forms ---- */
/* Product highlight box */
.product-highlight {
  background: linear-gradient(135deg, var(--c16) 0%, var(--c47) 100%);
  border-left: 4px solid var(--primary-color);
}

/* Package styling */
.package-option {
  transition: all 0.3s ease;
  padding: 15px;
  border-radius: 8px;
  background-color: var(--c12);
  box-shadow: 0 1px 3px var(--c66);
}

.package-option:hover {
  box-shadow: 0 3px 10px var(--c14);
  transform: translateY(-2px);
}

.package-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

/* Discount badge styling */
.discount-badge .badge {
  animation: fadeInOut 2s infinite;
  font-size: 0.8rem;
}

/* Book title banner styling */
#storyTitleBanner .card-body {
  padding: 1.5rem;
}

#storyTitleBanner h2 {
  color: white;
  font-weight: 700;
}

/* FIX 1: Make the selling point icons match the secondary color for better pop */
.package-content i.fa-light,
.package-content i.fa-regular {
  color: var(--secondary-color) !important; /* Use the orange accent color to make icons pop */
}

/* FIX 2: Improve quantity selector layout to prevent line breaks */
.quantity-selector .d-flex {
  flex-wrap: wrap;
  row-gap: 10px;
  column-gap: 10px;
  align-items: center;
}

.quantity-selector .input-group {
  flex: 0 0 auto;
  width: 120px !important;
  margin-right: 10px;
}

.discount-badge {
  flex: 0 1 auto;
  max-width: calc(50% - 70px); /* Allow two badges to fit side by side */
}

/* Update badge styling for better visibility */
#bundleDiscount .badge {
  background-color: var(--primary-color) !important; /* Use primary blue for bundle discount */
}

#volumeDiscount .badge {
  background-color: var(--secondary-color) !important; /* Use orange for volume discount */
}

/* ---- Image Styles ---- */
/* Image Options */
.img-option {
  width: 150px;
  height: auto;
  margin: 5px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.img-option.selected {
  transform: scale(1.1);
  box-shadow: 0 0 10px var(--c30);
}

/* Additional icons for better visualization */
.delivery-timing {
  font-size: 0.9rem;
}

.book-title-display {
  background-color: var(--c51);
  border-radius: 4px;
}

/* ---- List Styles ---- */
.list-group-item.active {
  background-color: var(--c16);
  color: var(--background-dark);
  border-color: var(--c67);
}

/* ======================
   6. Utilities 
   ====================== */
/* Loading animation for shipping options */
#shippingOptionsLoading .spinner-border {
  color: var(--primary-color);
}

/* ======================
   7. Animations 
   ====================== */
@keyframes clickEffect {
  0% {
    transform: scale(1.05);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes typing {
  0% { transform: scale(1); }
  50% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes highlight-blue {
  0% { background-color: var(--c67); }
  100% { background-color: transparent; }
}

@keyframes highlight-details {
    0% { background-color: var(--c37); }
    50% { background-color: var(--c68); }
    100% { background-color: var(--c51); }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 var(--c69);
  }
  70% {
    box-shadow: 0 0 0 10px var(--c70);
  }
  100% {
    box-shadow: 0 0 0 0 var(--c70);
  }
}

@keyframes fadeInOut {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

/* ======================
   8. Media Queries 
   ====================== */
@media (min-width: 768px) {
  #dynamicVideo {
    filter: brightness(60%);
  }
}

@media (max-width: 768px) {
  #story-display {
    padding: 15px;
  }
  
  #story-display h3 {
    font-size: 24px;
  }
  
  #story-display p {
    font-size: 16px;
  }
  
  .chat-message {
    max-width: 95%;
  }
  
  /* Improved library page responsive layout - FIXED */
  #books-container .float-start {
    max-width: 120px;
    height: auto;
    float: left !important; /* Force left float on mobile */
    margin-right: 15px;
    margin-bottom: 15px;
  }
  
  #books-container .card-body {
    text-align: left; /* Left align text on mobile */
  }
  
  #books-container .synopsis-section {
    text-align: left;
    clear: both; /* Ensure synopsis appears below the image */
  }
  
  #books-container .d-flex {
    flex-wrap: wrap;
    justify-content: flex-start; /* Align buttons to left */
  }
  
  #books-container .ms-auto {
    margin-left: 0 !important;
    margin-top: 15px;
    width: 100%; /* Full width for rating form */
  }
  
  /* Make playback controls more touch-friendly on mobile */
  .player-controls .btn {
    padding: 8px 12px;
    margin-right: 5px;
  }
    
  .volume-control {
    width: 100px;
  }
  
  /* For mobile views, stack the discount badges vertically */
  .quantity-selector .d-flex {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .discount-badge {
    margin-top: 10px;
    margin-left: 0 !important;
    max-width: 100%;
  }
  
  /* Ensure the badges themselves look good */
  .discount-badge .badge {
    display: inline-block;
    white-space: nowrap;
  }
  
  /* Chat input area for mobile */
  #chat-input-area {
      flex-wrap: wrap;
  }
  
  #fixed-generate-btn {
      order: 1;
      margin-bottom: 8px;
      flex-basis: 100%;
      min-width: auto;
  }
  
  .progress-wheel-container, #reset-chat-btn {
      order: 0;
  }
  
  .input-container {
      order: 2;
      flex-basis: 100%;
  }
  
  /* IMPROVED Book Reader Mobile Styles */
  .book-reader-container {
    flex-direction: column;
    gap: 0.5rem; /* Reduced gap */
    padding: 0.5rem; /* Reduced padding */
    margin: 0 -15px; /* Extend to edges of Bootstrap container */
    background: var(--c61);
    border-radius: 0; /* Remove border radius on mobile for full width */
  }
  
  .chapter-image-sidebar {
    display: none; /* Hide sidebar completely - we'll use inline images */
  }
  
  .book-content {
    padding: 1rem 0.75rem; /* Reduced horizontal padding */
    margin: 0; /* Remove any margins */
    box-shadow: none; /* Remove shadow on mobile */
    border-radius: 0; /* Remove border radius for full width feel */
  }
  
  .book-title {
    font-size: 2rem;
    margin-bottom: 1.5rem;
  }
  
  .chapter-title {
    font-size: 1.3rem;
  }
  
  .drop-cap {
    font-size: 2.5rem;
  }
  
  /* Inline Chapter Images for Mobile */
  .inline-chapter-image-container {
    margin: 2rem 0;
    text-align: center;
  }
  
  .inline-chapter-image-wrapper {
    display: inline-block;
    max-width: 90%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 20px var(--c17);
    transition: transform 0.3s ease;
  }
  
  .inline-chapter-image-wrapper:hover {
    transform: translateY(-3px);
  }
  
  .inline-chapter-image {
    width: 100%;
    height: auto;
    display: block;
    max-height: 400px;
    object-fit: contain;
  }
  
  .inline-chapter-image-placeholder {
    padding: 3rem 2rem;
    background: var(--c51);
    color: var(--c35);
    font-style: italic;
    text-align: center;
  }
  
  /* Better spacing for mobile reading */
  .personal-message {
    margin: 1.5rem 0;
    padding: 1.5rem;
    font-size: 1.05rem;
  }
  
  .synopsis-section {
    margin: 1.5rem 0;
  }
  
  .chapter-section {
    margin: 2rem 0;
  }
  
  .chapter-paragraph {
    margin-bottom: 1.5em; /* Increased paragraph spacing for mobile */
  }
}

@media (min-width: 992px) {
  #response1, #response2 {
    display: flex;
    flex-wrap: wrap;
  }
  
  #formResponse, #orderForm1, #orderForm2, #orderForm3 {
    transition: all 0.3s ease;
  }
}

@media (max-width: 991.98px) {
  .sticky-top {
    position: relative;
    top: 0;
  }
  
  .checkout-progress {
    overflow-x: auto;
    padding: 0.5rem;
  }
  
  .step-label {
    font-size: 0.7rem;
  }
}

@media (max-width: 767.98px) {
  .footer {
    text-align: center;
  }
  
  .footer-decoration {
    margin-left: auto;
    margin-right: auto;
  }
  
  .footer-links {
    flex-direction: column;
    align-items: center;
  }
  
  .footer-links a {
    margin-right: 0 !important;
  }
}

@media (max-width: 480px) {
  /* Extra Small Mobile - Even more space optimization */
  .book-reader-container {
    padding: 0.25rem;
    margin: 0 -15px;
  }
  
  .book-content {
    padding: 0.75rem 0.5rem; /* Further reduced padding */
  }
  
  .book-title {
    font-size: 1.75rem;
    margin-bottom: 1rem;
  }
  
  .chapter-title {
    font-size: 1.2rem;
  }
  
  .drop-cap {
    font-size: 2.2rem;
  }
  
  .personal-message {
    padding: 1rem;
    font-size: 1rem;
  }
  
  /* Make inline images slightly smaller on very small screens */
  .inline-chapter-image-wrapper {
    max-width: 95%;
  }
  
  .inline-chapter-image {
    max-height: 300px;
  }
  
  .inline-chapter-image-placeholder {
    padding: 2rem 1rem;
  }
}

/* Unified Book Cards - Replace existing similar book styles */
.unified-books-body {
    padding: 15px;
}

.unified-books-grid {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
    padding: 0;
    overflow-x: auto; /* Allow horizontal scroll on mobile if needed */
}

.unified-book-item {
    flex: 1 1 0;
    min-width: 160px;
    max-width: 200px;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.unified-book-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.unified-book-link {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.unified-book-image-container {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    width: 100%;
    overflow: hidden;
}

.unified-book-cover {
    max-height: 300px;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border-radius: 4px;
    transition: transform 0.3s ease;
}

.unified-book-item:hover .unified-book-cover {
    transform: scale(1.02);
}

.unified-book-details {
    padding: 0 4px;
    text-align: center;
}

.unified-book-title {
    margin: 4px 0;
    font-size: 0.9rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    max-height: 2.4em;
    line-height: 1.2;
    color: var(--card-text);
}

.unified-book-rating {
    margin-top: 4px;
    font-size: 0.8rem;
}

/* Mobile responsive */
@media (max-width: 576px) {
    .unified-books-grid {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .unified-book-item {
        flex: 0 0 45%;
        max-width: 45%;
        margin-bottom: 15px;
    }
    
    .unified-book-image-container {
        height: 140px;
    }
    
    .unified-book-cover {
        max-height: 140px;
    }
}

@media (max-width: 400px) {
    .unified-book-item {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* First, ensure the parent row has proper flex properties */
#response1 {
    display: flex;
    min-height: 650px; /* Set a reasonable minimum height */
}

/* Make both columns flex containers with column direction */
#formResponse, #orderForm1 {
    display: flex !important; /* Override any inline display properties */
    flex-direction: column;
    height: 100%;
}

/* Make the story container wrapper take remaining space */
#story-container-wrapper {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    margin-bottom: 1rem; /* Space before the Books You Might Like section */
}

/* Make the story container wrapper's card expand */
#story-container-wrapper .card {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* Make the story display container expand */
#story-display-container {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* Make the Books You Might Like card not flex grow */
#formResponse > div:not(#story-container-wrapper) {
    flex: 0 0 auto; /* Don't grow, don't shrink, auto basis */
}

/* For the right column, make the main card expand */
#orderForm1 > form > .card,
#orderForm1 > .card {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* Make the order form card body expand */
#orderForm1 .card-body {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

/* Push the pricing summary to the bottom of its container */
#pricingSummary {
    margin-top: auto;
    padding-top: 1rem;
}

/* Gift Card Styles */
.hover-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px var(--c45);
}

.gift-card-mock-up {
    border: 1px solid var(--c71);
    border-radius: 8px;
    overflow: hidden;
    background-color: var(--c72);
    min-height: 300px;
}

.gift-card-inner {
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, var(--c73) 100%);
    box-shadow: 0 4px 8px var(--c44);
}

.gift-message {
    font-style: italic;
    color: var(--c74);
    background-color: var(--c61);
}

#giftMessageCount {
    font-size: 0.8rem;
    color: var(--c75);
}

/* Animation for preview updates */
@keyframes highlight {
    0% { background-color: transparent; }
    50% { background-color: var(--c76); }
    100% { background-color: transparent; }
}

.preview-highlight {
    animation: highlight 1s ease;
}

/* Add these to your CSS */
#giftCardOrderForm {
    flex: 1;
    min-width: 300px;
}

#giftCardOrderForm .card {
    width: 100%;
}

#giftCardSection {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
}

#giftCardSection > div {
    flex: 1 1 45%;
    min-width: 300px;
}

#giftCardOrderForm > div {
    height: 100%;
}

#giftCardOrderForm .card {
    height: 100%;
}

/* Fix for narrow order form */
#giftCardOrderForm1 {
    width: 100% !important;
}

/* Make sure forms are responsive */
@media (max-width: 992px) {
    #giftCardSection > div {
        flex: 1 1 100%;
    }
}

/* Gift Card Enhanced Styling */
.gift-card-mock-up {
    background: linear-gradient(135deg, var(--c77) 0%, var(--c78) 100%);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 15px 35px var(--c14), 0 5px 15px var(--c79);
    transform: perspective(1000px) rotateY(0deg);
    transition: transform 0.6s ease, box-shadow 0.6s ease;
}

.gift-card-mock-up:hover {
    transform: perspective(1000px) rotateY(5deg);
    box-shadow: -10px 15px 35px var(--c18), -5px 5px 15px var(--c80);
}

.gift-card-inner {
    position: relative;
    background: linear-gradient(135deg, #ffffff 0%, var(--c81) 100%);
    border-radius: 12px;
    overflow: hidden;
    min-height: 380px;
}

/* Decorative top and bottom waves */
.gift-card-wave-top,
.gift-card-wave-bottom {
    height: 24px;
    background-repeat: repeat-x;
    width: 100%;
}

.gift-card-wave-top {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1113-14.29,1200,52.47V0Z' opacity='.25' fill='%232E86AB'%3E%3C/path%3E%3Cpath d='M0,0V15.81C13,36.92,27.64,56.86,47.69,72.05,99.41,111.27,165,111,224.58,91.58c31.15-10.15,60.09-26.07,89.67-39.8,40.92-19,84.73-46,130.83-49.67,36.26-2.85,70.9,9.42,98.6,31.56,31.77,25.39,62.32,62,103.63,73,40.44,10.79,81.35-6.69,119.13-24.28s75.16-39,116.92-43.05c59.73-5.85,113.28,22.88,168.9,38.84,30.2,8.66,59,6.17,87.09-7.5,22.43-10.89,48-26.93,60.65-49.24V0Z' opacity='.5' fill='%232E86AB'%3E%3C/path%3E%3Cpath d='M0,0V5.63C149.93,59,314.09,71.32,475.83,42.57c43-7.64,84.23-20.12,127.61-26.46,59-8.63,112.48,12.24,165.56,35.4C827.93,77.22,886,95.24,951.2,90c86.53-7,172.46-45.71,248.8-84.81V0Z' fill='%232E86AB'%3E%3C/path%3E%3C/svg%3E");
}

.gift-card-wave-bottom {
    position: absolute;
    bottom: 0;
    transform: rotate(180deg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'%3E%3Cpath d='M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1113-14.29,1200,52.47V0Z' opacity='.25' fill='%23FF6B35'%3E%3C/path%3E%3Cpath d='M0,0V15.81C13,36.92,27.64,56.86,47.69,72.05,99.41,111.27,165,111,224.58,91.58c31.15-10.15,60.09-26.07,89.67-39.8,40.92-19,84.73-46,130.83-49.67,36.26-2.85,70.9,9.42,98.6,31.56,31.77,25.39,62.32,62,103.63,73,40.44,10.79,81.35-6.69,119.13-24.28s75.16-39,116.92-43.05c59.73-5.85,113.28,22.88,168.9,38.84,30.2,8.66,59,6.17,87.09-7.5,22.43-10.89,48-26.93,60.65-49.24V0Z' opacity='.5' fill='%23FF6B35'%3E%3C/path%3E%3Cpath d='M0,0V5.63C149.93,59,314.09,71.32,475.83,42.57c43-7.64,84.23-20.12,127.61-26.46,59-8.63,112.48,12.24,165.56,35.4C827.93,77.22,886,95.24,951.2,90c86.53-7,172.46-45.71,248.8-84.81V0Z' fill='%23FF6B35'%3E%3C/path%3E%3C/svg%3E");
}

/* Logo and badge styling */
.gift-card-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gift-logo-img {
    height: 42px;
    width: auto;
}

.gift-card-logo-text {
    font-family: 'Manrope', sans-serif;
    font-weight: 800;
    font-size: 24px;
    background: linear-gradient(135deg, var(--c01) 0%, var(--c02) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 1px;
}

.gift-card-badge {
    background: linear-gradient(135deg, var(--c03) 0%, var(--c04) 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 16px;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
    box-shadow: 0 2px 4px var(--c82);
    animation: pulse-light 2s infinite;
}

/* Main content styling */
.gift-card-content {
    color: var(--c53);
    position: relative;
    z-index: 10;
}

.gift-card-title {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    font-size: 22px;
    text-align: center;
    color: var(--c07);
    margin-bottom: 15px;
    letter-spacing: 0.5px;
}

/* Message styling with decorative quotes */
.gift-message-container {
    position: relative;
    padding: 5px 36px;
    max-width: 90%;
    margin: 0 auto;
    background-color: var(--c47);
    border-radius: 8px;
}

.gift-message {
    text-align: center;
    padding: 12px 0;
    font-style: italic;
    color: var(--c54);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gift-message-quote-left,
.gift-message-quote-right {
    font-family: 'Georgia', serif;
    font-size: 60px;
    line-height: 1;
    position: absolute;
    opacity: 0.15;
    color: var(--c01);
}

.gift-message-quote-left {
    top: -15px;
    left: 10px;
}

.gift-message-quote-right {
    bottom: -35px;
    right: 10px;
}

/* Package info styling */
.gift-package-info {
    text-align: center;
    margin-top: 1.5rem;
}

.gift-package-badge {
    display: block;
    background: linear-gradient(135deg, var(--c01) 0%, var(--c02) 100%);
    color: white;
    padding: 16px;
    border-radius: 12px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    text-align: left;
    box-shadow: 0 3px 8px var(--c83);
}

.gift-package-badge::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to right,
        var(--c84) 0%,
        var(--c24) 50%,
        var(--c84) 100%
    );
    transform: rotate(30deg);
    animation: shimmer 3s infinite;
}

/* Header for the included items */
.gift-package-badge h5 {
    color: white;
    font-size: 16px;
    margin-bottom: 14px;
    text-align: center;
    font-weight: 600;
    position: relative;
    padding-bottom: 8px;
}

/* Decorative underline for the header */
.gift-package-badge h5:after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background-color: var(--c85);
}

/* List of included items */
.gift-package-badge ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.gift-package-badge li {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.gift-package-badge li:last-child {
    margin-bottom: 0;
}

/* Icon styling */
.gift-package-badge li i {
    margin-right: 10px;
    width: 20px;
    text-align: center;
    color: var(--c86);
    font-size: 16px;
}

/* Smaller text for shipping info */
.gift-package-badge .small {
    opacity: 0.8;
    font-size: 12px;
}

.gift-card-note {
    color: var(--c35);
    font-size: 13px;
    text-align: center;
    max-width: 90%;
    margin: 12px auto 0;
}

/* Footer styling */
.gift-card-footer {
    text-align: center;
    border-top: 1px dashed var(--c14);
}

.gift-redemption-code {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gift-code-label {
    font-size: 10px;
    color: var(--c35);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.gift-code-value {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--c07);
}

.gift-card-redeem-at {
    color: var(--c35);
}

/* Animations */
@keyframes pulse-light {
    0% {
        box-shadow: 0 2px 4px var(--c82);
    }
    50% {
        box-shadow: 0 2px 12px var(--c87);
    }
    100% {
        box-shadow: 0 2px 4px var(--c82);
    }
}

@keyframes shimmer {
    0% {
        transform: translateX(-150%) rotate(30deg);
    }
    100% {
        transform: translateX(150%) rotate(30deg);
    }
}

/* Phoenix Header Tab Styling */
.phoenix-tabs .nav-link {
    background-color: transparent !important;
    border: none !important;
    color: var(--c88) !important;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    z-index: 3;
}

.phoenix-tabs .nav-link:hover {
    color: white !important;
    background-color: var(--c21) !important;
}

.phoenix-tabs .nav-link.active {
    color: white !important;
    background-color: var(--c89) !important;
    border-bottom: 2px solid white !important;
}

.phoenix-tabs .nav-link.active:hover {
    background-color: var(--c89) !important;
}

/* Ensure tab content is properly styled */
.phoenix-header + .card-body {
    border-top: none;
}

/* Phoenix Header Star Rating Styling - Simplified */
.phoenix-rating-form .rating-feedback {
    color: white;
}

.phoenix-rating-form .rating-feedback.success {
    color: var(--c90); /* Light green for success on dark background */
}

.phoenix-rating-form .rating-feedback.error {
    color: var(--c91); /* Light red for error on dark background */
}

.phoenix-star-rating {
    position: relative;
    z-index: 10;
}

.phoenix-star-rating input[type="radio"] {
    display: none;
}

.phoenix-star-rating label {
    cursor: pointer;
    padding: 0 2px;
    transition: all 0.2s ease;
    display: inline-block;
    margin: 0 2px;
    /* Let JavaScript handle the colors, just set default */
    color: var(--c92);
}

.social-share-btn {
    transition: all 0.2s ease;
    /* FIXED: More visible background against blue header */
    background: var(--c86) !important;
    border: 1px solid var(--c88) !important;
    color: var(--primary-color) !important;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    /* FIXED: Higher z-index to ensure clickability */
    position: relative;
    z-index: 15;
    box-shadow: 0 2px 4px var(--c14);
}

.social-share-btn:hover {
    transform: translateY(-2px);
    background: var(--c25) !important;
    border-color: var(--c25) !important;
    box-shadow: 0 4px 8px var(--c15);
    /* Maintain high z-index on hover */
    z-index: 16;
}

.social-share-btn:active {
    transform: translateY(0);
}

/* Platform-specific icon colors */
.social-share-btn[data-platform="facebook"] i {
    color: var(--c93) !important;
}

.social-share-btn[data-platform="twitter"] i {
    color: var(--c94) !important;
}

.social-share-btn[data-platform="linkedin"] i {
    color: var(--c95) !important;
}

.social-share-btn[data-platform="bluesky"] i {
    color: var(--c96) !important;
}

.social-share-btn[data-platform="whatsapp"] i {
    color: var(--c97) !important;
}

.social-share-btn[data-platform="telegram"] i {
    color: var(--c98) !important;
}

/* Enhanced styling for Instagram and TikTok buttons */
.social-share-btn[data-platform="instagram"]:hover {
    background: linear-gradient(45deg, var(--c99) 0%,var(--c100) 25%,var(--c101) 50%,var(--c102) 75%,var(--c103) 100%) !important;
}

.social-share-btn[data-platform="instagram"]:hover i {
    color: white !important;
}

.social-share-btn[data-platform="tiktok"]:hover {
    background: var(--c34) !important;
}

.social-share-btn[data-platform="tiktok"]:hover i {
    color: white !important;
}

/* Custom message styling for Instagram/TikTok sharing */
.social-share-message {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.social-share-message h4 {
    color: var(--secondary-color) !important;
    font-weight: 600;
}

/* Ensure proper z-index for sharing messages */
.social-share-message {
    z-index: 10001 !important;
}

#copyLinkBtn {
    transition: all 0.2s ease;
    background: var(--c86) !important;
    border: 1px solid var(--c88) !important;
    color: var(--c35) !important;
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    position: relative;
    z-index: 15;
    box-shadow: 0 2px 4px var(--c14);
}

#copyLinkBtn:hover {
    transform: translateY(-2px);
    background: var(--c25) !important;
    border-color: var(--c25) !important;
    box-shadow: 0 4px 8px var(--c15);
    z-index: 16;
}

/* Ensure phoenix header decoration doesn't interfere */
.phoenix-header-decoration {
    z-index: 1; /* Lower than social buttons */
}

.phoenix-header-content {
    position: relative;
    z-index: 10; /* Higher than decoration but lower than buttons */
}

.gap-2 {
    gap: 0.5rem !important;
}
#shareUrl {
    font-family: monospace;
    font-size: 0.9em;
}

/* Mobile responsive adjustments */
@media (max-width: 576px) {
    .social-share-btn, #copyLinkBtn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    
    .gap-2 {
        gap: 0.25rem !important;
    }
  
    .social-share-btn[data-platform="instagram"],
    .social-share-btn[data-platform="tiktok"] {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    
    /* Ensure the new social share message is mobile-friendly */
    .social-share-message {
        max-width: 90vw !important;
        padding: 15px 20px !important;
        font-size: 14px !important;
    }
    
    .social-share-message h4 {
        font-size: 16px !important;
    }
}

.social-sharing-compact .btn-group .btn:last-child {
    margin-right: 0;
}

.social-sharing-compact .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px var(--c36);
}

.social-compact {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.social-compact i {
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .social-sharing-compact {
        margin-top: 10px;
        margin-left: 0 !important;
    }
    
    .social-sharing-compact .d-none.d-md-inline {
        display: none !important;
    }
}

/* Hidden share URL for copying */
#shareUrl {
    position: absolute;
    left: -9999px;
    opacity: 0;
}

/* Copy feedback toast */
.copy-feedback-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--c104);
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    font-size: 14px;
    box-shadow: 0 4px 12px var(--c59);
}

.copy-feedback-toast.show {
    transform: translateX(0);
}

.book-progress-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    padding: 2rem;
}

.book-progress-card {
    background: linear-gradient(135deg, var(--c77) 0%, var(--c105) 100%);
    border-radius: 20px;
    padding: 3rem;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 20px 40px var(--c14);
}

.book-progress-icon-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 2rem;
}

.book-progress-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--c106) 0%, var(--c107) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    position: relative;
    z-index: 2;
}

.book-progress-spinner {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border: 3px solid transparent;
    border-top-color: var(--c106);
    border-radius: 50%;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.book-progress-title {
    color: var(--c108);
    font-size: 1.75rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.book-progress-message {
    color: var(--c109);
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.book-progress-steps {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
    gap: 1rem;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--c110);
}

.progress-step i {
    font-size: 1.5rem;
    color: var(--c106);
}

.progress-step span {
    font-size: 0.875rem;
}

.book-progress-footer {
    color: var(--c110);
    font-size: 0.95rem;
    margin: 0;
}

/* Responsive adjustments */
@media (max-width: 576px) {
    .book-progress-card {
        padding: 2rem 1.5rem;
    }
    
    .book-progress-steps {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .progress-step {
        flex-direction: row;
        gap: 1rem;
    }
}
/* --- Global column & gutter alignment --------------------------- */

#plyxMain > .row,
#plyxMain > section > .row {
  --bs-gutter-x: 1.5rem; /* unify gutters everywhere */
}

/* --- Fix Bootstrap grid override in gift-card flex ------------- */
#giftCardSection {
  display: block; /* back to normal row */
}

#giftCardSection .row {
  margin-left: 0;
  margin-right: 0;
}

#giftCardSection [class*="col-"] {
  flex: 0 0 auto;
  max-width: 100%; /* let Bootstrap handle widths */
}

/* Full Bleed Helper to remove gutters on the edges */
.full-bleed-row{
  /* row hugs the viewport */
  margin-inline: 0 !important;

  /* inside the row we still want the regular gutter value */
  --bs-gutter-x: 1.5rem;
}

/* give every immediate column its half-gutter */
.full-bleed-row > [class*="col"]{
  padding-inline: calc(var(--bs-gutter-x)/2) !important;
}

/* first & last columns touch the edges */
.full-bleed-row > [class*="col"]:first-child {padding-left: 0 !important;}
.full-bleed-row > [class*="col"]:last-child  {padding-right: 0 !important;}

/* when the row temporarily shows only one column */
.full-bleed-row > [class*="col"]:only-child{
  padding-inline: 0 !important;
}
/* === edge paddings for dynamically hidden columns ================ */
.full-bleed-row > [class*="col"].edge-left  { padding-left: 0 !important; }
.full-bleed-row > [class*="col"].edge-right { padding-right: 0 !important; }

/* place this right after the existing edge-helpers */
.full-bleed-row > [class*="col"].edge-left.edge-right {
  flex: 0 0 100% !important;   /* take the whole row */
  max-width: 100% !important;
}

/* Remove the hard-coded width that centres the chat card */
.full-bleed-row .chat-card {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Chat row: force both gutters to 0 even though it isn’t the last child */
#try_out > .col-12 { padding-left: 0 !important; padding-right: 0 !important; }


  /* --- CTA CARD MODULE --- */
  .cta-card {
    position: relative;
    display: block;
    width: 100%;
    min-height: 280px; /* tweak as needed */

    /* illustrated background */
    background-size: cover;
    background-position: center;

    /* rounded corners + shadow */
    border-radius: .75rem;
    box-shadow: 0 0.25rem 1rem var(--c111);

    /* reset native <button> look so anchors & buttons appear identical */
    border: none;
    background-color: transparent;
    cursor: pointer;

    overflow: hidden;
    color: var(--c12); /* ensure overlay text is readable */
    text-decoration: none;

    /* gentle hover / focus lift */
    transition: transform .2s ease, box-shadow .2s ease;
  }
  .cta-card:hover, .cta-card:focus {
    transform: translateY(-4px);
    box-shadow: 0 0.5rem 1.25rem var(--c112);
    text-decoration: none; /* suppress underline on anchors */
  }

  /* subtle dark overlay for readability */
  .cta-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--c111);
    z-index: 1;
  }

  /* holds headline, copy & button */
  .cta-content {
    position: absolute;    /* pin overlay so it can span full height */
    top: 0;
    bottom: 0;             /* allows flex layout to push button down */
    left: 0;
    z-index: 2; /* above ::before */

    display: flex;
    flex-direction: column;
    height: 100%;

    padding: 1.5rem;
  }

  .cta-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: .5rem;
  }

  .cta-copy {
    flex-grow: 1;
    font-size: 1rem;
    margin-bottom: 1.25rem;
  }

  /* custom button inside card (inherits brand btn styles) */
  .cta-card .btn {
    align-self: flex-start;
    margin-top: auto;       /* push to bottom of .cta-content */
  }

/* ===============================================================
   Narrow viewport gutter removal
   When collapsing to a single column (phones & small tablets),
   we want zero horizontal gutters so content spans full width.
   This overrides Bootstrap’s cols + any custom paddings.
   =============================================================== */
@media (max-width: 767.98px) {
  /* 1. Neutralise Bootstrap gutter variable */
  .row,
  [class*="row-"] {
    --bs-gutter-x: 0 !important;
  }

  /* 2. Remove left/right padding that provides half‑gutters */
  .row > [class^="col"],
  .row > [class*=" col"],
  [class*="row-"] > [class^="col"],
  [class*="row-"] > [class*=" col"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;  /* in case columns are using margins */
    margin-right: 0 !important;
  }
}


/* === CTA Card Mobile Fix =========================================
   Ensure CTA buttons & content stay inside card on single‑column views
   ================================================================ */
@media (max-width: 767.98px) {
  /* Let card grow with its content instead of forcing a fixed aspect */
  .cta-card {
    min-height: auto !important;
  }

  /* Re‑flow content so it’s not absolutely positioned */
  .cta-card .cta-content {
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    padding: 1.25rem !important;
  }

  /* Button gains top margin instead of flex push */
  .cta-card .btn {
    margin-top: 1rem !important;
  }
}

/* Sync embedded SVGs with the new accent */
svg.phoenix-decor path,
.gift-card-wave path { fill: var(--c01) !important; }

/* Purchase Status Indicators */
.story-status-indicator {
    text-align: center;
    padding: 8px 12px;
    border-radius: 6px;
    background-color: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.story-status-indicator.purchased {
    animation: successPulse 2s ease-in-out infinite;
}

@keyframes successPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Story Navigation Indicators */
.story-indicators {
    display: flex;
    align-items: center;
    gap: 8px;
}

.story-indicator {
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.story-indicator:hover {
    background-color: rgba(0, 123, 255, 0.1);
    transform: scale(1.1);
}

.story-indicator.active {
    background-color: rgba(0, 123, 255, 0.2);
    border: 2px solid #007bff;
}

.story-indicator.purchased i {
    color: #28a745;
}

.story-indicator:not(.purchased) i {
    color: #6c757d;
}

.story-indicator.active.purchased i {
    color: #155724;
}

/* Version Navigation Container */
.version-navigation {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-radius: 8px;
    padding: 12px;
}

/* Purchased Story Form Styling */
.card-header[style*="linear-gradient(135deg, #28a745, #20c997)"] {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
}

.alert-success.d-flex {
    border-left: 4px solid #28a745;
}

/* Disabled Order Form Styling */
.order-form-disabled {
    opacity: 0.6;
    pointer-events: none;
}

.order-form-disabled .btn {
    cursor: not-allowed;
}

/* Purchase Badge in Story List */
.story-purchase-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #28a745;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Tooltip for Story Indicators */
.story-indicator[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 4px;
}

.story-indicator {
    position: relative;
}

/* Version Navigation Button Fixes */
.version-navigation .btn-outline-primary {
  /* Default state: blue border, blue text, white background */
  color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  background-color: white !important;
}

.version-navigation .btn-outline-primary:hover {
  /* Hover state: white text on blue background */
  color: white !important;
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
}

.version-navigation .btn-outline-primary:focus,
.version-navigation .btn-outline-primary:active,
.version-navigation .btn-outline-primary.active {
  /* Focus/Active state: white text on darker blue background */
  color: white !important;
  background-color: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
  box-shadow: 0 0 0 0.25rem var(--c13) !important;
}

.version-navigation .btn-outline-primary:disabled,
.version-navigation .btn-outline-primary[disabled] {
  /* Disabled state: gray text, gray border, white background */
  color: var(--c35) !important;
  background-color: white !important;
  border-color: var(--c50) !important;
  opacity: 0.65;
  cursor: not-allowed;
}

/* Alternative solution: Use solid primary buttons instead */
.version-navigation .btn-primary-alt {
  color: white !important;
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  transition: all 0.3s ease;
}

.version-navigation .btn-primary-alt:hover {
  color: white !important;
  background-color: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px var(--c14);
}

.version-navigation .btn-primary-alt:focus,
.version-navigation .btn-primary-alt:active {
  color: white !important;
  background-color: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
  box-shadow: 0 0 0 0.25rem var(--c13) !important;
}

.version-navigation .btn-primary-alt:disabled {
  color: white !important;
  background-color: var(--c35) !important;
  border-color: var(--c35) !important;
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
/* —— visual styling for the new bar —— */
.mode-selector-nav{
  position: sticky;            /* sticks while scrolling            */
  top: var(--navbar-offset,0); /* filled by JS with real height      */
  z-index: 1049;               /* just beneath #navbar (1050)        */
  background: var(--c26);      /* same translucent dark as navbar    */
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--c32);
}

.mode-selector-nav .btn{
  min-width: 140px;
  font-weight: 600;
  transition: all .25s;
}
.mode-selector-nav .btn.active,
.mode-selector-nav .btn:hover{
  background: var(--primary-color);
  color: #fff;
}

/* hide the old pathway cards but leave their DOM & IDs intact */
#pathwayOptions{display:none;}

/* —— video banner facelift —— */
#dynamicVideo{filter:brightness(55%);} /* darker video for contrast   */
#dynamicVideo::after{                  /* subtle gradient overlay    */
  content:'';
  position:absolute;inset:0;
  background:linear-gradient(180deg,
              rgba(0,0,0,0) 10%,
              rgba(6,28,39,.6) 90%);
}

.overlay-content{
  backdrop-filter:blur(2px);
  padding:2rem 1rem;
  text-shadow:0 4px 6px rgba(0,0,0,.45);
}
.overlay-content h1{
  font-size:clamp(1.8rem,4vw,3rem);
  font-weight:800;
  margin-bottom:.5rem;
}
.overlay-content p{
  font-size:clamp(.9rem,1.1vw,1.25rem);
  opacity:.9;
}
/* any element we scroll to should stop below the sticky bars */
#try_out,
#gift_card{
  scroll-margin-top: var(--fixed-stack-height, 0px);
}
html {
  /* lets you hand-tune later in DevTools if needed */
  scroll-padding-top: var(--scroll-pad, 0);
}

/* Book reader CSS */

:root {
    --reader-mobile-bar-height: 60px; /* tweak if your bar is taller/shorter */
}

/* Reader card must not clip overflow so sticky works */
.reader-card {
    overflow: visible !important;  /* overrides .card { overflow: hidden; } */
}

/* Mobile layout improvements for the phoenix header */
@media (max-width: 768px) {
    .book-cover-container {
        max-width: 150px;
        margin: 0 auto 15px auto;
    }
    
    .book-cover-image {
        max-height: 180px;
        width: auto;
        object-fit: contain;
    }
    
    .book-title {
        font-size: 1.5rem;
        text-align: center;
        margin-bottom: 10px;
    }
    
    .rating-stars i {
        font-size: 1.1rem;
        margin-right: 2px;
    }
    
    .social-share-btn {
        min-width: 36px;
        min-height: 36px;
        padding: 8px;
        margin: 2px;
    }
    
    .phoenix-header-content {
        padding: 15px;
    }
}

@media (max-width: 576px) {
    .book-title {
        font-size: 1.3rem;
    }
    
    .social-share-btn {
        min-width: 32px;
        min-height: 32px;
        font-size: 0.9rem;
    }
    
    .rating-stars {
        margin-bottom: 5px;
    }
    
    .star-rating .star-label {
        font-size: 1.2rem;
        margin-right: 3px;
    }
}
    
/* Sticky sidebar for reader (desktop) */
@media (min-width: 992px) {
    .reader-sidebar {
        position: sticky;
        top: var(--reader-sticky-top, 96px); /* will be overridden by JS */
    }
}

/* Ensure proper spacing and alignment */
.phoenix-header .row {
    margin: 0;
}

.phoenix-header .col-12,
.phoenix-header .col-md-3,
.phoenix-header .col-md-9,
.phoenix-header .col-lg-2,
.phoenix-header .col-lg-10 {
    padding-left: 10px;
    padding-right: 10px;
}

/* Fix star rating mobile layout */
.phoenix-star-rating {
    display: inline-flex;
    align-items: center;
}

.phoenix-star-rating .star-label {
    margin-right: 2px;
    cursor: pointer;
    transition: color 0.2s ease;
}

/* Immersive reader styles */
.reader-text p {
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.reader-text p.reader-active {
    background-color: #fff3cd;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.4);
    border-radius: 4px;
}

.reader-image img {
    max-height: 500px;
    object-fit: contain;
}

/* Progress spinner */
.book-progress-spinner {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
    
/* Pillbox layout shared by reader + teaser heading */
.reader-chapter-divider,
#story-display.immersive-teaser .immersive-teaser-header.pillbox-heading {
    text-align: center;
    margin: 2.5rem 0 1.5rem;
    position: relative;
}

/* The lines on each side */
.reader-chapter-divider::before,
.reader-chapter-divider::after,
#story-display.immersive-teaser .immersive-teaser-header.pillbox-heading::before,
#story-display.immersive-teaser .immersive-teaser-header.pillbox-heading::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--c07);
    transform: translateY(-50%);
    z-index: 1;
}

.reader-chapter-divider::before,
#story-display.immersive-teaser .immersive-teaser-header.pillbox-heading::before {
    left: 0;
}

.reader-chapter-divider::after,
#story-display.immersive-teaser .immersive-teaser-header.pillbox-heading::after {
    right: 0;
}

.reader-chapter-label,
#story-display .pillbox-title {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;       /* vertical centering */
    justify-content: center;   /* horizontal centering */

    /* more roomy pill */
    padding: 0.65rem 2.4rem;   /* ⬅️ increased padding */
    line-height: 1.25;
    border-radius: 999px;

    background: var(--c07);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    box-shadow: 0 0 0 3px var(--bs-card-bg, #ffffff);

    border: 0;
    margin: 0;
    text-shadow: none;
}

.reader-chapter-end {
    text-align: center;
    margin-top: 1.5rem;
    color: #ced4da;
    font-size: 0.8rem;
}
    
.reader-chapter-list {
    max-height: 300px;
    overflow-y: auto;
}

.reader-chapter-list-item.active {
    background-color: #e9f5ff;
    font-weight: 600;
}

/* Default: hide mobile bar */
.reader-mobile-controls {
    display: none;
}

/* Mobile layout: bottom bar + slide-up sidebar overlay */
@media (max-width: 991.98px) {
    body.has-reader-mobile-controls {
        padding-bottom: var(--reader-mobile-bar-height, 60px);
    }

    .reader-mobile-controls {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1060; /* keep this above the overlay backdrop/panel */
        background: #ffffff;
        border-top: 1px solid rgba(0, 0, 0, 0.08);
        padding: 0.35rem 0.75rem;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.12);
        gap: 0.5rem;
        height: var(--reader-mobile-bar-height, 60px);
    }

    .reader-mobile-center {
        flex: 1 1 auto;
        display: flex;
        justify-content: center;
    }

    .reader-mobile-controls button {
        border-radius: 999px;
    }

    .reader-mobile-menu {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Sidebar becomes an overlay that stops ABOVE the bottom bar */
    .reader-sidebar {
        position: fixed;
        left: 0;
        right: 0;
        top: 0;
        /* leave room for the bottom bar so it never gets covered */
        bottom: var(--reader-mobile-bar-height, 60px);
        background: rgba(0, 0, 0, 0.35);
        z-index: 1050;          /* under the bar, over the content */
        display: none;          /* hidden by default */
        align-items: flex-end;  /* bottom sheet panel */
        padding: 0;
    }

    .reader-sidebar.is-open {
        display: flex;
    }

    .reader-sidebar-panel {
        background: #ffffff;
        width: 100%;
        max-height: 80vh;
        border-radius: 1rem 1rem 0 0;
        padding: 1rem 1.25rem 1.25rem;
        overflow-y: auto;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
    }

    .reader-sidebar-close {
        border: none;
        background: transparent;
        font-size: 1.5rem;
        line-height: 1;
        padding: 0;
        margin-left: auto;
        margin-bottom: 0.25rem;
        display: block;
    }

    .reader-image {
        margin-bottom: 1rem;
    }
}

/* Prevent hover transform on the immersive reader card
   so fixed mobile controls don’t re-anchor and disappear */
.reader-card.card,
.reader-card.card:hover {
    transform: none !important;
}

.immersive-teaser.no-dropcap p:first-letter {
    all: unset; /* or override whatever your drop cap styles are */
}

/* Disable drop cap only for the immersive teaser card */
#story-display.immersive-teaser.no-dropcap p:first-of-type::first-letter {
    float: none;
    font-size: inherit;
    line-height: inherit;
    margin: 0;
    padding: 0;
    color: inherit;
    text-shadow: none;
}

/* Teaser-specific spacing tweaks */
#story-display.immersive-teaser {
    padding-top: 18px;     /* was 40px – tighten top spacing */
}

/* Reduce vertical gap around the pillbox header in teaser */
#story-display.immersive-teaser .immersive-teaser-header.pillbox-heading {
    margin-top: 0.25rem;   /* almost flush with top content area */
    margin-bottom: 1rem;   /* a bit tighter below the pill */
}

/* Reader – character gallery */
.reader-character-gallery {
    border-top: 1px solid var(--c14);
    padding-top: 1.5rem;
    margin-top: 1.5rem;
}

.reader-character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.reader-character-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 0.5rem 0.5rem 0.75rem;
    text-align: center;
    box-shadow: 0 1px 3px var(--c14);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.reader-character-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px var(--c15);
}

.reader-character-hero {
    border: 2px solid var(--secondary-color);
    box-shadow: 0 0 0 2px rgba(232, 90, 42, 0.25);
}

.reader-character-thumb-wrapper {
    border-radius: 6px;
    /* Let the image decide its own height; we only want spacing around it */
    margin: 4px 4px 0 4px;  /* ⬅ outer margin instead of inner padding */
    overflow: visible;      /* don’t clip the image */
}

.reader-character-thumb {
    display: block;
    width: 100%;
    height: auto;           /* keep original aspect ratio */
    object-fit: contain;    /* or remove this line entirely */
}

.reader-character-caption {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--c53);
}
    
@media (max-width: 576px) {
    .reader-character-thumb {
        height: 120px;
    }
}

.book-dir-ltr {
  direction: ltr;
  text-align: left;
}

.book-dir-ltr p {
  text-align: left;
}

/* desktop / laptop: keep sidebar sticky but scrollable */
@media (min-width: 992px) {
    .reader-sidebar {
        position: -webkit-sticky;
        position: sticky;
        top: var(--reader-sticky-top, 72px); /* fallback just in case */

        /* Limit sidebar height to viewport minus the offset */
        max-height: calc(100vh - var(--reader-sticky-top, 72px) - 16px);

        /* Let contents scroll inside the sidebar */
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Optional: make the inner panel fill and scroll nicely */
    .reader-sidebar-panel {
        display: flex;
        flex-direction: column;
        min-height: 0;            /* important in flex contexts */
    }
}

/* Fullscreen character viewer */
.character-fullscreen-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 1080; /* above most Bootstrap elements */
}

.character-fullscreen-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.character-fullscreen-inner {
    max-width: 100%;
    max-height: 100%;
    text-align: center;
}

.character-fullscreen-image {
    max-width: 100%;
    max-height: calc(100vh - 6rem);
    height: auto;
    width: auto;
    border-radius: 0.75rem;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.7);
}

.character-fullscreen-caption {
    margin-top: 0.75rem;
    color: #fff;
    font-size: 0.9rem;
}

/* Close button */
.character-fullscreen-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    border: none;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    font-size: 1.6rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.character-fullscreen-close:hover {
    background: rgba(0, 0, 0, 0.85);
    transform: scale(1.05);
}

/* Prevent background scroll while fullscreen is open */
body.character-fullscreen-open {
    overflow: hidden;
    touch-action: none;
}

/* Optional: subtle hover zoom on character cards in the gallery */
.reader-character-thumb-wrapper {
    cursor: zoom-in;
    overflow: hidden;
}

.reader-character-thumb {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.reader-character-thumb-wrapper:hover .reader-character-thumb {
    transform: scale(1.03);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.25);
}