/* ========== CSS VARIABLES (TIME-BASED THEMING) ========== */
:root {
  /* Default colors (Morning theme) - these will be updated by JS */
  --main-bg-color: #f9f7f2;
  --main-bg-gradient: #f0ece6;
  --speech-bg-color: #ffffff;
  --text-color: #5d4777;
  --text-color-secondary: #666666;
  --panel-bg-color: #f9f7f4;
  --panel-border-color: #e1ddd2;
  --panel-highlight: #ffedd8;
  --panel-highlight-border: #ffaa33;
  --header-footer-bg: #5d4777;
  --button-color: #d4af37;
  --featured-text: #ffffff;
}

/* ========== BASIC RESET & LAYOUT ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Georgia', serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--main-bg-color);
  display: flex;
  flex-direction: column;
  min-height: 100%; /* Keep this */
  position: relative; /* For positioning context */
}

.container {
  display: flex;
  flex-direction: column;
  flex: 1 0 auto;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  background-color: transparent;
}

/* Ensure the glyph background is below content but visible */
.glyph-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

main {
  background-color: transparent;
  padding: 20px 30px;
  min-height: 500px;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  flex: 1 0 auto; /* This makes it take all available space */
}

/* ========== HEADER & FOOTER ========== */
header {
  text-align: center;
  background-color: var(--header-footer-bg);
  padding: 20px;
  color: var(--featured-text);
  width: 100%;
}

h1 {
  color: var(--featured-text);
}



footer {
  flex-shrink: 0;
  text-align: center;
  padding: 15px;
  background-color: var(--header-footer-bg);
  color: var(--featured-text);
  width: 100%;
  z-index: 1; /* Above the glyphs */
}

footer a {
  color: var(--featured-text);
  text-decoration: underline;
}

/* ========== LIBRARIAN STYLING ========== */
.librarian-container {
  display: flex;
  margin-bottom: 30px;
  align-items: flex-start;
}

.librarian-image {
  flex: 0 0 350px;
  margin-right: 25px;
}

.librarian-portrait, .librarian-image img {
  width: 100%;
  max-width: 350px;
}

/* Speech bubble styling */
.librarian-speech, .speech-bubble {
  position: relative;
  background-color: var(--speech-bg-color);
  border-radius: 10px;
  padding: 25px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  flex: 1;
  color: var(--text-color);
}

.librarian-speech:before, .speech-bubble:before {
  content: '';
  position: absolute;
  left: -20px;
  top: 50px;
  width: 0;
  height: 0;
  border-top: 15px solid transparent;
  border-right: 20px solid var(--speech-bg-color);
  border-bottom: 15px solid transparent;
}

.speech-bubble.no-pointer:before, .librarian-speech.no-pointer:before {
  display: none;
}

.librarian-speech p, .speech-bubble p {
  margin-bottom: 15px;
  line-height: 1.6;
}

.librarian-speech p:first-child, .speech-bubble p:first-child {
  font-style: italic;
  color: var(--text-color);
}

.question-text {
  font-size: 1.2em;
  font-weight: bold;
  color: var(--text-color);
}

.book-description {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid var(--panel-border-color);
}

/* ========== QUIZ FORM STYLING ========== */
.quiz-form {
  background-color: transparent;
  padding: 0;
  box-shadow: none;
  margin-top: 20px;
}

.options-container {
  margin-bottom: 20px;
}

