/* ==============================================================================
   ArtFilm - Global Semantic Theme Token Architecture
   (Light · Dark · Sepia · Slate) - 100% WCAG AA Compliance
   ============================================================================== */

/* 전 테마 공통 불변 상수 (레이아웃 & 폰트) */
:root {
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  --font-family: -apple-system, BlinkMacSystemFont, "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", "Segoe UI", sans-serif;
}

/* 1. Light (화사한 킨포크 감성 웜 라이트 - 기본값) */
:root, [data-theme="light"] {
  --bg-main: #f8f9fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f3f5;
  --bg-elevated: #f1f3f5;
  --bg-accordion: #f8fafc;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --text-main: #191f28;
  --text-muted: #4e5968;
  --text-dim: #8b95a1;
  --accent: #d97706;
  --accent-light: rgba(217, 119, 6, 0.1);
  --accent-contrast: #000000;
  --accent-blue: #0284c7;
  --danger: #dc2626;
  --header-bg: rgba(248, 249, 250, 0.92);
  --input-bg: #ffffff;
  --input-text: #191f28;
  --input-border: #cbd5e1;
  --tab-active-bg: #ffffff;
  --tab-active-text: #191f28;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
}

/* 2. Dark (아늑한 차콜 슬레이트) */
[data-theme="dark"] {
  --bg-main: #14171d;
  --bg-card: #1c2027;
  --bg-card-hover: #242932;
  --bg-elevated: #282f3a;
  --bg-accordion: rgba(0, 0, 0, 0.25);
  --border-subtle: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #6b7280;
  --accent: #f59e0b;
  --accent-light: rgba(245, 158, 11, 0.14);
  --accent-contrast: #000000;
  --accent-blue: #38bdf8;
  --danger: #ef4444;
  --header-bg: rgba(20, 23, 29, 0.92);
  --input-bg: #20252e;
  --input-text: #f3f4f6;
  --input-border: rgba(255, 255, 255, 0.14);
  --tab-active-bg: #282f3a;
  --tab-active-text: #ffffff;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
}

/* 3. Sepia (북카페·독립영화 감성의 따뜻한 페이퍼 세피아) */
[data-theme="sepia"] {
  --bg-main: #f4efe6;
  --bg-card: #fcf9f2;
  --bg-card-hover: #ede6d8;
  --bg-elevated: #e8dfcd;
  --bg-accordion: #ebe3d3;
  --border-subtle: rgba(90, 70, 50, 0.1);
  --border-strong: rgba(90, 70, 50, 0.2);
  --text-main: #2c2218;
  --text-muted: #655443;
  --text-dim: #8c7864;
  --accent: #b45309;
  --accent-light: rgba(180, 83, 9, 0.12);
  --accent-contrast: #ffffff;
  --accent-blue: #0369a1;
  --danger: #b91c1c;
  --header-bg: rgba(244, 239, 230, 0.92);
  --input-bg: #ffffff;
  --input-text: #2c2218;
  --input-border: #d4c5b0;
  --tab-active-bg: #ffffff;
  --tab-active-text: #2c2218;
  --shadow-sm: 0 1px 3px rgba(70, 50, 30, 0.06);
  --shadow-lg: 0 10px 25px rgba(70, 50, 30, 0.08);
}

/* 4. Slate (차분하고 모던한 미드나잇 쿨 슬레이트) */
[data-theme="slate"] {
  --bg-main: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-elevated: #334155;
  --bg-accordion: rgba(0, 0, 0, 0.3);
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent-light: rgba(56, 189, 248, 0.15);
  --accent-contrast: #0f172a;
  --accent-blue: #60a5fa;
  --danger: #f87171;
  --header-bg: rgba(15, 23, 42, 0.92);
  --input-bg: #1e293b;
  --input-text: #f8fafc;
  --input-border: #475569;
  --tab-active-bg: #334155;
  --tab-active-text: #ffffff;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  font-size: 15px;

  /* 네이티브 앱 UX & 터치 검색 방지 */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

input, textarea, [contenteditable="true"], .selectable, .selectable-text {
  -webkit-user-select: text;
  user-select: text;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

/* App Container */
.app-container {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-main);
  border-left: 1px solid var(--border-subtle);
  border-right: 1px solid var(--border-subtle);
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-icon {
  font-size: 20px;
  line-height: 1;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.brand-badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 6px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(217, 119, 6, 0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  font-size: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.btn-theme-toggle:active {
  transform: scale(0.92);
}

.btn-pwa-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-main);
  transition: all 0.2s ease;
}

.btn-pwa-pill:active {
  background: var(--bg-card-hover);
  transform: scale(0.97);
}

/* Top Hero Notice */
.hero-banner {
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.08) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-subtle);
}

.hero-banner-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}

