/* ================================================
   고확 다시보기 - Aurora Dark Design System
   Modern glassmorphism & gradient design
   Inspired by Linear, Vercel, Stripe, Apple
   ================================================ */

/* === CSS Variables === */
:root {
  /* Colors - Deep Space Dark */
  --bg-primary: #050507;
  --bg-secondary: #0c0c10;
  --bg-tertiary: #141418;
  --bg-hover: #1a1a20;
  --bg-active: #222228;

  /* Glassmorphism */
  --glass-bg: rgba(20, 20, 24, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(20px);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.04);
  --border-default: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(20, 184, 166, 0.5);

  /* Text */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-muted: #475569;

  /* Accent - Teal gradient base */
  --accent: #14b8a6;
  --accent-hover: #0d9488;
  --accent-subtle: rgba(20, 184, 166, 0.12);
  --accent-glow: rgba(20, 184, 166, 0.3);

  /* Secondary accent */
  --accent-2: #2dd4bf;
  --accent-3: #06b6d4;

  /* Gradients */
  --gradient-accent: linear-gradient(135deg, #14b8a6 0%, #2dd4bf 50%, #06b6d4 100%);
  --gradient-glow: linear-gradient(135deg, rgba(20, 184, 166, 0.4) 0%, rgba(45, 212, 191, 0.4) 50%, rgba(6, 182, 212, 0.2) 100%);
  --gradient-subtle: linear-gradient(180deg, rgba(20, 184, 166, 0.05) 0%, transparent 100%);
  --gradient-mesh: radial-gradient(ellipse at 20% 20%, rgba(20, 184, 166, 0.15) 0%, transparent 50%),
                   radial-gradient(ellipse at 80% 80%, rgba(45, 212, 191, 0.1) 0%, transparent 50%),
                   radial-gradient(ellipse at 50% 50%, rgba(6, 182, 212, 0.05) 0%, transparent 60%);

  /* Highlights - Neon Pastels */
  --hl-blue: #60a5fa;
  --hl-purple: #c084fc;
  --hl-orange: #fb923c;
  --hl-green: #4ade80;
  --hl-cyan: #22d3ee;
  --hl-pink: #f472b6;

  /* Typography */
  --font-sans: 'Pretendard Variable', 'Pretendard', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', Consolas, monospace;

  /* Font Sizes */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;

  /* Spacing (8px grid) */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-2xl: 28px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px var(--accent-glow);
  --shadow-glow-lg: 0 0 60px var(--accent-glow), 0 0 100px rgba(45, 212, 191, 0.2);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: 0.15s var(--ease-out);
  --transition-normal: 0.25s var(--ease-out);
  --transition-slow: 0.4s var(--ease-out);
}

/* === Reset === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* === Base === */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-y: auto;
  scrollbar-width: none;           /* Firefox */
  -ms-overflow-style: none;        /* IE, Edge */
  padding-bottom: 160px;           /* 푸터(60px) + 광고(~100px) */
}

/* 모바일 랜딩 페이지: 스크롤 없이 뷰포트에 맞춤 */
@media (max-width: 768px) {
  body:has(.search-hero) {
    height: 100dvh;
    overflow: hidden;
    padding-bottom: 0;
  }

  /* 필터 확장 시에는 스크롤 허용 */
  body:has(.search-hero):has(.search-filters-collapse.expanded) {
    height: auto;
    overflow: auto;
  }
}

body::-webkit-scrollbar {
  display: none;                    /* Chrome, Safari, Opera */
}

