/* Modal Styles */

.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(26, 26, 46, 0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.modal-content {
  position: relative;
  background: #FFFFFF;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  border-radius: 12px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.4),
    0 10px 30px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transform: scale(0.9);
  animation: modalZoomIn 0.3s ease forwards 0.1s;
}

@keyframes modalZoomIn {
  to {
    transform: scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.2);
  color: #2C3E50;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 10;
}

.modal-close:hover {
  background: rgba(212, 175, 55, 0.4);
  transform: rotate(90deg);
}

.modal-close:focus {
  outline: 3px solid #D4AF37;
  outline-offset: 2px;
}

.close-icon {
  line-height: 1;
}

.modal-body {
  padding: 2.5rem;
  overflow-y: auto;
  max-height: calc(80vh - 5rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Modal Layout Sections */
.modal-image-section {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-cover-image {
  width: 200px;
  height: auto;
  border: 3px solid #2C3E50;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.modal-image-placeholder {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-info-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Modal Content Elements */
.modal-title {
  font-family: inherit;
  font-size: 2rem;
  font-weight: 700;
  color: #1A1A2E;
  margin-bottom: 0.5rem;
  padding-right: 3rem;
}

.modal-period {
  font-size: 0.95rem;
  color: #6B7280;
  padding: 0.5rem 0;
  border-bottom: 2px solid #F0F0F0;
}

.modal-period strong {
  font-weight: 600;
  color: #4B5563;
  margin-right: 0.5rem;
}

.modal-description {
  font-family: inherit;
  font-size: 1.1rem;
  line-height: 1.8;
  color: #374151;
}

.modal-work-title {
  font-family: inherit;
  font-size: 2rem;
  font-weight: 700;
  color: #1A1A2E;
  margin-bottom: 1rem;
  padding-right: 3rem;
}

.modal-work-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid #F0F0F0;
}

.modal-meta-item {
  font-size: 0.9rem;
  color: #6B7280;
}

.modal-meta-label {
  font-weight: 600;
  color: #4B5563;
  margin-right: 0.5rem;
}

.modal-work-description {
  font-family: inherit;
  font-size: 1.1rem;
  line-height: 1.8;
  color: #374151;
  margin-bottom: 2rem;
}

.modal-work-cover {
  width: 200px;
  height: auto;
  margin: 0 auto 1.5rem;
  border: 3px solid #2C3E50;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.modal-amazon-link {
  display: inline-block;
  background: linear-gradient(135deg, #D4AF37 0%, #F4D03F 100%);
  color: #1A1A2E;
  padding: 1rem 2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.modal-amazon-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.modal-amazon-link:focus {
  outline: 3px solid #D4AF37;
  outline-offset: 2px;
}

/* Responsive */
@media (max-width: 768px) {
  .modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .modal-body {
    padding: 2rem 1.5rem;
    max-height: calc(90vh - 4rem);
  }

  .modal-title,
  .modal-work-title {
    font-size: 1.5rem;
  }

  .modal-description,
  .modal-work-description {
    font-size: 1rem;
  }

  .modal-cover-image,
  .modal-work-cover {
    width: 150px;
  }

  .modal-period {
    font-size: 0.85rem;
  }
}

/* Welcome Modal (First Visit) */
.welcome-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(26, 26, 46, 0.95);
  z-index: 1001; /* Above regular modal */
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.welcome-modal-content {
  background: linear-gradient(135deg, #FFFFFF 0%, #F5F5F0 100%);
  border-radius: 16px;
  padding: 3rem 2.5rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s ease;
}

.welcome-title {
  font-family: inherit;
  font-size: 2rem;
  font-weight: 700;
  color: var(--header-bg);
  text-align: center;
  margin-bottom: 2rem;
  letter-spacing: 0.05em;
}

.welcome-body {
  color: #333;
}

.welcome-intro {
  text-align: center;
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 2rem;
  color: #2C3E50;
}

.welcome-intro strong {
  color: var(--accent-gold);
  font-weight: 700;
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.welcome-feature {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.welcome-icon {
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}

.welcome-feature-text strong {
  display: block;
  font-size: 1.1rem;
  color: #2C3E50;
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.welcome-feature-text p {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #555;
  margin: 0;
}

.welcome-note {
  font-size: 0.8rem !important;
  color: #777 !important;
  margin-top: 0.75rem !important;
  font-style: italic;
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  padding-top: 1.5rem;
  border-top: 2px solid rgba(212, 175, 55, 0.3);
}

.welcome-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: #555;
}

.welcome-checkbox input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.welcome-close-btn {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #F4D03F 100%);
  color: #1A1A2E;
  padding: 1rem 3rem;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.welcome-close-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.welcome-close-btn:active {
  transform: translateY(0);
}

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

/* Responsive for Welcome Modal */
@media (max-width: 768px) {
  .welcome-modal-content {
    padding: 2rem 1.5rem;
    max-width: 90%;
  }

  .welcome-title {
    font-size: 1.6rem;
  }

  .welcome-intro {
    font-size: 1rem;
  }

  .welcome-feature-text strong {
    font-size: 1rem;
  }

  .welcome-feature-text p {
    font-size: 0.9rem;
  }

  .welcome-note {
    font-size: 0.75rem !important;
  }

  .welcome-close-btn {
    padding: 0.875rem 2.5rem;
    font-size: 1rem;
  }
}