.hero-banner-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Navigation 2-in-1 Tabs */
.nav-tabs {
  display: flex;
  padding: 8px 16px;
  gap: 8px;
  background: var(--bg-main);
  position: sticky;
  top: 57px;
  z-index: 40;
  border-bottom: 1px solid var(--border-subtle);
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.tab-btn.active {
  color: var(--tab-active-text);
  background: var(--tab-active-bg);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-light);
}

.tab-badge {
  font-size: 11px;
  padding: 1px 6px;
  background: var(--border-subtle);
  border-radius: var(--radius-pill);
}

.tab-btn.active .tab-badge {
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
}

/* Region & Date Selector */
.filter-scroll-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-subtle);
}

.region-bar, .date-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.region-bar::-webkit-scrollbar, .date-bar::-webkit-scrollbar {
  display: none;
}

.filter-pill, .date-pill {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.filter-pill.active, .date-pill.active {
  background: var(--accent);
  color: #000;
  font-weight: 700;
  border-color: var(--accent);
}

/* Main Content Area */
.main-content {
  flex: 1;
  padding: 12px 16px 80px 16px;
}

/* Section Header */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.section-sub {
  font-size: 12px;
  color: var(--text-dim);
}

/* Movie Card (상영작별 탭) */
.movie-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.movie-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
}

.movie-card:active {
  border-color: var(--border-strong);
}

.movie-card-main {
  display: flex;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
}

.movie-poster {
  width: 84px;
  height: 120px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #202228;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
}

.movie-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.movie-badge-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.movie-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.badge-special {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
}

.movie-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 4px;
}

.movie-info {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 8px;
}

.movie-theaters-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--accent);
  font-weight: 600;
}

/* Movie Schedules Box (카드 하단 펼침) */
.movie-schedules-box {
  background: var(--bg-accordion);
  border-top: 1px solid var(--border-subtle);
  padding: 12px 14px;
}

.theater-schedule-group {
  margin-bottom: 10px;
}

.theater-schedule-group:last-child {
  margin-bottom: 0;
}

.theater-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.ts-theater-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}

.ts-theater-area {
  font-size: 11px;
  color: var(--text-dim);
}

.time-pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.time-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12px;
  transition: all 0.2s;
}

.time-pill:hover, .time-pill:active {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.time-pill .tp-time {
  font-weight: 700;
  font-size: 13px;
}

.time-pill .tp-hall {
  font-size: 9.5px;
  opacity: 0.8;
}

.time-pill.special-pill {
  border-color: rgba(245, 158, 11, 0.4);
}

.special-notice {
  font-size: 10.5px;
  color: var(--accent);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Theater Card (극장별 탭) */
.theater-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.theater-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.2s;
}

.theater-card-head {
  padding: 16px;
  cursor: pointer;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.tc-title-wrap {
  flex: 1;
}

.tc-area-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 7px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.tc-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 2px;
}

.tc-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 4px;
}

.tc-stats-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.tc-stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.tc-chevron {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: transform 0.3s ease;
}

.theater-card.expanded .tc-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

/* Theater Detail Body (시간표 + 맛집 결합) */
.theater-card-body {
  display: none;
  background: var(--bg-accordion);
  border-top: 1px solid var(--border-subtle);
  padding: 14px 16px;
}

.theater-card.expanded .theater-card-body {
  display: block;
}

/* Sub Tab (시간표 vs 맛집) */
.sub-tab-bar {
  display: flex;
  gap: 6px;
  background: var(--bg-elevated);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.sub-tab-btn {
  flex: 1;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  transition: all 0.2s;
}

.sub-tab-btn.active {
  background: var(--tab-active-bg);
  color: var(--tab-active-text);
  box-shadow: var(--shadow-sm);
}

/* Place Card (금강산도 식후경 맛집 카드) */
.place-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.place-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pc-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pc-category-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.pc-name {
  font-size: 14px;
  font-weight: 700;
}

.pc-walk-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
}

.pc-summary {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.pc-menu {
  font-size: 11.5px;
  color: var(--text-dim);
}

.pc-map-btn {
  align-self: flex-start;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-blue);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-sheet {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
}

.modal-close-btn {
  font-size: 20px;
  color: var(--text-dim);
  padding: 4px 8px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-primary {
  padding: 9px 16px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
  font-size: 13.5px;
  border-radius: var(--radius-md);
  transition: opacity 0.2s;
}

.btn-primary:active {
  opacity: 0.85;
}

.btn-secondary {
  padding: 9px 16px;
  background: var(--bg-elevated);
  color: var(--text-main);
  font-size: 13.5px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

/* Global Form Elements Semantic Alignment */
input[type="text"], input[type="password"], textarea, select {
  background: var(--input-bg) !important;
  color: var(--input-text) !important;
  border: 1px solid var(--input-border) !important;
  font-family: inherit;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent) !important;
}

/* Footer & Legal */
.app-footer {
  padding: 24px 16px 40px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.6;
  text-align: center;
}

.legal-links {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.legal-btn {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: underline;
}