.option {
  background-color: var(--speech-bg-color);
  margin-bottom: 15px;
  border: 1px solid var(--panel-border-color);
  border-radius: 5px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.option:hover {
  background-color: var(--panel-highlight);
  border-color: var(--panel-highlight-border);
}

.option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.option label {
  display: block;
  padding: 15px 15px 15px 45px;
  cursor: pointer;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  color: var(--text-color);
}

.option label:before {
  content: '';
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border: 1px solid var(--text-color);
  border-radius: 50%;
  background-color: var(--speech-bg-color);
}

.option input[type="radio"]:checked + label {
  background-color: var(--panel-highlight);
}

.option input[type="radio"]:checked + label:before {
  background-color: var(--text-color);
  box-shadow: inset 0 0 0 4px var(--speech-bg-color);
}

/* ========== BUTTON STYLING ========== */
.btn {
  display: inline-block;
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  font-weight: bold;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: var(--button-color);
  color: var(--featured-text);
  padding: 12px 30px;
  font-size: 1.1em;
}

.btn-primary:hover {
  background-color: var(--button-color);
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
  background-color: var(--header-footer-bg);
  color: var(--featured-text);
  padding: 10px 20px;
  font-size: 0.95em;
}

.btn-secondary:hover {
  background-color: var(--header-footer-bg);
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-alternative {
  background-color: #8a8395;
  color: white;
  padding: 10px 20px;
  font-size: 0.95em;
}

.btn-alternative:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-back {
  padding: 12px 24px;
  margin: 10px;
  border: none;
  border-radius: 5px;
  font-family: Georgia, serif;
  font-size: 16px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: #e9ecef;
  color: #495057;
  border: 1px solid #ced4da;
}

.btn-back:hover {
  background-color: #5a6268;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-info {
  background-color: #3498db;
  color: white;
}

.form-actions {
  text-align: center;
  margin-top: 30px;
}

/* Button container for centering and organization */
.button-container {
  text-align: center;
  margin: 30px auto;
  width: 100%;
}

.button-container .btn-primary {
  display: block;
  margin: 0 auto 20px;
  max-width: 250px;
}

.secondary-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 15px;
}

.secondary-buttons .btn {
  font-size: 0.9em;
  padding: 8px 16px;
  min-width: 120px;
}

/* Responsive adjustments for the buttons */
@media (max-width: 768px) {
  .secondary-buttons {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  
  .secondary-buttons .btn {
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
  }
}

/* For standalone buttons and other button containers */
.actions {
  text-align: center;
  margin: 30px auto;
  width: 100%;
}

.take-quiz-button, a.btn-primary {
  display: inline-block;
  text-align: center;
}
/* ========== BOOK RECOMMENDATIONS STYLING ========== */
.books-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-bottom: 30px;
}

.book-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background-color: var(--speech-bg-color);
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-top: 40px;
}

.book-card.top-match {
  background-color: rgba(255, 245, 220, 0.95);
  border: 2px solid var(--button-color);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.top-recommendation-message {
  background-color: var(--button-color);
  color: var(--featured-text);
  font-weight: bold;
  padding: 10px 15px;
  border-radius: 5px 5px 0 0;
  text-align: center;
  position: absolute;
  top: -40px;
  left: 0;
  right: 0;
  width: 100%;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  z-index: 100;
}

.book-cover {
  display: flex;
  justify-content: center;
  margin-bottom: 15px;
}

.thumbnail {
  max-width: 150px;
  max-height: 225px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
}

.book-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.book-info h3 {
  margin-top: 10px;
  margin-bottom: 10px;
  text-align: center;
  color: var(--text-color);
}

.match-percent {
  font-weight: bold;
  margin-bottom: 15px;
  color: var(--text-color);
  text-align: center;
}

.top-match .match-percent {
  color: var(--button-color);
}

.book-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.book-actions a {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
  text-align: center;
  box-sizing: border-box;
}

.no-cover {
  width: 120px;
  height: 180px;
  background-color: var(--panel-bg-color);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 14px;
  color: var(--text-color-secondary);
}

.buy-button {
  display: inline-block;
  background-color: var(--header-footer-bg);
  color: white;
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
  margin-top: 10px;
  font-weight: bold;
}

.buy-button:hover {
  background-color: var(--header-footer-bg);
  opacity: 0.9;
}

/* ========== BOOK DETAILS PAGE ========== */
.book-details-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

.book-title {
  color: var(--text-color);
  text-align: center;
  margin-top: 0;
  margin-bottom: 5px;
}

.book-author {
  text-align: center;
  color: var(--text-color-secondary);
  font-style: italic;
  margin-bottom: 25px;
}

.book-details {
  display: flex;
  margin-bottom: 20px;
}

/* ========== MATCH DETAILS & SCORE TABLE ========== */
.match-details {
  margin: 15px 0;
  padding: 10px;
  background-color: var(--panel-bg-color);
  border-radius: 5px;
}

.match-details h3, .match-details h4 {
  text-align: center;
  margin-bottom: 15px;
  color: var(--text-color);
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

.score-table th {
  background-color: var(--header-footer-bg);
  color: var(--featured-text);
  text-align: left;
  padding: 8px;
}

.score-table td {
  border-bottom: 1px solid var(--panel-border-color);
  padding: 8px;
  color: var(--text-color);
}

.score-table tr:nth-child(even) {
  background-color: var(--panel-bg-color);
}

.score-table tr:hover {
  background-color: var(--panel-highlight);
}

/* ========== SOCIAL SHARE STYLING ========== */
.social-share-container {
  margin: 25px 0;
  padding: 0 15px;
  text-align: center;
}

.social-share-heading {
  font-family: Georgia, serif;
  font-size: 22px;
  color: var(--text-color);
  margin-bottom: 15px;
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 0;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: none;
  border-radius: 5px;
  font-family: Georgia, serif;
  font-size: 14px;
  min-width: 90px;
  height: 40px;
  text-decoration: none;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  gap: 6px;
}

/* Platform-specific button colors */
.share-btn.facebook {
  background-color: #3b5998;
}

.share-btn.x-twitter {
  background-color: #000000;
}

.share-btn.bluesky {
  background-color: #0085ff;
}

.share-btn.pinterest {
  background-color: #bd081c;
}

.share-btn.discord {
  background-color: #5865F2;
}

.share-btn.email {
  background-color: #7d7d7d;
}

/* Social icon styling */
.social-icon {
  width: 16px;
  height: 16px;
  filter: brightness(0) invert(1); /* Makes icons white */
  margin-right: 6px;
  vertical-align: middle;
}

/* Hover effects */
.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  opacity: 0.9;
}

/* ========== INDEX/LANDING PAGE STYLING ========== */
.welcome-section {
  margin-bottom: 40px;
  text-align: center;
}

.welcome-title {
  color: var(--text-color);
  margin-bottom: 15px;
  font-size: 2em;
}

.welcome-description {
  color: var(--text-color);
  font-size: 1.2em;
  line-height: 1.6;
  margin-bottom: 30px;
}

.start-quiz-button {
  display: inline-block;
  padding: 15px 30px;
  background-color: var(--button-color);
  color: var(--featured-text);
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  font-size: 1.2em;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.start-quiz-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.start-quiz-button:active {
  transform: translateY(-1px);
}

/* Animated button glow effect */
@keyframes button-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.6);
  }
  50% {
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.9);
  }
}