/* Ambient gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--gradient-mesh);
  pointer-events: none;
  z-index: -1;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--text-primary);
}

/* === Custom Scrollbar === */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 5px;
  border: 2px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* === Header - Ultra Glass === */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 12, 16, 0.75);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  padding: var(--sp-4) var(--sp-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.logo a {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  transition: all var(--transition-fast);
}

.logo a:hover {
  color: var(--accent);
}

.logo a::before {
  content: '';
  width: 28px;
  height: 28px;
  background: url('/static/images/megaphone.png') no-repeat center center;
  background-size: contain;
  filter: drop-shadow(0 0 8px rgba(20, 184, 166, 0.4));
}

.nav {
  display: flex;
  gap: var(--sp-6);
}

.nav a {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
}

.nav a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* === Header Search (Results Page) === */
.header-search-form {
  display: none;
  flex: 1;
  max-width: 400px;
  margin: 0 var(--sp-4);
}

.header-search {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.header-search input[name="q"] {
  flex: 1;
  min-width: 120px;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.header-search input[name="q"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.header-search input[name="q"]::placeholder {
  color: var(--text-muted);
}

.header-search .btn-sm {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
}

.header-search .btn-filter-toggle {
  display: flex;
  padding: var(--sp-2) var(--sp-3);
}


/* === Filter Bar (Sticky below header) === */
.filter-bar {
  display: none;
  position: sticky;
  top: var(--header-height, 57px);
  z-index: 40;
  background: rgba(12, 12, 16, 0.9);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  padding: var(--sp-3) var(--sp-6);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease-out), opacity 0.2s var(--ease-out), padding 0.3s var(--ease-out);
}

.filter-bar.expanded {
  max-height: 100px;
  opacity: 1;
  padding: var(--sp-3) var(--sp-6);
}

.filter-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.filter-bar .filter-fields {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.filter-bar .filter-fields input {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  width: 120px;
  transition: all var(--transition-fast);
}

.filter-bar .filter-fields input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.filter-bar .filter-fields input#filter-opt2 {
  width: 160px;
}

.filter-bar .filter-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

/* === 3-Column Layout for PC with Side Ads === */
.page-layout {
  display: flex;
  justify-content: center;
  gap: var(--sp-6);
  flex: 1;
  padding: 0 var(--sp-4);
}

.sidebar {
  display: none;
  position: fixed;
  top: 80px;
  width: 160px;
  z-index: 50;
}

.sidebar-left {
  left: max(16px, calc((100vw - 1000px) / 2 - 180px));
}

.sidebar-right {
  right: max(16px, calc((100vw - 1000px) / 2 - 180px));
}

.ad-sidebar {
  text-align: center;
}

/* Show sidebars on large screens (≥1400px) */
@media (min-width: 1400px) {
  .sidebar {
    display: block;
  }

  .page-layout .main {
    max-width: 1000px;
  }
}

/* Medium screens: no side ads, full width content */
@media (max-width: 1399px) {
  .page-layout {
    display: block;
    padding: 0;
  }
}

/* === Main === */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}

/* === Hero Section (Index) === */
.search-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 75vh;
  padding: var(--sp-12) var(--sp-6);
  text-align: center;
  animation: fadeInUp 0.8s var(--ease-out);
  position: relative;
}

/* Ambient glow behind search */
.search-hero::before {
  content: '';
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(20, 184, 166, 0.15) 0%, transparent 70%);
  pointer-events: none;
  filter: blur(60px);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-hero h2 {
  font-size: var(--text-4xl);
  font-weight: 800;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 50%, var(--accent-2) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: var(--sp-4);
  letter-spacing: -0.04em;
  animation: gradientShift 8s ease infinite;
  background-size: 200% 200%;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.search-hero p {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: var(--sp-12);
  max-width: 400px;
}

/* === Search Form === */
.search-form {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Primary Search Input - Glass Card */
.search-primary {
  position: relative;
  margin-bottom: var(--sp-6);
}

.search-primary input {
  width: 100%;
  padding: var(--sp-5) var(--sp-6);
  padding-left: var(--sp-6);
  font-size: var(--text-lg);
  font-family: var(--font-sans);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  color: var(--text-primary);
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-md);
}

.search-primary input:hover {
  border-color: var(--border-strong);
  background: rgba(20, 20, 24, 0.85);
}

.search-primary input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-glow), 0 0 0 1px var(--accent);
  background: rgba(20, 20, 24, 0.9);
}

.search-primary input::placeholder {
  color: var(--text-muted);
}


/* Filter Grid */
.search-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}

/* Form Group */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-group label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-group input,
.form-group select {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
}

.form-group input:hover,
.form-group select:hover {
  border-color: var(--border-strong);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle), 0 0 15px rgba(20, 184, 166, 0.15);
}

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-3) center;
  padding-right: var(--sp-8);
}

/* Options Row */
.search-options {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-6);
  margin-bottom: var(--sp-6);
}

/* 프리셋 버튼과 중복제거 체크박스 통합 레이아웃 */
.filter-row-combined {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  flex-wrap: nowrap;
  margin-bottom: var(--sp-6);
}

.filter-row-combined .preset-actions {
  margin-bottom: 0;
}

