﻿/* 테마별 추천 컬렉션 — 랭킹 페이지로 옮긴 카드·모달 스타일.
   어워드 페이지 CSS 는 그대로 두고, 랭킹에서만 이 파일을 불러온다. */

/* ── 테마별 컬렉션 ── */
.awards-collection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.awards-collection-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 18px;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  grid-template-areas:
    "thumbs title title"
    "thumbs desc desc"
    "thumbs count button";
  column-gap: 16px;
  row-gap: 0;
  align-items: start;
  cursor: pointer;
  transition: border-color 0.3s;
}
.awards-collection-card:hover {
  border-color: rgba(242, 193, 78, 0.2);
}

.awards-collection-thumbs {
  position: relative;
  grid-area: thumbs;
  width: 120px;
  height: 88px;
  align-self: start;
}

.awards-collection-thumb {
  position: absolute;
  width: 72px;
  height: 52px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  border: 2px solid var(--bg-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.awards-collection-thumb-1 { left: 0; top: 0; z-index: 3; }
.awards-collection-thumb-2 { left: 24px; top: 12px; z-index: 2; opacity: 0.85; }
.awards-collection-thumb-3 { left: 48px; top: 24px; z-index: 1; opacity: 0.7; }

.awards-collection-body,
.awards-collection-copy {
  display: contents;
}

.awards-collection-title {
  grid-area: title;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 6px;
  min-width: 0;
}

.awards-collection-desc {
  grid-area: desc;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: 0 0 10px;
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.awards-collection-count {
  grid-area: count;
  align-self: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.awards-collection-btn {
  grid-area: button;
  align-self: center;
  justify-self: end;
  font-size: 0.72rem !important;
  padding: 6px 14px !important;
  height: auto !important;
  min-width: auto !important;
}

/* ────────────────────────────────────────────────────────
   테마별 추천 컬렉션 상세 모달 (PC 중앙 / 모바일 바텀시트)
   ──────────────────────────────────────────────────────── */

/* 어워드 페이지에서 작품 상세 모달이 컬렉션 모달 위에 오도록 z-index 보정 */
body[data-page="awards"] #cinemaDetailModal.active {
  z-index: 3400 !important;
}

.awards-col-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 4, 8, 0.82);
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.awards-col-modal-backdrop.show {
  display: flex;
  opacity: 1;
}

.awards-col-modal-panel {
  position: relative;
  width: 100%;
  max-width: 920px;
  max-height: calc(100vh - 48px);
  background: linear-gradient(165deg, #0c0d12 0%, #090a0f 55%, #07080c 100%);
  border: 1px solid rgba(242, 193, 78, 0.22);
  border-radius: 20px;
  box-shadow:
    0 40px 100px rgba(0, 0, 0, 0.92),
    0 0 60px rgba(242, 148, 30, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96) translateY(8px);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.awards-col-modal-backdrop.show .awards-col-modal-panel {
  transform: scale(1) translateY(0);
}

/* 모바일 전용 — 드래그 핸들 (PC에서는 숨김) */
.awards-col-modal-handle {
  display: none;
}

.awards-col-modal-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 0;
  flex-shrink: 0;
}

.awards-col-modal-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-gold, #f2c14e);
  opacity: 0.9;
}

.awards-col-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-sub, #a0a4b8);
  font-size: 1rem;
  cursor: pointer;
  transition: var(--transition-fast, 0.2s ease);
  flex-shrink: 0;
}

.awards-col-modal-close:hover {
  border-color: rgba(242, 193, 78, 0.45);
  color: var(--accent-gold, #f2c14e);
  background: rgba(242, 193, 78, 0.08);
}

.awards-col-modal-header {
  position: static;
  width: auto;
  height: auto;
  padding: 12px 22px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  background: transparent;
  box-shadow: none;
}

.awards-col-modal-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.awards-col-modal-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text-main, #eef0f6);
  letter-spacing: -0.02em;
}

/* ── 컬렉션 저장 버튼 (메타 영역 내 pill) ── */
.awards-col-save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(242, 193, 78, 0.28);
  background: rgba(242, 193, 78, 0.06);
  color: rgba(210, 215, 228, 0.95);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.22s ease, border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
  line-height: 1.2;
  white-space: nowrap;
}