.glow-effect {
  animation: button-glow 2s infinite;
}

/* Features section */
.features-section {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 30px;
  margin-bottom: 40px;
}

.feature-card {
  background-color: var(--speech-bg-color);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
}

.feature-title {
  color: var(--text-color);
  margin-bottom: 10px;
}

.feature-description {
  color: var(--text-color-secondary);
}

/* Info section */
.info-section {
  background-color: var(--panel-bg-color);
  padding: 30px;
  border-radius: 10px;
  margin-bottom: 40px;
}

.info-title {
  color: var(--text-color);
  margin-bottom: 15px;
  text-align: center;
}

.info-text {
  color: var(--text-color);
  line-height: 1.7;
}

/* ========== EASTER EGG CONTAINER ========== */
.easter-egg-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.easter-egg {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  z-index: 10000;
}

.mango {
  max-width: 80px;
  max-height: 80px;
  animation: wobble 3s infinite ease-in-out;
}

@keyframes wobble {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 900px) {
  .books-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .librarian-container {
    flex-direction: column;
  }
  
  .librarian-image, 
  .librarian-speech {
    width: 100%;
  }
  
  .librarian-image {
    padding-right: 0;
    margin-bottom: 20px;
    text-align: center;
  }
  
  .librarian-portrait, .librarian-image img {
    max-width: 150px;
  }
  
  .librarian-speech:before, .speech-bubble:before {
    left: 50%;
    top: -15px;
    transform: translateX(-50%);
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: none;
    border-bottom: 20px solid var(--speech-bg-color);
  }
  
  .share-buttons {
    gap: 6px;
  }
  
  .share-btn {
    padding: 6px 10px;
    font-size: 13px;
    min-width: 80px;
    height: 36px;
  }
  
  .social-icon {
    margin-right: 5px;
  }
  
  .book-actions {
    flex-direction: column;
  }
  
  .features-section {
    grid-template-columns: 1fr;
  }
  
  .welcome-title {
    font-size: 1.8em;
  }
  
  .welcome-description {
    font-size: 1.1em;
  }
  
  .start-quiz-button {
    padding: 12px 25px;
    font-size: 1.1em;
  }
}

@media (max-width: 600px) {
  .books-container {
    grid-template-columns: 1fr;
  }
  
  .social-share-container {
    margin: 15px 0;
    padding: 0 10px;
  }
  
  .social-share-heading {
    font-size: 18px;
    margin-bottom: 10px;
  }
  
  .share-buttons {
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0;
  }
  
  .share-btn {
    padding: 6px 8px;
    font-size: 12px;
    min-width: 65px;
    height: 32px;
    margin: 2px;
  }
  
  .social-icon {
    width: 14px;
    height: 14px;
    margin-right: 5px;
  }
}

@media (max-width: 380px) {
  .social-share-heading {
    font-size: 16px;
  }
  
  .share-btn {
    padding: 4px 6px;
    font-size: 11px;
    min-width: 55px;
    height: 28px;
  }
  
  .social-icon {
    width: 12px;
    height: 12px;
    margin-right: 4px;
  }
}