/* Base styles */
body {
  font-family: Arial, sans-serif;
  line-height: 1.6;
  background: linear-gradient(135deg, #e9ecef 0%, #e0e4ff 100%);
  margin: 0;
  min-height: 100vh;
}

/* Container and layout */
.container {
  max-width: 800px;
  margin: 40px auto;
  padding: 30px;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Typography */
h1 {
  font-family: "Jacquard 12", serif;
  font-weight: 400;
  font-style: normal;
  font-size: 36pt;
}

.subtitle {
  text-align: center;
  color: #666;
  margin-bottom: 30px;
  font-size: 1.1rem;
  width: 100%;
}

/* Form elements */
form {
  width: 100%;
  max-width: 600px;
}

/* Radio button groups */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
  width: 100%;
}

/* Hide default radio buttons */
.radio-group input[type="radio"] {
  display: none;
}

/* Radio labels and icons */
.radio-group label {
  display: inline-block;
  padding: 10px;
  border-radius: 5px;
  transition: background-color 0.3s, box-shadow 0.3s;
  cursor: pointer;
}

.radio-group label i {
  margin-right: 10px;
  font-size: 18px;
  color: #5cb85c;
  transition: all 0.3s ease;
}

.radio-group label:hover {
  background-color: rgba(92, 184, 92, 0.1);
  box-shadow: 0 0 5px rgba(92, 184, 92, 0.3);
}

.radio-group label:hover i {
  transform: scale(1.1);
}

.radio-group input[type="radio"]:checked + label {
  background-color: rgba(92, 184, 92, 0.2);
  box-shadow: 0 0 10px rgba(92, 184, 92, 0.5);
}

.radio-group input[type="radio"]:checked + label i {
  transform: scale(1.2);
  color: #4cae4c;
}

/* Text area */
textarea {
  width: 100%;
  margin-top: 10px;
  padding: 10px;
}

/* Button */
button[type="submit"] {
  display: none;
  width: 100%;
  padding: 10px;
  background-color: #5cb85c;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 20px;
}

button[type="submit"].visible {
  display: block;
  animation: fadeIn 0.3s ease-in-out;
}

button:hover {
  background-color: #4cae4c;
}

/* Loading spinner */
.loading-spinner {
  text-align: center;
  padding: 20px;
  color: #5cb85c;
}

.loading-spinner i {
  font-size: 40px;
  margin-bottom: 10px;
}

.loading-spinner p {
  color: #666;
  font-size: 16px;
}

/* Results container */
.result-container {
  background: linear-gradient(to right bottom, #ffffff, #f8f9fa);
  border-left: 4px solid #5cb85c;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  margin-top: 30px;
  animation: slideIn 0.5s ease-out;
}

.result-container h2 {
  color: #2c3e50;
  margin-bottom: 15px;
  font-size: 24px;
  animation: fadeIn 0.8s ease-out;
}

.result-container p {
  line-height: 1.8;
  color: #495057;
}

/* Book recommendation display */
.book-recommendation {
  width: 100%;
  position: relative;
  padding: 20px;
  border-radius: 12px;
  background: white;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column; /* Stack elements vertically */
  align-items: center; /* Center contents */
  height: auto;
  max-height: none;
  overflow: visible;
}

.book-cover {
  flex-shrink: 0;
  width: 128px;
}

.book-cover img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.book-details {
  flex: 1;
  overflow: visible;
  height: auto;
  max-height: none;
  min-width: 0;
}

/* Ratings display */
.ratings-container {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.rating-item {
  background-color: #f8f9fa;
  padding: 15px 20px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 120px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}

.rating-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.rating-score {
  font-size: 24px;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 5px;
}

.rating-source {
  color: #666;
  font-size: 0.85em;
  line-height: 1.4;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Media Queries */
@media (max-width: 768px) {
  .container {
    padding: 15px;
    margin: 10px;
  }
  
  h1 {
    font-size: 24px;
    line-height: 1.3;
  }
  
  .radio-group label {
    padding: 12px 10px;
  }
  
  .radio-group label i {
    font-size: 20px;
  }
  
  button {
    padding: 15px;
    font-size: 16px;
  }
  
  textarea {
    min-height: 100px;
  }
}

@media (max-width: 600px) {
  .book-recommendation {
    flex-direction: column;
    align-items: center;
  }
  
  .book-cover {
    margin-bottom: 15px;
  }
  
  .book-details {
    text-align: center;
  }
  
  .ratings-container {
    justify-content: center;
  }
  
  .rating-item {
    min-width: 140px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
    margin: 5px;
  }
  
  .radio-group {
    margin-left: 10px;
  }
}

/* slide down questions */

.question-group {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-20px);
  transition: all 0.5s ease-in-out;
  margin-bottom: 0;
  width: 100%;
}

.question-group.active,
.question-group:first-child {
  max-height: 500px;
  opacity: 1;
  transform: translateY(0);
  margin-bottom: 30px;
}

/* 3 recommendations */
.recommendations-container {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.top-pick {
  border: 2px solid #5cb85c;
}

.top-pick-badge {
  position: absolute;
  top: -12px;
  right: 20px;
  background: #5cb85c;
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-weight: bold;
}

.rank-badge {
  position: absolute;
  top: 10px;
  left: -10px;
  background: #2c3e50;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-weight: bold;
}

/*3 recommendations and loading ratings */
.book-explanation {
  margin: 15px 0;
  padding: 15px;
  background-color: #f8f9fa;
  border-left: 3px solid #5cb85c;
  border-radius: 4px;
  font-style: italic;
  color: #495057;
  overflow: visible; /* Ensure text isn't cut off */
  max-height: none; /* Remove any height restrictions */
  height: auto; /* Allow natural height */
  word-wrap: break-word;
  white-space: normal;
  display: block; /* Ensure it's a block element */
  width: 100%; /* Take full width of parent */
}

/*remove max height for recommendations */
.result-container,
.book-recommendation,
.top-pick {
  height: auto;
  max-height: none;
  overflow: visible;
}

/*done above*/
.loading-ratings {
  text-align: center;
  color: #666;
  padding: 10px;
}

.rating-error {
  color: #856404;
  background-color: #fff3cd;
  padding: 10px;
  border-radius: 4px;
  text-align: center;
}

/*more recommendations button */
.more-btn {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 20px;
  background-color: #f8f9fa;
  border: 2px solid #5cb85c;
  color: #5cb85c;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
}

.more-btn:hover {
  background-color: #5cb85c;
  color: white;
}

.more-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.more-recommendations {
  margin-top: 30px;
  animation: fadeIn 0.5s ease-out;
}

.main-recommendation {
  background: white;
  border-radius: 12px;
  padding: 25px;
  position: relative;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  border: 2px solid #5cb85c;
  margin-bottom: 20px;
}

.additional-recommendation {
  background: white;
  border-radius: 12px;
  padding: 25px;
  position: relative;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  margin-bottom: 20px;
}

.book-title {
  width: 100%;
  font-size: 24px;
  color: #2c3e50;
  margin-bottom: 20px;
  text-align: center; /* Center the title */
}

.book-content {
  display: flex;
  gap: 25px;
  align-items: flex-start;
  width: 100%;
  height: auto;
  max-height: none;
  overflow: visible;
}

.book-cover {
  width: 150px;
  flex-shrink: 0;
}

.book-cover img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.top-pick-badge {
  position: absolute;
  top: -12px;
  right: 20px;
  background: #5cb85c;
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-weight: bold;
}

.rank-badge {
  position: absolute;
  top: -12px;
  left: 20px;
  background: #2c3e50;
  color: white;
  padding: 5px 15px;
  border-radius: 20px;
  font-weight: bold;
}

.rating-item {
  background-color: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.rating-score {
  font-size: 24px;
  font-weight: bold;
  color: #2c3e50;
}

.rating-source {
  color: #666;
  font-size: 0.85em;
  line-height: 1.4;
  margin-top: 5px;
}

.more-btn {
  display: block;
  width: 100%;
  max-width: 300px;
  margin: 30px auto;
  padding: 12px;
  background-color: white;
  border: 2px solid #5cb85c;
  color: #5cb85c;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
}

.more-btn:hover {
  background-color: #5cb85c;
  color: white;
}

.more-recommendations {
  margin-top: 30px;
}