.awards-col-save-btn:hover {
  color: var(--accent-gold, #f2c14e);
  border-color: rgba(242, 193, 78, 0.5);
  background: rgba(242, 193, 78, 0.1);
  box-shadow: 0 0 16px rgba(242, 148, 30, 0.12);
}

.awards-col-save-btn.active {
  color: var(--accent-gold, #f2c14e);
  border-color: rgba(242, 193, 78, 0.55);
  background: rgba(242, 193, 78, 0.14);
  box-shadow: 0 0 14px rgba(242, 148, 30, 0.18);
}

.awards-col-save-label {
  letter-spacing: -0.01em;
}

/* ── 컬렉션 모달 북마크 아이콘 (작품 카드용) ── */
.awards-col-bmk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: rgba(154, 160, 178, 0.9);
  transition: color 0.22s ease, filter 0.22s ease, transform 0.18s ease;
  line-height: 0;
}

.awards-col-bmk-btn:hover {
  color: var(--accent-gold, #f2c14e);
  filter: drop-shadow(0 0 8px rgba(242, 193, 78, 0.35));
  transform: translateY(-1px);
}

.awards-col-bmk-btn:active {
  transform: translateY(0) scale(0.94);
}

.awards-col-bmk-btn.active {
  color: var(--accent-gold, #f2c14e);
  filter: drop-shadow(0 0 10px rgba(242, 148, 30, 0.4));
}

.awards-col-bmk-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.awards-col-bmk-icon svg {
  display: block;
}

.awards-col-bmk-icon--header svg {
  width: 20px;
  height: 22px;
}

.awards-col-bmk-icon--card svg {
  width: 17px;
  height: 19px;
}

/* 기본: 외곽선만 / 활성: 골드 채움 */
.awards-col-bmk-shape {
  fill: transparent;
  transition: fill 0.22s ease, stroke 0.22s ease;
}

.awards-col-bmk-btn.active .awards-col-bmk-shape {
  fill: rgba(242, 193, 78, 0.32);
  stroke: var(--accent-gold, #f2c14e);
}

.awards-col-save-btn.active .awards-col-bmk-shape {
  fill: rgba(242, 193, 78, 0.32);
  stroke: var(--accent-gold, #f2c14e);
}

.awards-col-bmk-btn--card {
  width: 32px;
  height: 34px;
  align-self: center;
  border-radius: 6px;
}

.awards-col-bmk-btn--card:hover {
  background: rgba(255, 255, 255, 0.04);
}

.awards-col-bmk-btn--card.active {
  background: rgba(242, 193, 78, 0.08);
}

.awards-col-modal-desc {
  margin: 10px 0 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-sub, #9ca3b8);
}

.awards-col-modal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 14px;
  margin-top: 14px;
  margin-bottom: 4px;
}

.awards-col-modal-meta-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}

.awards-col-modal-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-orange, #f2941e);
  white-space: nowrap;
}

.awards-col-modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.awards-col-modal-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(242, 193, 78, 0.25);
  background: rgba(242, 193, 78, 0.07);
  color: rgba(242, 193, 78, 0.92);
}

.awards-col-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 22px 22px;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.awards-col-modal-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted, #6b7280);
  margin-bottom: 12px;
}

/* 작품 리스트 — PC 2열 그리드 */
.awards-col-works-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* 컬렉션 모달 내 작품 카드 — sidebar-ranking-item 스타일 확장 */
.awards-col-work-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
  min-width: 0;
}

.awards-col-work-card:hover {
  border-color: rgba(242, 193, 78, 0.35);
  background: rgba(242, 193, 78, 0.04);
  box-shadow: 0 0 20px rgba(242, 148, 30, 0.08);
}

#awardsCollectionModal .awards-col-work-card.sidebar-ranking-item:hover {
  transform: none;
}

.awards-col-work-card:focus-visible {
  outline: 2px solid rgba(242, 193, 78, 0.45);
  outline-offset: 2px;
}

.awards-col-work-info {
  flex: 1;
  min-width: 0;
}