.filter-row-combined .checkbox {
  margin-bottom: 0;
}

/* Checkbox */
.checkbox {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  cursor: pointer;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

/* === 토글 스위치 (트렌디한 스타일) === */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  display: none;
}

.toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  background: #374151;
  border-radius: 12px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + .toggle-track {
  background: linear-gradient(135deg, #14b8a6, #06b6d4);
}

.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.toggle-switch:hover .toggle-track {
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
}

.toggle-switch input:focus-visible + .toggle-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toggle-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}

.toggle-switch input:checked ~ .toggle-label {
  color: var(--accent);
}

/* Preset Actions (삽니다/팝니다) */
.preset-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  flex-wrap: nowrap;
  margin-bottom: var(--sp-3);
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-accent);
  color: white;
  box-shadow: var(--shadow-sm), 0 0 20px rgba(20, 184, 166, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md), 0 0 30px rgba(20, 184, 166, 0.4);
  filter: brightness(1.1);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-preset {
  background: var(--glass-bg);
  color: var(--text-secondary);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.btn-preset:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
  box-shadow: 0 0 15px rgba(20, 184, 166, 0.2);
}

/* === Compact Search Form (Results Page) === */
.search-form.compact {
  position: sticky;
  top: 57px;
  z-index: 50;
  max-width: none;
  margin-bottom: 0;
  padding: var(--sp-4) var(--sp-6);
  background: rgba(12, 12, 16, 0.85);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.search-form.compact .form-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

.search-form.compact .form-row > *:not(:last-child):not(.pagination) {
  padding-right: var(--sp-3);
  border-right: 1px solid var(--border-default);
}

.search-form.compact .pagination {
  padding: 0;
  background: none;
  border: none;
  border-top: none;
  margin-left: auto;
}

.search-form.compact input:not([type="checkbox"]),
.search-form.compact select {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}

.search-form.compact input:not([type="checkbox"]) {
  width: 120px;
}

.search-form.compact input[name="q"] {
  width: 160px;
}

.search-form.compact input[name="opt2"] {
  width: 140px;
}

.search-form.compact select {
  width: 100px;
}

.search-form.compact .btn {
  padding: var(--sp-2) var(--sp-4);
}

.search-form.compact .checkbox-inline {
  gap: var(--sp-2);
}

/* === Results Container === */
.results-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: visible; /* Allow sticky thead to work */
  margin: 0 var(--sp-6) var(--sp-4);
  animation: fadeInUp 0.5s var(--ease-out);
  box-shadow: var(--shadow-lg);
}

/* Results Info Bar */
.results-info {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  padding: var(--sp-4) var(--sp-6);
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.08) 0%, rgba(45, 212, 191, 0.05) 100%);
  border-bottom: 1px solid var(--glass-border);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.results-info strong {
  color: var(--accent);
  font-weight: 600;
}

.results-info .query-time {
  color: var(--text-tertiary);
}

