/* Modal styles - Make it fullscreen */
.bcs-modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100vw; /* Full viewport width */
  height: 100vh; /* Full viewport height */
  overflow: hidden; /* Hide scrollbars for modal itself */
  background-color: rgba(
    0,
    0,
    0,
    0.85
  ); /* Slightly darker background like Metafox */
  padding: 0; /* No padding on modal */
  /* display: flex; align-items: center; justify-content: center; */ /* Flex handled by wrapper now */
}

/* Modal Content Wrapper - The flex container for columns */
.bcs-modal-content-wrapper {
  background: #222; /* Dark background for the wrapper */
  margin: 0; /* No margin */
  padding: 0; /* No padding */
  border: none; /* Remove border */
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  position: relative; /* Needed for absolute positioning of close button */
  border-radius: 0; /* No border radius for full screen */
  box-shadow: none; /* No shadow for full screen */
  display: flex; /* Use flexbox for columns */
  overflow: hidden; /* Ensure content doesn't overflow */
  color: #fff; /* Default text color */
}

/* The Close Button - Positioned relative to the wrapper */
.bcs-close-modal-btn {
  color: #fff;
  background-color: rgba(0, 0, 0, 0.5);
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  line-height: 1;
  border-radius: 50%;
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001; /* Ensure it's above everything */
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.bcs-close-modal-btn:hover,
.bcs-close-modal-btn:focus {
  color: #000;
  background-color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}

/* Left Column Styles - Now a flex column container */
.bcs-modal-left {
  flex: 1; /* Takes up remaining space */
  display: flex;
  flex-direction: column; /* Stack rows vertically */
  background: #111; /* Very dark background for book area */
  position: relative; /* Ensure relative for absolute nav buttons */
  height: 100%;
  overflow: hidden; /* Hide overflow */
  box-sizing: border-box;
}

/* Left Column Header Row */
.bcs-left-header {
  padding: 10px 20px 5px 20px; /* Reduced bottom padding */
  text-align: center; /* Center title text */
  background-color: rgba(0, 0, 0, 0.2); /* Subtle background */
  flex-shrink: 0; /* Prevent header from shrinking */
  /* height: approx 10% */
}

.bcs-storybook-title {
  margin: auto;
  font-size: 1.2em;
  color: #eee; /* Light title color */
  font-weight: normal;
  margin-bottom: 0px !important;
  font-family: Comic Sans MS;
  padding: 10px 0px !important;
}

/* Left Column Flipbook Area Row */
.bcs-flipbook-area {
  flex: 1; /* Takes up remaining vertical space */
  display: flex; /* Use flex to center the book container */
  align-items: center;
  justify-content: center;
  /* Increased padding for better centering effect */
  padding: 30px; /* Example: Increased padding */
  box-sizing: border-box;
  overflow: hidden; /* Ensure nothing spills out */
  min-height: 0; /* Prevent flex overflow issues */
  width: 95% !important;
  /* width: 95%; */ /* REMOVED width from area */

  /* Keep existing background */
  background-color: #393939;
  background-image: url("../images/storybook-pattern.png");
  background-repeat: repeat;
  background-size: auto;
  background-position: center;
  margin: auto;
  position: relative; /* Stacking context */
  z-index: 1;
  max-height: 90vh;

  /* Ambient glow effect - like TV backlighting */
  box-shadow: 0 0 40px rgba(224, 22, 175, 0.3),
    /* Primary pink glow */ 0 0 80px rgba(224, 22, 175, 0.2),
    /* Wider pink glow */ 0 0 120px rgba(255, 160, 232, 0.15),
    /* Soft outer glow */ inset 0 0 20px rgba(255, 255, 255, 0.05); /* Subtle inner highlight */

  /* Add a subtle border for definition */
  border: 1px solid rgba(255, 160, 232, 0.2);
}

.bcs-storybook-header {
  text-align: center;
  margin-top: 10px;
}
/* Right Column Styles */
.bcs-modal-right {
  width: 350px; /* Fixed width like Metafox */
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #222; /* Same as wrapper background */
  color: #ccc; /* Lighter text color for right panel */
  border-left: 1px solid #333; /* Separator line */
  box-sizing: border-box;
}

/* Flipbook Container / Inner Container */
/* Selectors might be #bcs-flipbook-container-{id} or .bcs-flipbook-inner-container depending on JS */
.bcs-flipbook,
.bcs-flipbook-inner-container {
  /* REMOVED width/height percentages to allow flex centering */
  max-width: 100%; /* Prevent overflow */
  max-height: 100%;
  /* PageFlip library will set its own size */
}

/* Inner container for the actual flipbook instance */
.bcs-flipbook-inner-container {
  /* REMOVED width/height: 100% to allow flex centering */
  width: 96%; /* Set width to 96% */
  height: auto; /* Let height be determined by aspect ratio or content */
  max-width: 100%; /* Still prevent overflow */
  max-height: 100%;
  /* PageFlip library will set its own size */
  /* Centering handled by parent flexbox */
}

/* Navigation Buttons */
.bcs-nav-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10; /* Above flipbook pages and area */
  background-color: rgba(0, 0, 0, 0.4);
  color: white;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 24px;
  line-height: 40px;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.3s ease;
  padding: 0;
}

