/* action icons */
a:has(svg.bi) {
  text-decoration: none;
}

/* hover only visibility */
.hover-container .hover-only {
  opacity: 0;
  transition: opacity 0.1s ease;
}

.hover-container:hover .hover-only,
.hover-container:focus-within .hover-only {
  opacity: 1;
}

.file-dropzone {
  border: 2px dashed #bbb;
  border-radius: 8px;
  padding: 40px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  width: 100%;
}

.file-dropzone.dragover {
  background-color: #f8f9fa;
  border-color: #0d6efd;
}

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
}

.upload-zone {
  max-width: 900px;
}

.pictures-flex {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}

.picture-thumb {
  width: 140px;
}

.sortable-item {
  cursor: grab;
}

.sortable-item.dragging {
  opacity: 0.5;
}

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

.carousel-track {
  display: flex;
  transition: transform 0.4s ease;
  will-change: transform;
}

.carousel-slide {
  min-width: 100%;
  padding: 40px;
  text-align: center;
  background: #f5f5f5;
  font-size: 24px;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
}

.carousel-btn.prev {
  left: 10px;
}

.carousel-btn.next {
  right: 10px;
}

/* Page title (global) */
.page-title {
  font-size: 1.75rem;
  /* h1이지만 과하지 않게 */
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  color: #212529;
  /* Bootstrap body color */
  position: relative;
}

/* subtle underline accent */
.page-title::after {
  content: "";
  display: block;
  width: 40px;
  height: 3px;
  margin-top: 0.4rem;
  background-color: var(--bs-primary);
  border-radius: 999px;
}

/* optional subtitle */
.page-subtitle {
  font-size: 0.95rem;
  color: #6c757d;
  /* text-muted */
  margin-top: -0.25rem;
  margin-bottom: 1.5rem;
}

/* Back link (global) */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #495057;
  text-decoration: none;
  margin-bottom: 0.75rem;
  transition: color 0.15s ease, transform 0.15s ease;
}

.back-link__icon {
  font-size: 1rem;
  transition: transform 0.15s ease;
}

/* hover */
.back-link:hover {
  color: var(--bs-primary);
  text-decoration: none;
}

.back-link:hover .back-link__icon {
  transform: translateX(-2px);
}

/* hotwire inline edit */
[data-controller="hotwire-inline-edit"]:empty::before {
  content: attr(data-hotwire-inline-edit-blank-placeholder-value);
  color: #999;
  cursor: pointer;
}

[data-controller="hotwire-inline-edit"] {
  .fit-1 {
    width: 1em;
  }

  .fit-2 {
    width: 2em;
  }

  .fit-3 {
    width: 3em;
  }

  .fit-4 {
    width: 4em;
  }

  .fit-5 {
    width: 5em;
  }

  .fit-6 {
    width: 6em;
  }

  .fit-7 {
    width: 7em;
  }

  .fit-8 {
    width: 8em;
  }

  .fit-9 {
    width: 9em;
  }

  .fit-10 {
    width: 10em;
  }

  .fit-15 {
    width: 15em;
  }

  .fit-20 {
    width: 20em;
  }

  .fit-25 {
    width: 25em;
  }

  .fit-30 {
    width: 30em;
  }

  .fit-full {
    width: 100%;
  }

  .fit-auto {
    width: auto;
  }
}

img.persona-thumbnail {
  width: 150px;
  border-radius: 8px;
}

.persona-picture {
  width: 100%;
  text-align: center;

  img.persona-large {
    width: 800px;
    border-radius: 12px;
  }
}

/* ==========================================================================
   Persona Card Component
   ========================================================================== */
.persona-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #1a1a2e;
  aspect-ratio: 3 / 4;
}

.persona-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.persona-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 12px 12px;
  background: linear-gradient(to top,
      rgba(26, 26, 46, 0.95) 0%,
      rgba(26, 26, 46, 0.6) 60%,
      transparent 100%);
}

.persona-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
  letter-spacing: -0.02em;
}

.persona-card-nationality {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 400;
}

/* ==========================================================================
   Persona Select Component
   ========================================================================== */
.persona-select-wrapper {
  margin-bottom: 1rem;
}

.persona-select-trigger {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
}

.persona-select-trigger .selected-persona {
  display: flex;
  flex-direction: column;
  gap: 10px;

  img {
    width: 180px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  }

  .description {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
  }

  .description .name {
    font-size: 1.15rem;
    font-weight: 600;
    color: #212529;
    letter-spacing: -0.01em;
  }

  .description .nationality {
    font-size: 0.9rem;
    color: #6c757d;
  }

  .description .hint {
    margin-top: 4px;
    font-size: 0.8rem;
    color: #adb5bd;
    transition: color 0.2s;
  }

  @media (min-width: 768px) {
    flex-direction: row;
    gap: 16px;
  }
}

.persona-select-trigger:hover .selected-persona .hint {
  color: var(--bs-primary);
}

.persona-select-trigger .persona-card {
  width: 120px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, box-shadow 0.2s;
}

.persona-select-trigger:hover .persona-card {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.persona-select-hint {
  font-size: 0.85rem;
  color: #6c757d;
  transition: color 0.2s;
}

.persona-select-trigger:hover .persona-select-hint {
  color: var(--bs-primary);
}

/* Modal */
.persona-select-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.persona-select-modal.active {
  opacity: 1;
  visibility: visible;
}

.persona-select-modal-content {
  width: 95%;
  max-width: 1000px;
  max-height: 90vh;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.3s;
}

.persona-select-modal.active .persona-select-modal-content {
  transform: scale(1);
}

.persona-select-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid #e9ecef;
  flex-shrink: 0;
}

.persona-select-modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.persona-select-close-btn {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: #6c757d;
  padding: 0;
  transition: color 0.2s;
}

.persona-select-close-btn:hover {
  color: #212529;
}

/* Persona Grid */
.persona-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
  overflow-y: scroll;
}

.persona-grid-item {
  display: block;
  padding: 0;
  border: 3px solid transparent;
  border-radius: 14px;
  background: none;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.persona-grid-item .persona-card {
  border-radius: 11px;
}

.persona-grid-item:hover {
  transform: scale(1.03);
}

.persona-grid-item.selected {
  border-color: var(--bs-primary);
}

/* Responsive adjustments */
@media (max-width: 576px) {
  .persona-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    padding: 1rem;
  }

  .persona-select-modal-content {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
}
.persona-thumbnail {
  width: 100px;
  height: 100px;
}

.persona-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

/* Image Modal */
.image-modal-container {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.image-modal-container.active {
  opacity: 1;
  visibility: visible;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  cursor: pointer;
}

.image-modal-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
}

.image-modal-content img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.image-modal-close {
  position: absolute;
  top: -40px;
  right: -40px;
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s;
}

.image-modal-close:hover {
  transform: scale(1.1);
}