.results-info .cache-info {
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: var(--sp-1) var(--sp-2);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.results-info .page-info-inline {
  margin-left: auto;
  color: var(--accent);
  font-weight: 500;
}

/* Results Wrapper - overflow visible for sticky thead */
.results-wrapper {
  flex: 1;
  min-height: 0;
  overflow: visible;
}

/* Results Table */
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.results-table thead {
  position: sticky;
  top: var(--thead-sticky-top, 57px);
  z-index: 30;
}

.results-table th {
  padding: var(--sp-3) var(--sp-5);
  background: rgba(20, 20, 24, 0.95);
  backdrop-filter: blur(10px);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: left;
  border-bottom: 1px solid var(--glass-border);
}

.results-table td {
  padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.results-table tbody tr {
  transition: all var(--transition-fast);
}

.results-table tbody tr:hover {
  background: linear-gradient(90deg, rgba(20, 184, 166, 0.08) 0%, rgba(45, 212, 191, 0.04) 100%);
}

/* Stagger animation for rows */
.results-table tbody tr {
  animation: rowFadeIn 0.3s var(--ease-out) backwards;
}

@keyframes rowFadeIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Column Styles */
.col-time {
  width: 120px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.col-name {
  width: 120px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.col-content {
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.6;
  word-break: break-word;
}

.col-location {
  width: 80px;
  text-align: center;
  color: var(--text-tertiary);
  white-space: nowrap;
  font-size: var(--text-xs);
}

.col-channel {
  width: 80px;
  color: var(--text-tertiary);
  white-space: nowrap;
  font-size: var(--text-xs);
}

.no-results {
  padding: var(--sp-16) !important;
  text-align: center;
  color: var(--text-tertiary);
}

.no-results svg {
  margin-bottom: var(--sp-4);
  opacity: 0.4;
  color: var(--accent);
}

.no-results p {
  font-size: var(--text-lg);
  margin-bottom: var(--sp-2);
  color: var(--text-secondary);
}

.no-results span {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* === Keyword Highlighting - Neon Glow Style === */
.lime {
  color: var(--hl-green);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}

.magenta {
  color: var(--hl-purple);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(192, 132, 252, 0.4);
}

.orange {
  color: var(--hl-orange);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(251, 146, 60, 0.4);
}

.aqua {
  color: var(--hl-blue);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(96, 165, 250, 0.4);
}

.cyan {
  color: var(--hl-cyan);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(34, 211, 238, 0.4);
}

/* === Pagination === */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  padding: var(--sp-4);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
}

.page-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--sp-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.page-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.page-link.current {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.page-link.disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  pointer-events: none;
}

.page-ellipsis {
  padding: 0 var(--sp-2);
  color: var(--text-muted);
}

.page-info {
  margin-left: var(--sp-4);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* === Ad Containers - Native Style === */

/* Infeed ads (테이블 내 광고) */
.ad-row-infeed {
  display: table-row;
}

.ad-row-infeed td {
  padding: var(--sp-4) var(--sp-3) !important;
  border-bottom: 1px solid var(--border-subtle);
}

.ad-infeed {
  width: 100%;
  min-height: 100px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ad-infeed ins.adsbygoogle {
  width: 100%;
  min-width: 280px;
}

/* 모바일: 광고 행 전체 너비 확보 */
@media (max-width: 768px) {
  .ad-row-infeed {
    display: block !important;
    width: 100% !important;
    padding: var(--sp-3) !important;
    border-bottom: 1px solid var(--glass-border);
  }

  .ad-row-infeed td {
    display: block !important;
    width: 100% !important;
    padding: var(--sp-2) 0 !important;
  }

  .ad-infeed {
    min-height: 80px;
  }

  .ad-infeed ins.adsbygoogle {
    min-width: 250px;
  }
}

/* Sidebar ads (PC only) */
.ad-sidebar {
  text-align: center;
}

/* 빈 광고 슬롯 숨김 */
.ad-sidebar:empty,
.ad-sidebar:has(ins.adsbygoogle[data-ad-status="unfilled"]) {
  display: none;
}

.sidebar:has(.ad-sidebar:empty),
.sidebar:has(ins.adsbygoogle[data-ad-status="unfilled"]) {
  display: none;
}

/* Footer ad - Fixed overlay above footer */
.ad-footer {
  position: fixed;
  bottom: 60px;  /* 푸터 높이 위에 위치 */
  left: 0;
  right: 0;
  z-index: 90;
  text-align: center;
  pointer-events: auto;
}


/* === Legal Pages === */
.legal-page {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: var(--sp-8);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.legal-page h2 {
  font-size: var(--text-xl);
  color: var(--text-primary);
  margin-bottom: var(--sp-6);
}

.legal-page section {
  margin-bottom: var(--sp-6);
}

.legal-page h3 {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--sp-3);
}

.legal-page ul {
  margin-left: var(--sp-6);
  color: var(--text-tertiary);
}

.legal-page li {
  margin-bottom: var(--sp-2);
}

/* === Recent Searches === */
.recent-searches {
  background: var(--bg-secondary);
  padding: var(--sp-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.recent-searches h3 {
  font-size: var(--text-sm);
  color: var(--accent);
  margin-bottom: var(--sp-4);
}

.recent-searches ul {
  list-style: none;
}

.recent-searches li {
  display: flex;
  justify-content: space-between;
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--text-sm);
}

.recent-searches li:last-child {
  border-bottom: none;
}

.recent-searches a {
  color: var(--text-secondary);
}

.recent-searches a:hover {
  color: var(--text-primary);
}

.recent-searches .time {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.no-data {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* === Footer === */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 80;
  padding: var(--sp-4) var(--sp-6);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-nav {
  display: flex;
  gap: var(--sp-4);
}

.footer-nav a {
  color: var(--text-muted);
  font-size: var(--text-sm);
  transition: color var(--transition-fast);
}

.footer-nav a:hover {
  color: var(--accent);
}

.footer-copyright {
  color: var(--text-muted);
  font-size: var(--text-xs);
  margin: 0;
}

@media (max-width: 640px) {
  .footer-content {
    flex-direction: column;
    gap: var(--sp-3);
  }
}

/* === Mobile UI Components === */

/* Filter Toggle Button */
.btn-filter-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-normal);
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}

.btn-filter-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-filter-toggle.active {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 15px rgba(20, 184, 166, 0.2);
}

.btn-filter-toggle svg {
  width: 18px;
  height: 18px;
}

/* Main Search Row (검색 + 필터토글) */
.search-main-row {
  display: flex;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}

.search-main-row .search-primary {
  flex: 1;
  margin-bottom: 0;
}

/* 메인 검색 버튼 */
.search-main-row .btn-search-main {
  flex-shrink: 0;
  padding: var(--sp-3) var(--sp-5);
}

/* Collapsible Filters (기본 숨김) */
.search-filters-collapse {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease-out), opacity 0.2s var(--ease-out), margin 0.3s var(--ease-out);
  margin: 0;
}

.search-filters-collapse.expanded {
  max-height: 1000px;
  opacity: 1;
  margin-bottom: var(--sp-4);
}

/* Mobile/Desktop Form Row Containers */
.compact-mobile {
  display: none;
}

.compact-desktop {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* 각 줄: 절대 래핑 안 함 */
.compact-desktop .form-row-1,
.compact-desktop .form-row-2 {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: nowrap;
}

/* 요소 축소 허용 */
.compact-desktop input:not([type="checkbox"]),
.compact-desktop select {
  flex-shrink: 1;
  min-width: 60px;
}

/* 검색어 우측 정렬 */
.compact-desktop .form-row-1 input[name="q"] {
  margin-left: auto;
}

/* 페이지네이션 우측 정렬 */
.compact-desktop .form-row-2 .pagination {
  margin-left: auto;
}

/* === Bottom Sheet Filter Panel === */
.filter-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out);
}

.filter-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.filter-bottomsheet {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-bottom: none;
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
  z-index: 200;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s var(--ease-spring);
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.filter-bottomsheet.active {
  transform: translateY(0);
}

/* Handle bar */
.filter-bottomsheet::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: var(--border-strong);
  border-radius: var(--radius-full);
}

.bottomsheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-4);
  padding-top: var(--sp-6);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

.bottomsheet-header span {
  font-weight: 700;
  font-size: var(--text-lg);
  color: var(--text-primary);
  background: var(--gradient-accent);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn-close-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-close-panel:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.bottomsheet-body {
  padding: var(--sp-4);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

.bottomsheet-body .form-group {
  margin-bottom: 0;
}

.bottomsheet-body .form-group.full-width {
  grid-column: 1 / -1;
}

.bottomsheet-body input,
.bottomsheet-body select {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-base);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  width: 100%;
}

.bottomsheet-body .checkbox {
  grid-column: 1 / -1;
  padding: var(--sp-3) 0;
}

/* 바텀시트 내 프리셋 버튼 컨테이너 */
.preset-actions-mobile {
  display: flex;
  gap: var(--sp-2);
  width: 100%;
}

.preset-actions-mobile .btn {
  flex: 1;
}

.bottomsheet-footer {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-top: 1px solid var(--border-subtle);
  position: sticky;
  bottom: 0;
  background: var(--bg-secondary);
}

.bottomsheet-footer .btn {
  flex: 1;
  padding: var(--sp-3) var(--sp-4);
}

.btn-reset {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.btn-reset:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-apply {
  background: var(--accent);
  color: white;
}

.btn-apply:hover {
  background: var(--accent-hover);
}

/* === Mobile Responsive === */
@media (max-width: 768px) {
  :root {
    --text-4xl: 1.75rem;
    --text-3xl: 1.5rem;
    --text-2xl: 1.25rem;
  }

  .header {
    padding: var(--sp-3) var(--sp-4);
    flex-wrap: wrap;
  }

  .logo a {
    font-size: var(--text-base);
  }

  .logo a::before {
    width: 24px;
    height: 24px;
  }

  .nav {
    display: none; /* 모바일에서 네비게이션 숨김 */
  }

  /* 모바일에서도 헤더 검색 폼 표시 */
  .header-search-form {
    display: flex;
    flex: 1;
    max-width: none;
    margin: 0 var(--sp-2);
  }

  .header-search {
    width: 100%;
  }

  .header-search input[name="q"] {
    min-width: 80px;
  }

  /* 모바일에서 필터 바 숨김 (바텀시트 사용) */
  .filter-bar {
    display: none !important;
  }

  /* 모바일에서 바텀시트 활성화 */
  .filter-backdrop {
    display: block;
  }

  .filter-bottomsheet {
    display: block;
  }

  /* Hero Section - 모바일에서 스크롤 없이 뷰포트에 맞춤 */
  .search-hero {
    height: calc(100dvh - 53px);  /* 헤더 높이(~53px) 제외 */
    min-height: auto;
    max-height: calc(100dvh - 53px);
    padding: var(--sp-4) var(--sp-4);
    padding-top: calc((100dvh - 53px) * 0.2);  /* 위에서 ~1/3 지점 */
    justify-content: flex-start;
    overflow: hidden;
  }

  /* 필터 확장 시 높이 자동 조절 */
  .search-hero:has(.search-filters-collapse.expanded) {
    height: auto;
    min-height: calc(100dvh - 53px);
    max-height: none;
    overflow: visible;
  }

  .search-hero::before {
    width: 300px;
    height: 200px;
  }

  .search-hero h2 {
    font-size: var(--text-2xl);
    margin-bottom: var(--sp-2);
  }

  .search-hero p {
    font-size: var(--text-sm);
    margin-bottom: var(--sp-8);
  }

  /* 필터 토글 버튼 표시 */
  .btn-filter-toggle {
    display: flex;
  }

  /* 필터 기본 숨김 */
  .search-filters-collapse {
    max-height: 0;
    opacity: 0;
    margin: 0;
  }

  .search-filters-collapse.expanded {
    max-height: 1000px;
    opacity: 1;
    margin-bottom: var(--sp-4);
  }

  .search-filters {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-3);
  }

  /* 버튼 가로 배치 */
  .preset-actions {
    flex-direction: row;
    width: 100%;
  }

  .preset-actions .btn {
    flex: 1;
    width: auto;
    padding: var(--sp-3) var(--sp-2);
    font-size: var(--text-sm);
  }

  /* Compact Form - 모바일/데스크톱 분리 */
  .search-form.compact {
    padding: var(--sp-3) var(--sp-4);
  }

  .compact-desktop {
    display: none !important;
  }

  .compact-mobile {
    display: flex !important;
    align-items: center;
    gap: var(--sp-2);
  }

  .compact-mobile input[name="q"] {
    flex: 1;
    min-width: 0;
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
  }

  .compact-mobile select {
    width: 65px;
    padding: var(--sp-2);
    font-size: var(--text-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    flex-shrink: 0;
  }

  .compact-mobile .btn {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-sm);
    flex-shrink: 0;
  }

  .compact-mobile .btn-filter-open {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
  }

  .compact-mobile .btn-filter-open:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
  }

  /* 바텀시트 활성화 */
  .filter-backdrop {
    display: block;
  }

  .filter-bottomsheet {
    display: block;
  }

  /* Results */
  .results-container {
    margin: var(--sp-3);
    border-radius: var(--radius-lg);
  }

  .results-info {
    flex-wrap: wrap;
    gap: var(--sp-3);
    padding: var(--sp-2) var(--sp-4);
  }

  .results-wrapper {
    overflow-x: auto;
  }

  /* 테이블 가로 스크롤 제거 */
  .results-table {
    min-width: 0;
  }

  /* 헤더 숨김 */
  .results-table thead {
    display: none;
  }

  /* 각 행을 모던 카드로 변환 */
  .results-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    padding: var(--sp-2) var(--sp-3);
    gap: var(--sp-1);
    border-bottom: 1px solid var(--glass-border);
    transition: all var(--transition-fast);
    animation: cardFadeIn 0.4s var(--ease-out) backwards;
  }

  @keyframes cardFadeIn {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .results-table tbody tr:hover,
  .results-table tbody tr:active {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.08) 0%, rgba(45, 212, 191, 0.04) 100%);
  }

  /* 첫째 줄 순서 지정 */
  .results-table .col-time { order: 1; font-size: 11px; }
  .results-table .col-name { order: 2; font-weight: 400; }
  .results-table .col-location { order: 3; }
  .results-table .col-channel { order: 4; }

  /* 둘째 줄: 내용 (전체 너비) */
  .results-table .col-content {
    order: 5;
    flex-basis: 100%;
    padding-top: var(--sp-2);
    line-height: 1.7;
    color: var(--text-primary);
    font-weight: 600;
  }

  /* 시각적 구분자 (·) */
  .results-table .col-time::after,
  .results-table .col-name::after,
  .results-table .col-location::after {
    content: '·';
    margin-left: var(--sp-2);
    color: var(--text-muted);
    opacity: 0.5;
  }

  /* 셀 기본 스타일 */
  .results-table td {
    padding: 0;
    border: none;
  }

  /* 컬럼 고정 너비 설정 */
  .col-time {
    min-width: 55px;
  }
  .col-name {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .col-location {
    display: none;
  }
  .col-channel {
    min-width: 38px;
  }

  /* 검색 결과 없음: 가운데 정렬 */
  .results-table .no-results {
    flex-basis: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--sp-10) !important;
  }

  .pagination {
    gap: 2px;
    padding: var(--sp-3);
  }

  .page-link {
    min-width: 32px;
    height: 32px;
    font-size: var(--text-xs);
  }

  /* 프리셋 버튼 래핑 허용 */
  .preset-actions {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    justify-content: center;
  }

  .preset-actions .btn {
    flex: 1;
    min-width: 80px;
    width: auto;
    padding: var(--sp-3) var(--sp-2);
    font-size: var(--text-sm);
  }

  /* 필터 행 래핑 허용 */
  .filter-row-combined {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--sp-3);
  }

  /* 체크박스 텍스트 줄바꿈 허용 */
  .filter-row-combined .checkbox span {
    white-space: normal;
    text-align: center;
  }

}


/* Desktop: 필터 토글 가능 */
@media (min-width: 769px) {
  /* 데스크톱에서도 필터 토글 버튼 표시 */
  .btn-filter-toggle {
    display: flex;
  }

  /* 데스크톱에서도 필터 토글 가능 */
  .search-filters-collapse.expanded {
    max-height: 1000px;
    opacity: 1;
    margin-bottom: var(--sp-4);
  }

  .compact-mobile {
    display: none !important;
  }

  .compact-desktop {
    display: flex !important;
  }

  .filter-backdrop,
  .filter-bottomsheet {
    display: none !important;
  }

  /* Desktop: 헤더 검색 폼 및 필터 바 표시 */
  .header-search-form {
    display: flex;
  }

  .filter-bar {
    display: block;
  }

  /* 네비게이션 간소화 (검색 결과 페이지에서 공간 확보) */
  .header:has(.header-search-form) .nav {
    gap: var(--sp-3);
  }

  .header:has(.header-search-form) .nav a {
    font-size: var(--text-xs);
    padding: var(--sp-1) var(--sp-2);
  }
}

/* === Desktop Filter Row (검색결과 페이지) === */
.desktop-filter-row {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease-out), opacity 0.2s var(--ease-out), margin 0.3s var(--ease-out);
  margin: 0;
}