.awards-col-work-meta {
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 0.72rem;
  color: var(--text-muted, #7a8094);
  margin-top: 3px;
}

.awards-col-work-type {
  flex-shrink: 0;
}

.awards-col-work-genre {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.awards-col-work-sep {
  flex-shrink: 0;
  opacity: 0.55;
  padding-inline: 5px;
  line-height: 1;
  user-select: none;
}

.awards-col-work-stats {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  min-width: 0;
  gap: 0;
  font-size: 0.72rem;
  color: var(--text-sub, #9ca3b8);
  margin-top: 4px;
  overflow: hidden;
}

.awards-col-work-views {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.awards-col-work-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-shrink: 0;
  align-self: stretch;
  padding-left: 2px;
}

.awards-col-work-chevron {
  font-size: 1.05rem;
  font-weight: 300;
  line-height: 1;
  color: rgba(154, 160, 178, 0.55);
  transition: color 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  user-select: none;
}

.awards-col-work-card:hover .awards-col-work-chevron,
.awards-col-work-card:focus-visible .awards-col-work-chevron {
  color: var(--accent-gold, #f2c14e);
  transform: translateX(2px);
}

.awards-col-work-stats .awards-col-work-rating {
  color: var(--accent-gold, #f2c14e);
  font-weight: 700;
  flex-shrink: 0;
  white-space: nowrap;
}

.awards-col-work-stats .awards-col-work-src {
  color: rgba(242, 148, 30, 0.85);
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
}

/* 모바일 — 바텀시트 / 좁은 화면 전체화면형 */
@media (max-width: 768px) {
  .awards-col-modal-backdrop {
    align-items: flex-end;
    padding: 0;
    background: rgba(0, 0, 0, 0.78);
  }

  .awards-col-modal-panel {
    max-width: 100%;
    max-height: min(92vh, calc(100dvh - env(safe-area-inset-top, 0px)));
    border-radius: 20px 20px 0 0;
    border-bottom: none;
    transform: translateY(100%);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .awards-col-modal-backdrop.show .awards-col-modal-panel {
    transform: translateY(0);
  }

  .awards-col-modal-handle {
    display: block;
    width: 44px;
    height: 5px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    margin: 8px auto 2px;
    cursor: pointer;
    flex-shrink: 0;
  }

  .awards-col-modal-header-bar {
    padding: 6px 16px 0;
  }

  .awards-col-modal-close {
    width: 32px;
    height: 32px;
    font-size: 0.92rem;
  }

  .awards-col-modal-header {
    padding: 6px 16px 10px;
  }

  .awards-col-modal-title {
    font-size: 1.08rem;
    line-height: 1.3;
    padding-right: 36px;
  }

  .awards-col-modal-desc {
    margin-top: 5px;
    font-size: 0.8rem;
    line-height: 1.42;
  }

  .awards-col-modal-meta {
    margin-top: 8px;
    gap: 8px;
    align-items: center;
  }

  .awards-col-modal-meta-info {
    gap: 6px 8px;
  }

  .awards-col-modal-tag {
    padding: 2px 7px;
    font-size: 0.62rem;
  }

  .awards-col-modal-count {
    font-size: 0.72rem;
  }

  /* 모바일 — 컬렉션 저장: 아이콘 pill, 제목 영역과 시각적 연결 */
  .awards-col-save-btn {
    position: absolute;
    top: 6px;
    right: 16px;
    padding: 6px 8px;
    border-radius: 8px;
    gap: 0;
  }

  .awards-col-modal-header {
    position: relative;
  }

  .awards-col-save-label {
    display: none;
  }

  .awards-col-save-btn .awards-col-bmk-icon--header svg {
    width: 18px;
    height: 20px;
  }

  /* 터치 기기 — 탭 후 :hover 잔류로 active 해제가 안 보이는 현상 방지 */
  .awards-col-save-btn:not(.active):hover,
  .awards-col-save-btn:not(.active):active {
    color: rgba(210, 215, 228, 0.95);
    border-color: rgba(242, 193, 78, 0.28);
    background: rgba(242, 193, 78, 0.06);
    box-shadow: none;
  }

  .awards-col-save-btn:not(.active):hover .awards-col-bmk-shape,
  .awards-col-save-btn:not(.active):active .awards-col-bmk-shape {
    fill: transparent;
    stroke: currentColor;
  }

  .awards-col-modal-body {
    padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0));
  }

  .awards-col-modal-section-label {
    margin-bottom: 8px;
    font-size: 0.68rem;
  }

  .awards-col-works-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-bottom: 8px;
  }

  .awards-col-work-card {
    padding: 9px 10px;
    gap: 10px;
  }

  .awards-col-work-meta {
    font-size: 0.76rem;
    margin-top: 4px;
    line-height: 1.35;
  }

  .awards-col-work-stats {
    font-size: 0.75rem;
    margin-top: 5px;
    line-height: 1.35;
  }

  .awards-col-work-sep {
    padding-inline: 4px;
  }

  .awards-col-work-chevron {
    font-size: 0.95rem;
  }
}

/* 아주 좁은 화면 — 거의 전체화면 */
@media (max-width: 480px) {
  .awards-col-modal-panel {
    max-height: calc(100dvh - 8px);
    border-radius: 16px 16px 0 0;
  }
}

/*
 * 컬렉션 상세 모달 — 🌐 원제 어시스트 툴팁 보정
 * PC: 상단 카드 툴팁이 헤더에 가려지지 않도록 아래 방향(.below) 배치
 */
@media (min-width: 769px) {
  #awardsCollectionModal .awards-col-work-card.sidebar-ranking-item {
    overflow: visible !important;
  }

  #awardsCollectionModal .awards-col-work-card.sidebar-ranking-item:hover {
    z-index: 12 !important;
  }

  .awards-col-modal-header {
    position: static;
  }

  .awards-col-modal-title {
    padding-right: 0;
  }

  .awards-col-save-btn {
    position: static;
    align-self: center;
  }

  #awardsCollectionModal .title-assist-tooltip.below {
    bottom: auto;
    top: calc(100% + 8px);
    transform: translateX(-50%) translateY(-4px);
    z-index: 1050 !important;
  }

  #awardsCollectionModal .title-assist-tooltip.below::after {
    top: auto;
    bottom: 100%;
    border-color: transparent transparent #1b1d20 transparent;
  }

  #awardsCollectionModal .title-assist-tooltip.below.premium::after {
    border-color: transparent transparent #1b1d20 transparent !important;
  }
}

