/* assets/css/modal.css */
.modalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s ease,
    visibility 0.3s ease;
  padding: 40px 0; /* Match Next.js padding */
}

.modalOverlay.open {
  opacity: 1;
  visibility: visible;
}

.modalContent {
  width: 95%;
  max-width: 1400px;
  height: auto;
  max-height: 100%;
  background-color: #f5f5f5; /* Match Next.js bg */
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px; /* Match Next.js radius */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modalHeader {
  padding: 2rem 2.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  background-color: #f5f5f5;
  z-index: 10;
  flex-shrink: 0;
}

.modalInfo {
  flex: 1;
}

.modalTitle {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: #000;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.modalMeta {
  font-size: 1rem;
  color: #000;
  display: flex;
  gap: 2rem;
}

.modalMeta span {
  display: inline-flex;
  align-items: center;
}

.metaLabel {
  font-weight: 700;
  margin-right: 0.5rem;
}

.modalClose {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: 2rem;
  margin-top: -1rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modalBody {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 2.5rem 3rem;
}

.modalImages {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  align-items: stretch;
  width: 100%;
}

.posterSection {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1.414; /* A4 aspect ratio */
}

.gridSection {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1.2rem;
  width: 100%;
  height: 100%;
}

.modalImageWrapper {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.modalImage {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}

.modalImage:hover {
  transform: scale(1.05);
}

.imagePlaceholder {
  width: 100%;
  height: 100%;
  background-color: #f0f0f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 0.875rem;
  border-radius: 8px;
}

@media (max-width: 768px) {
  .modalOverlay {
    padding: 0;
    align-items: flex-start;
  }

  .modalContent {
    height: auto;
    min-height: 100vh;
    max-width: 100%;
    border-radius: 0;
  }

  .modalHeader {
    padding: 3rem 1.5rem 1rem;
  }

  .modalTitle {
    font-size: 1.1rem;
    margin-top: 0.5rem;
    line-height: 1.3;
  }

  .modalMeta {
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.8rem;
    margin-top: 0.5rem;
  }

  .modalBody {
    padding: 0 1.5rem 2rem;
  }

  .modalImages {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    width: 100%;
  }

  /* Poster Section Specifics */
  .posterSection {
    width: 80%;
    margin: 0 auto;
    aspect-ratio: 1 / 1.414; /* Keep poster vertical ratio */
    position: relative;
  }

  .posterSection .modalImageWrapper {
    width: 100%;
    height: 100%;
    aspect-ratio: unset; /* Reset global ratio */
  }

  /* Grid Section Specifics */
  .gridSection {
    width: 80%;
    margin: 0 auto;
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .gridSection .modalImageWrapper {
    width: 100%;
    aspect-ratio: 3 / 2; /* Landscape for grid images */
  }

  .modalClose {
    position: absolute;
    top: 1rem;
    right: 1rem;
    margin: 0;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 32px;
    height: 32px;
  }
}