.desktop-filter-row.expanded {
  max-height: 200px;
  opacity: 1;
  margin-top: var(--sp-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

.desktop-filter-row .filter-fields {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: nowrap;
  flex-shrink: 1;
  min-width: 0;
}

.desktop-filter-row .filter-fields input:not([type="checkbox"]),
.desktop-filter-row .filter-fields select {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  flex-shrink: 1;
  min-width: 80px;
}

.desktop-filter-row .filter-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: 0;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

/* 검색 메인 행 (검색결과 페이지 데스크톱) */
.search-row-main {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.search-row-main input[name="q"] {
  flex: 1;
  min-width: 120px;
}

/* 더보기 버튼 텍스트 */
.btn-filter-toggle .toggle-text {
  margin-left: var(--sp-1);
  font-size: var(--text-sm);
}

/* === Focus States === */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* === Selection === */
::selection {
  background: var(--accent-subtle);
  color: var(--text-primary);
}

/* ================================================
   Loading UX - Modern Minimal Style
   ================================================ */

/* === Top Progress Bar === */
.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
  background: rgba(20, 184, 166, 0.1);
}

.loading-bar.active {
  opacity: 1;
}

.loading-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: -30%;
  width: 30%;
  height: 100%;
  background: var(--gradient-accent);
  box-shadow: 0 0 20px var(--accent), 0 0 40px var(--accent-glow);
  border-radius: 2px;
  animation: loadingSlide 1.2s var(--ease-out) infinite;
}

@keyframes loadingSlide {
  0% {
    left: -30%;
    width: 30%;
  }
  50% {
    width: 50%;
  }
  100% {
    left: 100%;
    width: 30%;
  }
}

/* === Button Loading State (Simple) === */
.btn.loading {
  pointer-events: none;
  opacity: 0.6;
  cursor: wait;
}

/* === Results Loading Overlay === */
.results-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: var(--sp-12);
  gap: var(--sp-6);
  animation: fadeIn 0.3s var(--ease-out);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Spinner - Gradient Ring */
.loading-spinner {
  position: relative;
  width: 56px;
  height: 56px;
}

.loading-spinner::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid var(--glass-border);
  border-radius: 50%;
}