/* 랭킹 본문 — 작품 상세가 컬렉션 모달 위에 온다 */
body[data-page="ranking"] #cinemaDetailModal.active {
  z-index: 3400 !important;
}

body[data-page="ranking"] .ranking-theme-section {
  min-width: 0;
  overflow: hidden;
}

/* 모바일: 6장을 세로로 쌓지 않고, 한 장과 다음 장 일부가 보이게 가로로 넘긴다 */
@media (max-width: 768px) {
  body[data-page="ranking"] .ranking-theme-section .awards-collection-grid {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  body[data-page="ranking"] .ranking-theme-section .awards-collection-grid::-webkit-scrollbar {
    display: none;
  }

  body[data-page="ranking"] .ranking-theme-section .awards-collection-card {
    flex: 0 0 78%;
    width: 78%;
    max-width: 78%;
    min-width: 0;
    box-sizing: border-box;
    scroll-snap-align: start;
    height: auto;
    min-height: 0;
    /* 제목은 한 줄 전체, 가운데는 썸네일과 설명, 버튼은 아래 왼쪽. 고정 높이는 쓰지 않는다. */
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "title title"
      "thumbs copy"
      "button button";
    column-gap: 12px;
    row-gap: 10px;
    align-items: start;
    align-content: start;
  }

  body[data-page="ranking"] .ranking-theme-section .awards-collection-body {
    display: contents;
  }

  body[data-page="ranking"] .ranking-theme-section .awards-collection-title {
    grid-area: title;
    display: block;
    width: auto;
    margin: 0;
    overflow: visible;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    white-space: normal;
    overflow-wrap: break-word;
  }

  body[data-page="ranking"] .ranking-theme-section .awards-collection-copy {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 8px;
    grid-area: copy;
    min-width: 0;
    align-self: start;
  }

  body[data-page="ranking"] .ranking-theme-section .awards-collection-desc {
    flex: none;
    width: 100%;
    margin: 0;
    -webkit-line-clamp: 3;
  }

  body[data-page="ranking"] .ranking-theme-section .awards-collection-count {
    align-self: start;
    white-space: nowrap;
  }

  body[data-page="ranking"] .ranking-theme-section .awards-collection-btn {
    grid-area: button;
    align-self: start;
    justify-self: center;
    width: auto;
    max-width: 100%;
    margin: 0;
    white-space: nowrap;
  }
}
