/* ===========================================================
   Modal Styles
   - Styles for the modal overlay, content, and close button.
   =========================================================== */

/* Modal overlay covering the entire viewport */
.modal-overlay {
  display: none;
  position: absolute; /* Changed from absolute to fixed */
  top: 0;
  left: 0;
  padding-top: 50px;
  width: 100vw;
  min-height: 100vh;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
}

/* Modal content container */
.modal-content {
  color: #000;
  border-radius: 10px;
  width: 90%;
  padding: 5%;
  max-width: 800px;
  margin-left: calc(50% - 400px);
  min-height: 100vh;
  padding-top: 60px;
  position: absolute;
  z-index: 20000;
  top: calc(2rem + env(safe-area-inset-top));
}

/* Close button for the modal */
.close-modal {
  position: absolute;
  top: 35px;
  right: 35px;
  cursor: pointer;
  font-size: 4rem;
  line-height: 2rem;
  padding: 0;
  margin: 0;
  color: #f00;
  z-index: 20001;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

/* Adjust modal styles for mobile devices */
@media (max-width: 768px) {
  .modal-content {
    margin-left: 0;
  }
  .close-modal {
    top: 15px;
    right: 15px;
    padding: 15px;
    min-width: 54px;
    min-height: 54px;
  }
}

/* ===========================================================
   Step Visibility
   - Controls display of step elements.
   =========================================================== */
.step {
  display: none;
}
.step.active {
  display: block !important;
}

/* ===========================================================
   Uptos & Related UI Components
   - Styles for "upto-types", buttons, and icons.
   =========================================================== */

/* Uptos container */
.upto-item-types {
  gap: 1rem;
  text-align: center; /* Center the block */
  width: 100%;
}

/* Uptos type button to align icon and text */
.upto-item-type-btn {
  background-color: transparent;
  border: none;
  cursor: pointer;
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 0; /* Optional padding */
  text-align: left; /* Align text to the left */
  display: flex;
  align-items: center; /* Center items vertically */
  min-height: 3rem;
}

/* Icon container within each button */
.upto-item-icon-circle {
  width: 60px;  /* Fixed size */
  height: 60px;
  border-radius: 50%;
  background: #444;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0; /* Prevent shrinking */
}

/* Icon styling inside the circle */
.upto-item-icon-circle span.material-symbols-outlined {
  font-size: 1.75rem;  /* Reduced size */
  color: #fff;
}

/* Title text for adding an upto item */
.add-upto-item-title {
  margin-left: 1rem;
  font-size: 1.5rem;  /* Reduced size */
  color: #444;
  font-weight: 300;
  flex: 1;  /* Allow text to take remaining space */
}

/* Ensure direct child override for title inside button */
.upto-item-type-btn > .add-upto-item-title {
  background: none !important;
  border: none !important;
}
.upto-item-details-content {
  border-top:1px solid #999;
}

/* ===========================================================
   Uptos Form Groups & Suggestions
   - Styling for form groups and suggestion lists.
   =========================================================== */

/* Form group wrapper for upto-related inputs */
.upto-item-form-group {
  margin-bottom: 1rem;
}

/* Input styling for upto forms */
.upto-item-form-group input {
  width: calc(100% - 2rem);
  padding: 1rem;
  font-size: 1rem;
  border: 1px solid #555;
  background: #333;
  color: #fff;
  border-radius: 10px;
}

/* Select box styling */
.upto-item-form-group select {
  width: 100%;
  padding: 0.5rem;
  font-size: 1rem;
  border: 1px solid #555;
  background: #555;
  color: #fff;
  border-radius: 10px;
  margin-top: 0.5rem;
  cursor: pointer;
  min-height: 50px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-left: 1rem;
  background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.5rem;
}

/* Option styling for select boxes */
.upto-item-form-group select option {
  padding: 0.75rem 1rem;
  border-radius: 5px;
  background-color: #555;
  color: #fff;
  font-size: 1rem;
  line-height: 1.5;
}

/* Override select colors for mobile devices */
@media (max-width: 768px) {
  .upto-item-form-group select,
  .upto-item-form-group select option {
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    opacity: 1 !important;
  }
}

/* General option styling and hover effect */
.upto-item-form-group option {
  padding: 0.5rem;
  border-radius: 5px;
}
.upto-item-form-group option:hover {
  background-color: #888;
  transition: 0.3s;
}

/* Suggestion list styling */
.suggestions-list {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  border-radius: 10px;
  background: #555;
  overflow: hidden;
}

/* Suggestion item styling */
.suggestion-item {
  padding: 1rem;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.suggestion-item:last-child {
  border-bottom: none;
}
.suggestion-item:hover {
  background-color: #666;
}
.suggestion-item.selected {
  background-color: #007ACC;
}

/* ===========================================================
   Button Groups
   - Basic styling for button groups and individual buttons.
   =========================================================== */
.btn-group {
  display: block; /* Use block layout */
  margin-top: 1rem;
  text-align: center; /* Center buttons */
}
.btn {
  padding: 0.5rem 1rem;
  cursor: pointer;
  border: none;
  border-radius: 5px;
  font-size: 1rem;
  display: inline-block;
  margin: 0 0.5rem; /* Spacing between buttons */
}
.btn-primary {
  background: #007ACC;
  color: #fff;
}
.btn-secondary {
  background: #ccc;
  color: #333;
}

/* ===========================================================
   Animations
   - Keyframes and animation delays for upto type buttons.
   =========================================================== */
@keyframes flyIn {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Initially hide each upto type button */
.upto-item-types .upto-item-type-btn {
  opacity: 0;
}

/* When the container has a 'show' class, animate buttons in sequence */
.upto-item-types.show .upto-item-type-btn {
  animation: flyIn 0.3s forwards;
}
.upto-item-types.show .upto-item-type-btn:nth-child(1) { animation-delay: 0.05s; }
.upto-item-types.show .upto-item-type-btn:nth-child(2) { animation-delay: 0.1s; }
.upto-item-types.show .upto-item-type-btn:nth-child(3) { animation-delay: 0.15s; }
.upto-item-types.show .upto-item-type-btn:nth-child(4) { animation-delay: 0.2s; }
.upto-item-types.show .upto-item-type-btn:nth-child(5) { animation-delay: 0.25s; }
.upto-item-types.show .upto-item-type-btn:nth-child(6) { animation-delay: 0.3s; }
.upto-item-types.show .upto-item-type-btn:nth-child(7) { animation-delay: 0.35s; }
.upto-item-types.show .upto-item-type-btn:nth-child(8) { animation-delay: 0.4s; }
.upto-item-types.show .upto-item-type-btn:nth-child(9) { animation-delay: 0.45s; }
.upto-item-types.show .upto-item-type-btn:nth-child(10) { animation-delay: 0.5s; }

/* ===========================================================
   Loading Icon
   - Styles for a loading indicator.
   =========================================================== */
.loading-icon {
  display: none;
  margin-top: 0.5rem;
  text-align: center;
}
.loading-icon img {
  width: 30px;
  height: 30px;
}


/* === Book Details Modal Specific Styles === */

#upto-book-details-modal {
  display: none; /* Wordt via JS getoond */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 11000;
  overflow-y: auto;
  padding-top: 50px;
}

#upto-book-details-modal .upto-item-modal-content {
  background: #fff;
  border-radius: 10px;
  max-width: 600px;
  margin: auto;
  padding: 20px;
  position: relative;
}

#upto-book-details-modal .upto-item-close-modal {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 2rem;
  color: #f00;
  cursor: pointer;
  z-index: 11001;
}
.delete-upto-item {
  margin-bottom:15px;
  opacity:.3;
  padding-left:.5rem;
  font-size:.8rem;
  transition: .2s;
}
.delete-upto-item:hover {
  opacity:1;
}
.upto-item-details-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.upto-item-details-header img#modal-upto-item-cover {
  width: 120px;
  height: auto;
  margin-right: 20px;
  border-radius: 5px;
}

.upto-item-details-header .upto-item-info {
  flex: 1;
}

.upto-item-details-header .upto-item-info h2#modal-upto-item-title {
  margin: 0;
  font-size: 1.8rem;
  color: #333;
}

.upto-item-details-header .upto-item-info p#modal-upto-item-author {
  margin: 5px 0 20px 0;
  color: #666;
}

.upto-item-review-section {
  border-top: 1px solid #ddd;
  padding-top: 20px;
}

.upto-item-review-section #upto-item-review-display,
.upto-item-review-section #upto-item-review-edit {
  margin-top: 10px;
}

.upto-item-review-section #upto-item-review-text {
  font-size: 1rem;
  color: #444;
  margin-bottom: 10px;
}

.upto-item-review-section textarea#upto-item-review-textarea {
  width: 100%;
  min-height: 100px;
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 10px;
  font-size: 1rem;
  resize: vertical;
}

#upto-item-edit-review-btn,
#upto-item-save-review-btn {
  background: #007ACC;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
}