.loading-spinner::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid transparent;
  border-top-color: var(--accent);
  border-right-color: var(--accent-2);
  border-radius: 50%;
  animation: spinGradient 0.8s linear infinite;
  box-shadow: 0 0 20px var(--accent-glow);
}

@keyframes spinGradient {
  to { transform: rotate(360deg); }
}

/* Loading Text */
.loading-text {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  letter-spacing: 0.02em;
}

/* Dots Animation */
.loading-dots {
  display: flex;
  gap: var(--sp-2);
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) { animation-delay: 0s; }
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.5;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}


/* === Infinite Scroll === */
.load-more-sentinel {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--sp-10);
  min-height: 80px;
}

.load-more-sentinel .loading-spinner {
  width: 36px;
  height: 36px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.load-more-sentinel.loading .loading-spinner {
  opacity: 1;
}

.end-of-results {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--sp-8);
  color: var(--text-muted);
  font-size: var(--text-sm);
  background: linear-gradient(180deg, transparent 0%, rgba(20, 184, 166, 0.03) 100%);
  margin-top: var(--sp-4);
}

.end-of-results span {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-full);
  backdrop-filter: blur(10px);
}

/* === Ripple Effect === */
.btn {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: rippleEffect 0.6s linear;
  pointer-events: none;
}

