/* Category Modal System - Alberta Tradesman Literature Hub */

/* ===== Modal Overlay ===== */
.category-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  overflow-y: auto;
}

.category-modal-overlay.modal-open {
  opacity: 1;
  visibility: visible;
}

.category-modal-overlay.modal-closing {
  opacity: 0;
  visibility: hidden;
}

/* ===== Modal Content Container ===== */
.category-modal-content {
  min-height: 100vh;
  background: linear-gradient(135deg, #2B6CB0 0%, #DD6B20 100%);
  position: relative;
  animation: modalSlideIn 0.4s ease-out;
}

.category-modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  animation: pattern-drift 20s linear infinite;
  pointer-events: none;
}

/* ===== Close Button ===== */
.modal-close-btn {
  position: fixed;
  top: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: white;
  font-size: 2rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 10001;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg) scale(1.1);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ===== Modal Header ===== */
.modal-header {
  padding: 4rem 2rem 2rem;
  text-align: center;
  position: relative;
  z-index: 1;
}

.modal-header-content {
  max-width: 800px;
  margin: 0 auto;
}

.category-icon-large {
  font-size: 6rem;
  margin-bottom: 1rem;
  animation: bounce 2s ease-in-out infinite;
}

.modal-title {
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 800;
  color: white;
  margin-bottom: 1rem;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.4);
  letter-spacing: -0.02em;
}

.modal-subtitle {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  margin-bottom: 0;
}

/* ===== Books Section ===== */
.modal-books-section {
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.books-grid-modal {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* ===== Book Cards ===== */
.book-card-modal {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(15px);
  border-radius: 2rem;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.book-card-modal:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ===== Book Cover ===== */
.book-cover-modal {
  height: 200px;
  background: linear-gradient(135deg, #8B4513, #DEB887);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.book-cover-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23DAA520' fill-opacity='0.1'%3E%3Cpath d='M20 20h60v60H20V20zm10 10v40h40V30H30zm5 5h30v30H35V35z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  animation: page-turn 25s linear infinite;
}

.book-spine-modal {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  background: linear-gradient(180deg, #DAA520, #FFD700);
  z-index: 2;
}

.book-title-modal {
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
  padding: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
  z-index: 2;
  position: relative;
}

/* Cover Preview on Hover */
.cover-preview {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  background: white;
  border-radius: 1rem 1rem 0 0;
}

.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 1rem 1rem 0 0;
}

/* Hover hint styling */
.hover-hint {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #FFE4B5, #FFDAA5);
  border-radius: 0.5rem;
  color: #8B4513;
  font-size: 0.9em;
  font-style: italic;
  border: 1px solid #DEB887;
}

/* ===== Book Info ===== */
.book-info-modal {
  padding: 2rem;
}

.book-info-modal h3 {
  font-size: 1.5rem;
  color: var(--color-lit-text);
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.book-description {
  color: var(--color-lit-text);
  opacity: 0.8;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* ===== Book Actions ===== */
.book-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.download-btn,
.summary-btn {
  flex: 1;
  min-width: 140px;
  padding: 1rem 1.5rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.download-btn {
  background: linear-gradient(135deg, #059669, #10B981);
  color: white;
  box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
}

.download-btn:hover {
  background: linear-gradient(135deg, #047857, #059669);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(5, 150, 105, 0.4);
}

.summary-btn {
  background: linear-gradient(135deg, #F59E0B, #D97706);
  color: white;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.summary-btn:hover {
  background: linear-gradient(135deg, #D97706, #B45309);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

/* ===== Modal Footer ===== */
.modal-footer {
  text-align: center;
  padding: 3rem 2rem;
  background: rgba(0, 0, 0, 0.2);
  position: relative;
  z-index: 1;
}

.modal-footer p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ===== Animations ===== */
@keyframes modalSlideIn {
  from {
    transform: translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-15px);
  }
  60% {
    transform: translateY(-8px);
  }
}

@keyframes pattern-drift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}

@keyframes page-turn {
  0% { transform: translate(0, 0); }
  100% { transform: translate(100px, 100px); }
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
  .modal-close-btn {
    top: 1rem;
    right: 1rem;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
  }

  .modal-header {
    padding: 3rem 1rem 1rem;
  }

  .category-icon-large {
    font-size: 4rem;
  }

  .modal-books-section {
    padding: 1rem;
  }

  .books-grid-modal {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .book-actions {
    flex-direction: column;
  }

  .download-btn,
  .summary-btn {
    min-width: 100%;
  }

  .modal-footer {
    padding: 2rem 1rem;
  }
}

@media (max-width: 480px) {
  .book-card-modal {
    border-radius: 1rem;
  }

  .book-info-modal {
    padding: 1.5rem;
  }

  .book-title-modal {
    font-size: 1.2rem;
    padding: 0.8rem;
  }
}

/* ===== Accessibility ===== */
.book-card-modal:focus,
.download-btn:focus,
.summary-btn:focus,
.modal-close-btn:focus {
  outline: 3px solid rgba(255, 255, 255, 0.8);
  outline-offset: 2px;
}

/* ===== Print Styles ===== */
@media print {
  .category-modal-overlay {
    display: none !important;
  }
}