/* ================================================================
   오늘의 문화공연 — Amber/Earth Theme (#B45309 / #78350F)
   ================================================================ */

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

:root {
  --brand:       #B45309;
  --brand-dark:  #78350F;
  --brand-light: #FEF3C7;
  --brand-alt:   #D97706;
  --bg:          #FFFBEB;
  --surface:     #FFFFFF;
  --surface2:    #FFF8E7;
  --border:      #EADCB8;
  --text:        #1A1A1A;
  --text-muted:  #6B7280;
  --radius:      16px;
  --radius-sm:   10px;
  --shadow:      0 4px 20px rgba(0,0,0,.08);
  --shadow-sm:   0 2px 8px rgba(0,0,0,.06);
  font-family: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { background: var(--bg); color: var(--text); min-height: 100dvh; overflow-x: hidden; font-size: 16px; line-height: 1.6; }
button { cursor: pointer; border: none; font-family: inherit; background: none; }
a { text-decoration: none; color: inherit; }

.layout-container {
  display: grid; grid-template-columns: 1fr 300px; gap: 24px;
  max-width: 1100px; margin: 0 auto; padding: 24px 20px 48px;
}
@media (max-width: 800px) {
  .layout-container { grid-template-columns: 1fr; padding: 16px 12px 40px; }
  .app-sidebar { display: none; }
}
@media (max-width: 520px) {
  .hero-title { font-size: 20px; }
  .hero-desc { font-size: 13px; }
  .event-grid { grid-template-columns: 1fr !important; }
}

.ad-container { display: block; width: 100%; text-align: center; }
.top-ad { background: #f9f9f9; padding: 8px 0; border-bottom: 1px solid var(--border); }
.middle-ad { margin: 16px 0; }
.bottom-ad { margin-top: 24px; padding: 16px 0; border-top: 1px solid var(--border); }

.main-header {
  background: linear-gradient(135deg, #78350F 0%, #B45309 60%, #D97706 100%);
  padding: 16px 16px 28px; position: relative; overflow: hidden;
}
.main-header::before { content:''; position:absolute; top:-40px; right:-40px; width:160px; height:160px; border-radius:50%; background:rgba(255,255,255,.08); }
.main-header::after { content:''; position:absolute; bottom:-30px; left:20px; width:100px; height:100px; border-radius:50%; background:rgba(255,255,255,.06); }
.header-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  position: relative; z-index: 1;
}
.header-logo { display: flex; align-items: center; gap: 12px; }
.header-logo-icon {
  font-size: 28px; background: rgba(255,255,255,.2); border-radius: 12px;
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
}
.header-logo h1 { font-size: 22px; font-weight: 800; color: #fff; letter-spacing: -.5px; }
.header-logo h1 a { color: #fff; }
.header-logo p { font-size: 13px; color: rgba(255,255,255,.85); margin-top: 2px; }
.btn-share {
  font-size: 13px; color: rgba(255,255,255,.95);
  padding: 7px 14px; border-radius: 20px;
  background: rgba(255,255,255,.2); border: 1.5px solid rgba(255,255,255,.4);
  font-weight: 600; z-index: 1; transition: background .15s;
}
.btn-share:hover { background: rgba(255,255,255,.3); }
.header-hero { max-width: 1100px; margin: 16px auto 0; position: relative; z-index: 1; }
.hero-title { font-size: 26px; font-weight: 900; color: #fff; letter-spacing: -.5px; }
.hero-desc { font-size: 15px; color: rgba(255,255,255,.9); margin-top: 4px; }

.app-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px;
}
.card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.card-header-icon { font-size: 18px; }
.card-header-title { font-size: 15px; font-weight: 700; flex: 1; }
.count-badge { font-size: 12px; color: var(--brand-dark); background: var(--brand-light); padding: 3px 9px; border-radius: 99px; font-weight: 700; }
.card-body { padding: 20px; }

.screen { display: none; }
.screen.active { display: block; }

/* Search + filter */
.search-row { display: flex; gap: 8px; margin-bottom: 16px; }
.search-row input {
  flex: 1; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--surface2);
  font-size: 15px; font-family: inherit; color: var(--text);
  outline: none; transition: border-color .15s;
}
.search-row input:focus { border-color: var(--brand); background: #fff; }

.filter-label { font-size: 12px; font-weight: 700; color: var(--text-muted); margin: 8px 0 6px; letter-spacing: .3px; }
.chip-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip-btn {
  padding: 7px 13px; border-radius: 99px;
  background: var(--brand-light); color: var(--brand-dark);
  font-size: 13px; font-weight: 700;
  border: 1.5px solid transparent; transition: background .15s, border-color .15s;
}
.chip-btn:hover { background: #FDE68A; }
.chip-btn.active {
  background: var(--brand); color: #fff; border-color: var(--brand-dark);
  box-shadow: 0 2px 8px rgba(180,83,9,.3);
}

/* Buttons */
.btn-primary {
  display: block; width: 100%; padding: 15px;
  background: var(--brand); color: #fff;
  border-radius: var(--radius-sm); font-size: 16px; font-weight: 800;
  box-shadow: 0 4px 16px rgba(180,83,9,.3); transition: opacity .15s, transform .1s;
}
.btn-primary:hover { opacity: .92; transform: translateY(-1px); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; }
.btn-row button { flex: 1; }
.btn-secondary {
  padding: 13px; border-radius: var(--radius-sm);
  background: #fff; color: var(--brand); border: 1.5px solid var(--brand);
  font-size: 14px; font-weight: 700;
}
.btn-secondary:hover { background: var(--brand-light); }

/* Event grid */
.event-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
}
.event-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 12px; transition: transform .1s, box-shadow .15s;
  cursor: pointer;
}
.event-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(180,83,9,.18); }
.event-thumb {
  width: 100%; aspect-ratio: 4/3; background: var(--brand-light) center/cover no-repeat;
  position: relative;
}
.event-thumb-placeholder {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-size: 40px; opacity: .5;
}
.event-type-tag {
  position: absolute; top: 8px; left: 8px;
  font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 99px;
  background: rgba(120,53,15,.85); color: #fff;
}
.event-free-tag {
  position: absolute; top: 8px; right: 8px;
  font-size: 11px; font-weight: 800;
  padding: 3px 9px; border-radius: 99px;
  background: #059669; color: #fff;
}
.event-info { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; gap: 5px; }
.event-title {
  font-size: 14px; font-weight: 800; color: var(--text);
  line-height: 1.4; word-break: keep-all;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.event-meta { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.event-meta b { color: var(--brand-dark); font-weight: 700; }

.loading, .empty {
  text-align: center; padding: 40px 20px;
  color: var(--text-muted); font-size: 14px;
  grid-column: 1 / -1;
}
.empty { font-weight: 600; }

.load-more-wrap { margin-top: 14px; text-align: center; }
.load-more-wrap .btn-secondary { display: inline-block; padding: 10px 28px; }

/* Detail */
.detail-hero {
  background: linear-gradient(135deg, #78350F 0%, #B45309 100%);
  color: #fff; border-radius: var(--radius);
  padding: 24px 20px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.detail-type {
  display: inline-block; font-size: 12px; font-weight: 800;
  padding: 4px 12px; border-radius: 99px;
  background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.4);
  margin-bottom: 10px;
}
.detail-title {
  font-size: 24px; font-weight: 900; letter-spacing: -.5px;
  line-height: 1.3; word-break: keep-all;
}
.detail-period { font-size: 14px; opacity: .92; margin-top: 8px; }

.detail-image {
  width: 100%; max-height: 420px; object-fit: cover;
  border-radius: var(--radius); margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.detail-table {
  width: 100%; border-collapse: collapse;
}
.detail-table tr { border-top: 1px solid var(--border); }
.detail-table tr:first-child { border-top: none; }
.detail-table th, .detail-table td {
  padding: 11px 8px; font-size: 14px; text-align: left;
  word-break: keep-all; vertical-align: top;
}
.detail-table th {
  width: 84px; color: var(--brand-dark); font-weight: 700;
  white-space: nowrap;
}
.detail-table td { color: #374151; }
.detail-table a { color: var(--brand); text-decoration: underline; }

.detail-desc {
  font-size: 14px; color: #374151; line-height: 1.8;
  word-break: keep-all;
}
.detail-desc p { margin-bottom: 10px; }
.detail-desc img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; }

.external-btn {
  display: inline-block; padding: 11px 22px;
  background: var(--brand); color: #fff;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 800;
  margin-top: 8px; transition: opacity .15s;
}
.external-btn:hover { opacity: .9; }

/* Info / popular */
.info-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px;
}
.info-card h2 { font-size: 16px; font-weight: 800; margin-bottom: 12px; }
.info-card p { font-size: 14px; color: #374151; line-height: 1.75; margin-bottom: 8px; word-break: keep-all; }

.popular-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.popular-link {
  display: inline-block; padding: 7px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 99px; font-size: 13px; font-weight: 600;
  color: var(--brand-dark); transition: background .15s;
}
.popular-link:hover { background: var(--brand-light); border-color: var(--brand); }

/* Sidebar */
.app-sidebar {
  position: sticky; top: 24px;
  max-height: calc(100vh - 48px); overflow-y: auto;
  scrollbar-width: none; -ms-overflow-style: none;
}
.app-sidebar::-webkit-scrollbar { display: none; }
.sidebar-card { background: var(--surface); border-radius: var(--radius-sm); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.sidebar-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; padding-left: 8px; border-left: 3px solid var(--brand); color: var(--text); }
.sidebar-list { list-style: none; padding: 0; margin: 0; }
.sidebar-list li { margin-bottom: 6px; }
.sidebar-list a { display: flex; align-items: flex-start; text-decoration: none; color: var(--text); padding: 7px 8px; border-radius: 8px; transition: background .15s; }
.sidebar-list a:hover { background: var(--brand-light); }
.link-icon { margin-right: 8px; font-size: 15px; flex-shrink: 0; margin-top: 1px; }
.link-content { flex: 1; min-width: 0; }
.link-title { display: block; font-size: 13px; font-weight: 600; color: var(--brand); margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-desc { display: block; font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main-footer {
  border-top: 1px solid var(--border); padding: 20px;
  text-align: center; font-size: 12px; color: var(--text-muted);
}

/* Toast */
.share-toast {
  position: fixed; bottom: 80px; left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1A1F36; color: #fff;
  padding: 12px 22px; border-radius: 99px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  opacity: 0; transition: opacity .2s, transform .2s;
  z-index: 9999; box-shadow: 0 4px 20px rgba(0,0,0,.25); pointer-events: none;
}
.share-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.booking-row { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 10px; }
@media (min-width: 520px) { .booking-row { grid-template-columns: 1fr 1fr 1fr; } }
.booking-btn { display: block; text-align: center; padding: 12px 14px; border-radius: 10px; font-weight: 700; font-size: 14px; text-decoration: none; border: 1.5px solid transparent; transition: transform .1s, box-shadow .15s; }
.booking-btn:active { transform: scale(.98); }
.booking-interpark { background: #0072CE; color: #fff; }
.booking-yes24 { background: #1e40af; color: #fff; }
.booking-melon { background: #00CD3C; color: #fff; }