@keyframes rippleEffect {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* === Button Content Wrapper === */
.btn-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  transition: opacity 0.2s var(--ease-out);
}

/* === 소형 모바일 (480px 이하) === */
@media (max-width: 480px) {
  /* 랜딩 페이지: 체크박스+프리셋 세로 배치 */
  .filter-row-combined {
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-4);
  }

  .filter-row-combined .checkbox {
    justify-content: center;
    text-align: center;
  }

  .filter-row-combined .preset-actions {
    width: 100%;
  }

  .filter-row-combined .preset-actions .btn {
    flex: 1;
    min-width: 0;
  }

  /* 검색 필터 - 2열 유지, 넘침 방지 */
  .search-filters .form-group {
    min-width: 0;
    overflow: hidden;
  }

  .search-filters input,
  .search-filters select {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-sm);
  }

  .search-filters label {
    font-size: var(--text-xs);
  }


  /* 바텀시트 - 2열 유지, 크기만 축소 */
  .bottomsheet-body {
    gap: var(--sp-3);
    padding: var(--sp-3);
  }

  .bottomsheet-body input,
  .bottomsheet-body select {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-sm);
  }

  .bottomsheet-body label {
    font-size: var(--text-xs);
  }

  /* 바텀시트 프리셋 버튼 - 가로 2개 유지 */
  .preset-actions-mobile .btn {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-sm);
  }
}

/* === 극소형 모바일 (320px 이하) === */
@media (max-width: 320px) {
  /* 체크박스 텍스트 크기 축소 */
  .checkbox span,
  .checkbox-inline {
    font-size: var(--text-xs);
  }

  /* 바텀시트 패딩 축소 */
  .bottomsheet-body {
    padding: var(--sp-3);
    gap: var(--sp-2);
  }

  /* 버튼 패딩 최소화 */
  .btn-preset {
    padding: var(--sp-2) var(--sp-3);
    font-size: var(--text-xs);
  }
}