.bcs-nav-button:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

.bcs-nav-prev {
  left: 15px;
}

.bcs-nav-next {
  right: 15px;
}

/* Styling for individual pages */
.my-page {
  /* Styles for the page element if needed */
}

.my-page .caption {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 5px;
  text-align: center;
  font-size: 0.9em;
  border-radius: 3px;
}

/* Hard page style */
.my-page[data-density="hard"] {
  background-color: #f0f0f0;
}

/* --- Right Column Placeholder Styles --- */
.bcs-right-header {
  padding: 15px;
  border-bottom: 1px solid #333;
  text-align: center;
}

.bcs-action-buttons {
  display: flex;
  justify-content: space-around;
  padding: 15px;
  border-bottom: 1px solid #333;
}

.bcs-action-buttons button {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  padding: 5px 10px;
  transition: color 0.2s ease;
}

.bcs-action-buttons button:hover {
  color: #fff;
}

.bcs-content-info {
  padding: 15px;
  flex: 1; /* Allows this section to grow and push comments down */
  overflow-y: auto; /* Allow scrolling for content info */
  font-size: 0.9em;
}

.bcs-comments-section {
  padding: 15px;
  border-top: 1px solid #333;
  background-color: #1a1a1a; /* Slightly different background for input area */
}

.bcs-comments-section input[type="text"] {
  background: #333;
  border: 1px solid #444;
  padding: 8px 12px;
  border-radius: 20px;
  color: #fff;
  width: 100%;
  box-sizing: border-box;
}

/* --- End Right Column Placeholder Styles --- */

/* Button that triggers the modal (Keep as is) */
#bcs-open-storybook-modal {
  padding: 10px 20px;
  font-size: 1em;
  cursor: pointer;
  background-color: #0073aa; /* Example WP blue */
  color: white;
  border: none;
  border-radius: 4px;
}

#bcs-open-storybook-modal:hover {
  background-color: #005a8e;
}

/* Remove previous .bcs-modal-content styles as they are replaced by wrapper */
/* Remove previous .bcs-modal-body styles as the role is taken by .bcs-modal-left */

/* Flip Zone Areas for navigation */
.bcs-flipzone-left,
.bcs-flipzone-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 25%;
  cursor: pointer;
  z-index: 9999; /* Above pages */
}

.bcs-flipzone-left {
  left: 0;
}

.bcs-flipzone-right {
  right: 0;
}

.caption {
  background-color: #957c5fa8 !important;
  font-family: "Comic Sans MS";
  bottom: 40px !important;
  font-size: 20px;
  text-align: left; /* Align text to the left */
}

/* Make sure we have Dashicons loaded */
@font-face {
  font-family: dashicons;
  src: url(/wp-includes/fonts/dashicons.woff2);
}

/* Loading Overlay */
.bcs-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #000;
  z-index: 100;
  color: white;
}

.bcs-loading-spinner {
  width: 40px;
  height: 40px;
  margin-bottom: 20px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  border-top-color: #e016af;
  animation: bcs-spin 1s linear infinite;
}

@keyframes bcs-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
/* Related Posts Section */
.bcs-related-posts-section {
  padding: 15px;
  border-top: 1px solid #333;
  max-height: 300px;
  overflow-y: auto;
}

.bcs-related-posts-section h3 {
  font-size: 16px;
  margin: 0 0 15px 0;
  color: #e016af;
  text-align: center;
}

.bcs-related-posts-content {
  font-size: 14px;
}

.bcs-related-posts-content ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.bcs-related-posts-content ul li {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bcs-related-posts-content a {
  color: #fff;
  text-decoration: none;
  transition: color 0.2s;
}

.bcs-related-posts-content a:hover {
  color: #e016af;
}
/* Audio Controls Section */
.bcs-audio-controls-section {
  padding: 15px;
  border-top: 1px solid #333;
  background-color: rgba(0, 0, 0, 0.2);
  display: flex;
  justify-content: center;
  align-items: center;
}

.bcs-audio-controls {
  width: 100%;
  display: flex;
  justify-content: center;
}

.bcs-audio-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 15px;
  background-color: #e016af;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: background-color 0.2s ease;
  width: 90%;
  margin: 0 auto;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.bcs-audio-toggle:hover {
  background-color: #ff47d6;
}

.bcs-audio-toggle .dashicons {
  font-size: 20px;
}

/* --- Highlighting Styles --- */
.word-segment {
  /* Add specific styles for word segments if needed later (e.g., cursor) */
  /* For now, it just acts as a container */
  display: inline-block; /* Ensures spans flow like words */
}

.narration-highlight {
  background-color: yellow; /* Highlight background color */
  color: black; /* Text color for highlighted words for contrast */
  /* Add NO other properties here (like font, padding, margin, etc.) */
  /* Let those be inherited from the parent .caption */
}

.speaking-word-highlight {
  background-color: #fffc85; /* Slightly brighter yellow for the active word */
  color: black;
  /* font-weight: bold; // REMOVED - Caused text jumping */
  /* Ensure background/color overrides/complements .narration-highlight */
  position: relative; /* Needed if using pseudo-elements for underline, etc. */
}
.bcs-related-title {
  color: #cecece !important;
}
