/* =====================================================================
   YTB News — GitHub-style CSS
   ===================================================================== */

/* ── Variables ─────────────────────────────────────────────────────── */
:root {
  color-scheme:       light;
  --canvas:           #ffffff;
  --canvas-subtle:    #f6f8fa;
  --canvas-inset:     #f0f6fc;
  --border:           #d0d7de;
  --border-muted:     #d8dee4;

  --fg:               #1f2328;
  --fg-muted:         #656d76;
  --fg-subtle:        #6e7781;
  --fg-on-emphasis:   #ffffff;

  --accent:           #0969da;
  --accent-hover:     #0550ae;
  --accent-subtle:    #ddf4ff;

  --success:          #1a7f37;
  --success-subtle:   #dafbe1;
  --warning-subtle:   #fff8c5;

  --header-bg:        #24292f;
  --header-border:    rgba(255, 255, 255, 0.1);
  --header-fg:        #f0f6fc;
  --header-link:      rgba(255, 255, 255, 0.7);
  --header-link-hover:#ffffff;

  --radius:           8px;
  --radius-lg:        16px;
  --shadow-sm:        0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md:        0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg:        0 12px 40px rgba(0, 0, 0, 0.12);
  --shadow-xl:        0 20px 60px rgba(0, 0, 0, 0.15);

  --transition-fast:  150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base:  250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:  350ms cubic-bezier(0.4, 0, 0.2, 1);

  --font:             -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
                      Helvetica, Arial, sans-serif;
  --font-mono:        ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
                      "Liberation Mono", monospace;
  --sidebar-w:        260px;
}

/* ── Dark Theme Variables ──────────────────────────────────────────── */
[data-theme="dark"] {
  color-scheme:       dark;

  --canvas:           #0d1117;
  --canvas-subtle:    #161b22;
  --canvas-inset:     #010409;
  --canvas-overlay:   #1c2128;
  --border:           #30363d;
  --border-muted:     #21262d;
  --border-subtle:    rgba(240,246,252,0.1);

  --fg:               #e6edf3;
  --fg-muted:         #8b949e;
  --fg-subtle:        #6e7681;
  --fg-on-emphasis:   #ffffff;

  --accent:           #58a6ff;
  --accent-hover:     #79c0ff;
  --accent-subtle:    rgba(56,139,253,0.15);
  --accent-emphasis:  #1f6feb;

  --neutral-muted:    rgba(110,118,129,0.4);

  --success:          #3fb950;
  --success-subtle:   #0d2119;
  --success-emphasis: #1f6feb;
  --warning-subtle:   #2e1c00;
  --danger:           #f85149;
  --danger-subtle:    #1c0004;

  --header-bg:        #161b22;
  --header-border:    rgba(255,255,255,0.05);
  --header-fg:        #f0f6fc;
  --header-link:      rgba(240,246,252,0.7);
  --header-link-hover:#ffffff;

  --shadow-sm:        0 1px 0 rgba(0,0,0,0.6);
  --shadow-md:        0 3px 6px rgba(0,0,0,0.4);
  --shadow-lg:        0 8px 24px rgba(0,0,0,0.48);
  --shadow-xl:        0 16px 48px rgba(0,0,0,0.6);
}

/* ── Dark Mode Component Overrides ─────────────────────────────────── */
[data-theme="dark"] .sidebar-section {
  border-color: var(--border);
}

[data-theme="dark"] .search-input {
  border-color: var(--border);
  background: var(--canvas-inset);
}
[data-theme="dark"] .search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
  background: var(--canvas);
  transform: none;
}

[data-theme="dark"] .toolbar {
  background: var(--canvas-subtle);
  border-color: var(--border);
}

[data-theme="dark"] .video-card {
  border-color: var(--border-muted);
}

[data-theme="dark"] .compact-view .video-grid {
  border-color: var(--border);
}
[data-theme="dark"] .compact-view .video-card {
  border-bottom-color: var(--border-muted);
}

[data-theme="dark"] .drawer-theme-toggle {
  background: var(--canvas-subtle);
  border-color: var(--border);
}
[data-theme="dark"] .drawer-theme-toggle:hover {
  background: var(--canvas-overlay);
  border-color: var(--accent);
}

/* Dark mode scrollbar */
[data-theme="dark"] ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
[data-theme="dark"] ::-webkit-scrollbar-track {
  background: transparent;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: var(--fg-muted);
}

/* Dark mode text selection */
[data-theme="dark"] ::selection {
  background: #264f78;
  color: #e6edf3;
}

/* ── Reset & Base ──────────────────────────────────────────────────── */
*, *::before, *::after { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

html { 
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--fg);
  background: var(--canvas);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-base), color var(--transition-base);
}

a { 
  color: var(--accent); 
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { 
  text-decoration: underline; 
  color: var(--accent-hover); 
}

ul, ol { list-style: none; }

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

img { display: block; max-width: 100%; }

/* ── Layout Container ──────────────────────────────────────────────── */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ────────────────────────────────────────────────────────── */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 56px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--header-fg);
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}
.site-logo:hover { 
  color: #fff; 
  text-decoration: none;
  transform: translateY(-1px);
}
.site-logo svg { 
  width: 20px;
  height: auto;
  opacity: 0.95;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.header-nav {
  display: none;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
}

.header-nav-link {
  color: var(--header-link);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius);
  transition: all var(--transition-fast);
  position: relative;
}
.header-nav-link:hover {
  color: var(--header-link-hover);
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
  transform: translateY(-1px);
}
.header-nav-link.active {
  color: var(--header-fg);
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Country Select Dropdown */
.country-select-wrap {
  position: relative;
}

.country-select {
  height: 32px;
  padding: 0 32px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  color: var(--header-fg);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
  appearance: none;
  transition: all var(--transition-fast);
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4.427 7.427l3.396 3.396a.25.25 0 00.354 0l3.396-3.396A.25.25 0 0011.396 7H4.604a.25.25 0 00-.177.427z' fill='%23fff'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  min-width: 100px;
}

.country-select:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.country-select:focus {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.country-select option {
  background: var(--canvas);
  color: var(--fg);
  padding: 8px;
}

/* Theme Toggle Button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--header-link);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all var(--transition-fast);
  margin-left: auto;
  margin-right: 8px;
}
.theme-toggle:hover {
  color: var(--header-fg);
  background: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}
.theme-toggle svg {
  transition: transform var(--transition-base);
}
.theme-toggle:hover svg {
  transform: rotate(15deg);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--header-fg);
  margin-left: auto;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--header-link);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--header-link-hover);
}

/* Mobile Drawer */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* PC에서는 오버레이 숨김 */
@media (min-width: 901px) {
  .drawer-overlay {
    display: none;
  }
  
  body.drawer-open .drawer-overlay {
    display: none;
  }
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: -320px;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: var(--canvas);
  border-left: 1px solid var(--border);
  z-index: 999;
  overflow-y: auto;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
  transition: right var(--transition-base);
  display: none;
  flex-direction: column;
}

.mobile-drawer.active {
  right: 0;
}

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

.drawer-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
  margin: 0;
}

.drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: transparent;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.drawer-close:hover {
  background: var(--canvas-inset);
  color: var(--fg);
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 0;
}

.drawer-section {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.drawer-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.drawer-country-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-country-item {
  padding: 6px 8px;
  border-radius: calc(var(--radius) - 2px);
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}
.drawer-country-item:hover {
  background: var(--canvas-subtle);
  text-decoration: none;
}
.drawer-country-item.active {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

.drawer-theme-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--canvas-subtle);
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.drawer-theme-toggle:hover {
  background: var(--canvas-inset);
  border-color: var(--accent);
}

.drawer-theme-label {
  flex: 1;
  text-align: left;
}

/* Drawer 안의 Sidebar 스타일 */
.mobile-drawer .sidebar {
  max-height: none;
  overflow: visible;
  position: static;
}

.mobile-drawer .sidebar-section {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
  margin: 0;
  padding: 0;
}

.mobile-drawer .sidebar-section.channel-section {
  overflow: visible;
  flex: none;
}

.mobile-drawer .sidebar-section:hover {
  box-shadow: none;
}

.mobile-drawer .sidebar-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 16px 20px 12px;
  background: transparent;
  border-bottom: none;
}

.mobile-drawer #calendar-widget {
  padding: 8px 20px 16px;
}

.mobile-drawer .channel-scroll {
  padding: 0;
  flex: none;
  max-height: none;
  overflow-y: visible;
}

.mobile-drawer .channel-list {
  padding: 0;
}

.mobile-drawer .channel-btn {
  padding-left: 20px;
  padding-right: 20px;
}

.mobile-drawer .channel-btn:hover {
  padding-left: 24px;
}

/* Drawer 안의 사이드바 테마 섹션 숨김 (드로어 하단 테마 버튼 사용) */
.mobile-drawer .sidebar-theme-section {
  display: none !important;
}

/* Drawer 국가 선택 접기 */
.drawer-section-title-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.drawer-section-title-toggle:hover {
  color: var(--accent);
}
.drawer-collapse-arrow {
  transition: transform var(--transition-fast);
  color: var(--fg-muted);
}
.drawer-section-title-toggle.collapsed .drawer-collapse-arrow {
  transform: rotate(-90deg);
}
.drawer-country-list.collapsed {
  display: none;
}

/* ── Main ──────────────────────────────────────────────────────────── */
.site-main {
  padding: 32px 0 64px;
  min-height: calc(100vh - 64px - 60px);
}

/* ── Page Layout (sidebar + content) ──────────────────────────────── */
.page-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 12px;
  align-items: start;
}

/* ── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
  display: flex;
  position: sticky;
  top: 64px;
  flex-direction: column;
  gap: 6px;
  max-height: calc(100vh - 80px);
}

.main-content {
}

/* Mobile Filter Toggle Button */
.sidebar-section {
  background: var(--canvas-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
  flex-shrink: 0;
}

.sidebar-section:hover {
  box-shadow: var(--shadow-md);
}

/* Channel list section: fills remaining sidebar space and scrolls internally */
.sidebar-section.channel-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Desktop-specific density and sidebar polish */
@media (min-width: 900px) {
  :root { --sidebar-w: 260px; }
  .page-layout { gap: 12px; }
  .site-main { padding: 20px 0 40px; }

  .sidebar { top: 56px; max-height: calc(100vh - 64px); }

  .sidebar-section { padding: 6px; border-radius: 10px; }

  /* Make channel list area taller and more touch-friendly */
  .sidebar-section.channel-section { padding: 6px; }
  .channel-scroll { padding-left: 6px; padding-right: 6px; }

  /* Slightly denser cards */
  .card-view .video-card { padding: 8px 8px 6px; border-radius: 12px; }
  .card-view .video-grid { gap: 12px; }
  .card-view .video-info { padding: 8px 6px 10px; }

  /* Sidebar title spacing reduced for density */
  .sidebar-title { padding: 8px 10px; }
}

.channel-scroll {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  padding-top: 6px;
  padding-bottom: 6px;
}

.channel-scroll::-webkit-scrollbar {
  width: 6px;
}

.channel-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.channel-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 10px;
}

.channel-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

.sidebar-title {
  background: var(--canvas-subtle);
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Collapsible sidebar section title */
.sidebar-title-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.sidebar-title-toggle:hover {
  color: var(--accent);
}
.sidebar-collapse-arrow {
  transition: transform var(--transition-fast);
  color: var(--fg-muted);
}
.sidebar-title-toggle.collapsed .sidebar-collapse-arrow {
  transform: rotate(-90deg);
}
.sidebar-collapsible.collapsed {
  display: none;
}

/* Country Button Group (Sidebar) */
.country-btn-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
}

.country-btn {
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--fg);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.country-btn:hover {
  background: var(--canvas);
  text-decoration: none;
}
.country-btn.active {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

.sidebar-clear {
  display: block;
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.sidebar-clear:hover { 
  background: var(--canvas-subtle);
  padding-left: 14px;
}

/* ── Calendar ──────────────────────────────────────────────────────── */
#calendar-widget {
  padding: 8px;
  background: var(--canvas);
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 8px;
  gap: 4px;
}

.cal-selects {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.cal-select {
  height: 24px;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--fg);
  font-size: 12px;
  font-family: var(--font);
  cursor: pointer;
  outline: none;
}
.cal-select:focus { border-color: var(--accent); }
.cal-select:hover { border-color: var(--border-muted); }

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg-muted);
  font-size: 13px;
  padding: 0;
  line-height: 1;
  transition: background 0.1s, color 0.1s;
}
.cal-nav:hover {
  background: var(--canvas-subtle);
  color: var(--fg);
}

.cal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.cal-table th {
  text-align: center;
  padding: 2px 0 4px;
  font-weight: 600;
  color: var(--fg-muted);
  font-size: 11px;
}

.cal-table th.sun { color: #d1242f; }
.cal-table th.sat { color: var(--accent); }

.cal-table td {
  text-align: center;
  padding: 1px;
}

.cal-table td button {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--radius);
  background: none;
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}
.cal-table td button:hover { 
  background: var(--accent-subtle);
  transform: scale(1.15);
}

.cal-table td button.today {
  font-weight: 700;
  color: var(--accent);
}
.cal-table td button.today::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--accent);
  border-radius: 50%;
}

.cal-table td button.selected {
  background: var(--accent);
  color: white;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  transform: scale(1.1);
}
.cal-table td button.selected:hover { 
  box-shadow: var(--shadow-lg);
  transform: scale(1.15);
}

/* ── Channel List ──────────────────────────────────────────────────── */
.channel-list {
  padding: 4px 0;
}

.channel-list li + li { border-top: 1px solid var(--border-muted); }
.channel-list .channel-group { border-top: none; }

.category-row {
  display: flex;
  align-items: stretch;
  border-top: 1px solid var(--border-muted);
}
.category-row .category-btn { flex: 1; min-width: 0; }

.cat-toggle-btn {
  flex-shrink: 0;
  width: 30px;
  background: none;
  border: none;
  border-left: 1px solid var(--border-muted);
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
  cursor: pointer;
}
.cat-toggle-btn:hover { background: var(--canvas-subtle); color: var(--fg); }
.cat-toggle-btn svg { transition: transform 0.2s; }
.cat-toggle-btn.collapsed svg { transform: rotate(-90deg); }

.channel-sublist.collapsed { display: none; }

/* Category button */
.category-btn {
  font-weight: 700;
  color: var(--fg-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--canvas-subtle);
  transition: all var(--transition-fast);
}
.category-btn:hover { 
  background: var(--accent-subtle);
  color: var(--accent);
  padding-left: 12px;
}
.category-btn.active {
  background: var(--accent);
  color: white;
}

.category-arrow {
  font-size: 10px;
  margin-right: 2px;
  opacity: 0.5;
}

.category-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--fg-subtle);
  background: var(--canvas-inset);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0px 6px;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.category-btn:hover .category-count,
.category-btn.active .category-count {
  background: rgba(255, 255, 255, 0.3);
  color: white;
  border-color: transparent;
}

/* Sub-channel list (indented) */
.channel-sublist {
  padding: 0;
}
.channel-sublist li { border-top: 1px solid var(--border-muted); }

.channel-sub-btn {
  padding-left: 20px;
  font-size: 12px;
}

.channel-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: none;
  color: var(--fg);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  transition: all var(--transition-fast);
}
.channel-btn:hover { 
  background: var(--accent-subtle);
  color: var(--accent);
}
.channel-btn.active {
  background: var(--accent);
  color: white;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}

.channel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
  transition: all var(--transition-fast);
}

.channel-btn:hover .channel-dot,
.channel-btn.active .channel-dot {
  transform: scale(1.3);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.4);
}

/* ── Toolbar ───────────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 40px 0 40px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--canvas);
  color: var(--fg);
  font-size: 14px;
  font-family: var(--font);
  transition: all var(--transition-base);
  outline: none;
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-subtle), var(--shadow-md);
  transform: translateY(-1px);
}
.search-input:focus ~ .search-icon {
  color: var(--accent);
}
.search-input::placeholder { 
  color: var(--fg-subtle);
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--canvas-subtle);
  border: none;
  color: var(--fg-muted);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: var(--radius);
  line-height: 1;
  transition: all var(--transition-fast);
}
.search-clear:hover { 
  background: var(--accent);
  color: white;
  transform: translateY(-50%) scale(1.1);
}

.toolbar-status {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 12px;
  background: var(--accent);
  color: white;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}
.filter-badge:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.filter-badge-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: rgba(255,255,255,0.25);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}
.filter-badge-close:hover {
  background: rgba(255,255,255,0.45);
}

.result-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
  padding: 4px 12px;
  background: var(--canvas-subtle);
  border-radius: 20px;
}

.view-toggle {
  display: flex;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  width: 36px;
  height: 36px;
  background: var(--canvas);
  border: none;
  color: var(--fg-muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: all var(--transition-fast);
}
.view-btn:hover { 
  background: var(--accent-subtle);
  color: var(--accent);
}
.view-btn.active {
  background: var(--accent);
  color: white;
  box-shadow: inset var(--shadow-sm);
}
.view-btn + .view-btn { 
  border-left: 2px solid var(--border);
}

/* ── Loading Bar ───────────────────────────────────────────────────── */
.loading-bar {
  height: 2px;
  background: var(--accent);
  width: 0;
  transition: width 0.3s;
  border-radius: 1px;
  margin-bottom: 8px;
}

/* ── Video Grid ────────────────────────────────────────────────────── */

/* Card view */
.card-view .video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.card-view .video-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--canvas);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
  padding: 12px 12px 0;
}
.card-view .video-card:hover {
  box-shadow: var(--shadow-lg);
  /* keep border color stable to avoid accent outline on hover */
  border-color: var(--border);
  transform: translateY(-6px);
}

/* Remove browser focus outline for mouse users but preserve for keyboard (accessibility) */
.video-card:focus,
.video-card a:focus,
.video-title:focus,
.video-thumb-link:focus {
  outline: none;
}

.video-card:focus-visible,
.video-card a:focus-visible,
.video-title:focus-visible,
.video-thumb-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 6px;
}

/* ======= Strong overrides to match preview samples ======= */
/* Ensure hover uses only lift+shadow, no border accent or outline. */
.card-view .video-card:hover,
.list-view .video-card:hover,
.compact-view .video-card:hover {
  /* Make hover very subtle to match preview: tiny lift, minimal shadow */
  box-shadow: var(--shadow-md) !important;
  border-color: var(--border) !important;
  transform: translateY(-2px) !important;
}

/* Prevent any outline from appearing on mouse hover (keep focus-visible for keyboard) */
.card-view .video-card:hover a,
.card-view .video-card:hover a *,
.list-view .video-card:hover a,
.compact-view .video-card:hover a {
  outline: none !important;
}

/* Avoid mobile tap highlight */
.video-card, .video-thumb-link, .video-title { -webkit-tap-highlight-color: transparent; }

/* Ensure the thumbnail image scales cleanly above other elements */
.card-view .video-card .video-thumb img {
  transform-origin: center center;
  transition: transform var(--transition-slow);
}
/* Disable large thumbnail scale on hover to match preview */
.card-view .video-card:hover .video-thumb img {
  transform: none !important;
}

.card-view .video-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--canvas-subtle);
  overflow: hidden;
  border-radius: var(--radius);
}
.card-view .video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.card-view .video-card:hover .video-thumb img { 
  transform: scale(1.08);
}

.card-view .video-info {
  padding: 10px 6px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-view .video-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition-fast);
}
.card-view .video-title:hover { 
  color: var(--accent);
  text-decoration: none;
}

/* Title underline reveal (clean, subtle) */
.video-title {
  position: relative;
}
.video-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -6px;
  height: 3px;
  width: 0;
  background: var(--accent);
  transition: width 200ms ease;
  border-radius: 2px;
}
.video-card:hover .video-title::after {
  width: 40%;
}

.card-view .video-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-view .video-desc {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: -2px;
}

/* List view */
.list-view .video-grid {
  display: grid;
  gap: 16px;
}

.list-view .video-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 12px;
  align-items: stretch;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-sm);
}
.list-view .video-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  transform: translateX(6px);
}

.list-view .video-thumb-link { display: contents; }
.list-view .video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--canvas-subtle);
  border-radius: var(--radius);
  overflow: hidden;
}
.list-view .video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.list-view .video-card:hover .video-thumb img {
  transform: scale(1.08);
}

.list-view .video-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.list-view .video-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--transition-fast);
}
.list-view .video-title:hover { 
  color: var(--accent);
  text-decoration: none;
}

.list-view .video-desc {
  display: -webkit-box;
  font-size: 14px;
  color: var(--fg-muted);
  line-height: 1.4;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.list-view .video-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
}

/* Shared meta styles */
.video-channel {
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-muted);
  transition: color var(--transition-fast);
  text-decoration: none;
}
.video-channel:hover {
  color: var(--accent);
}

.video-meta-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.video-views,
.video-date {
  font-size: 13px;
  color: var(--fg-subtle);
}

/* Play overlay */
.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  transition: all var(--transition-base);
  opacity: 0;
}
.video-card:hover .play-overlay {
  background: rgba(0, 0, 0, 0.4);
  opacity: 1;
}
.play-overlay svg { 
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
  transition: transform var(--transition-fast);
}
.video-card:hover .play-overlay svg {
  transform: scale(1.2);
}

/* ── Duration badge (thumbnail overlay) ───────────────────────────── */
.duration-badge {
  position: absolute;
  bottom: 5px;
  right: 6px;
  background: rgba(0, 0, 0, 0.82);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 1px 5px;
  border-radius: 3px;
  pointer-events: none;
  line-height: 1.6;
}

/* ── Duration inline (compact view only) ──────────────────────────── */
.video-title-row {
  display: flex;
  align-items: baseline;
  gap: .4rem;
  overflow: hidden;
  min-width: 0;
}
.video-title-row .video-title {
  flex: 1;
  min-width: 0;
}
/* 기본(card/list): duration-inline 숨김 */
.duration-inline { display: none; }

/* compact: duration-inline 표시, 썸네일/설명 숨김 */
.compact-view .duration-inline {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--canvas-subtle);
  border: 1px solid var(--border-muted);
  border-radius: 3px;
  padding: 0 5px;
  line-height: 1.6;
  white-space: nowrap;
}
.compact-view .video-thumb-link { display: none; }
.compact-view .video-desc       { display: none; }

/* ── Badges ────────────────────────────────────────────────────────── */
.video-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  transition: all var(--transition-fast);
}

.badge-transcript {
  background: var(--success-subtle);
  color: var(--success);
  border: 1px solid var(--success);
}
.badge-transcript:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* Compact (text-only) list view */
.compact-view .video-grid {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

#video-container {
  transition: opacity 0.12s ease;
}

.compact-view .video-card {
  display: flex;
  align-items: center;
  background: var(--canvas);
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.compact-view .video-card:last-child { border-bottom: none; }
.compact-view .video-card:hover { background: var(--canvas-subtle); }

.compact-view .video-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  min-width: 0;
  padding: 6px 12px;
  gap: 12px;
  cursor: pointer;
}

.compact-view .video-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.compact-view .video-title:hover { color: var(--accent); text-decoration: none; }

.compact-view .video-title-row {
  flex: 1;
  min-width: 0;
  display: block;
  line-height: 1.5;
}

.compact-view .video-title-row .video-title {
  display: inline;
  overflow-wrap: break-word;
  word-break: break-word;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
}

.compact-view .video-title-row .duration-inline {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
}

.compact-view .video-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.compact-view .video-channel {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
}

.compact-view .video-meta-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-view .video-badges { display: none; }

/* compact: 클릭 시 설명 펼침 */
.compact-view .video-card.expanded {
  background: var(--canvas-subtle);
}
.compact-view .video-card.expanded .video-info {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.compact-view .video-card.expanded .video-title-row {
  overflow: hidden;
}
.compact-view .video-card.expanded .video-desc {
  display: block;
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.5;
  padding: 4px 0 2px;
  border-top: 1px solid var(--border-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}
.compact-view .video-card.expanded .video-meta {
  flex-shrink: initial;
}

/* ── Infinite Scroll Sentinel ──────────────────────────────────────── */
#scroll-sentinel {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 64px;
  margin-top: 16px;
}

.loading-more {
  font-size: 13px;
  color: var(--fg-subtle);
  padding: 12px 0;
}

/* ── Empty State ───────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--fg-muted);
}

.empty-state svg {
  margin: 0 auto 16px;
  color: var(--fg-subtle);
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 8px;
}

.empty-state .empty-sub {
  font-size: 13px;
  color: var(--fg-subtle);
}

.empty-state code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--canvas-subtle);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Footer ────────────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  background: var(--canvas-subtle);
}

.site-footer .container {
  font-size: 12px;
  color: var(--fg-subtle);
}

/* ── Utility ───────────────────────────────────────────────────────── */
.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: inherit;
  cursor: pointer;
}
.btn-link:hover { text-decoration: underline; }

/* ── Responsive ────────────────────────────────────────────────────── */

/* Tablet (≤ 1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-w: 260px;
  }

  .page-layout {
    gap: 20px;
  }

  .card-view .video-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }
}

/* Mobile (≤ 900px) */
@media (max-width: 900px) {
  .page-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  /* 모바일에서 햄버거 버튼 오른쪽 끝 배치 */
  .mobile-menu-btn {
    display: flex;
    margin-left: auto;
  }

  /* 모바일에서 다크모드 버튼 숨김 (드로어 안에 있음) */
  .theme-toggle {
    display: none;
  }

  /* 모바일에서 드로어 활성화 */
  .mobile-drawer {
    display: flex;
  }

  /* 사이드바를 드로어 안에서 사용 */
  .sidebar {
    position: static;
    display: none;
  }

  /* 국가 선택은 모바일에서 숨김 (드로어에 있음) */
  .sidebar .country-section {
    display: none;
  }

  /* 드로어 안에서 sidebar 섹션을 1열로 */
  .mobile-drawer .sidebar {
    display: flex;
    flex-direction: column;
  }

  .list-view .video-card {
    grid-template-columns: 140px 1fr;
    gap: 12px;
    padding: 12px;
  }

  /* 드로어 너비 조정 */
  .mobile-drawer {
    width: 280px;
  }

  /* 컴팩트뷰: 모바일에서 2줄 레이아웃 + 줄바꿈 */
  .compact-view .video-info {
    flex-direction: column;
    align-items: stretch;
    padding: 7px 12px;
    gap: 2px;
  }

  .compact-view .video-title-row {
    flex: none;
    width: 100%;
    min-width: 0;
    padding-right: 0;
  }

  .compact-view .video-title-row .video-title {
    display: block;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: break-word;
    word-break: break-word;
    font-size: 13px;
    line-height: 1.4;
  }

  .compact-view .video-title-row .duration-inline {
    display: inline;
    margin-left: 5px;
  }

  .compact-view .video-meta {
    flex-shrink: 1;
    gap: 6px;
    justify-content: flex-start;
  }

  .compact-view .video-channel {
    max-width: none;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .compact-view .video-date {
    font-size: 12px;
    flex-shrink: 0;
  }
}

/* Small Mobile (≤ 640px) */
@media (max-width: 640px) {
  html {
    font-size: 13px;
  }

  .container {
    padding: 0 16px;
  }

  .site-header {
    height: auto;
  }

  .header-inner {
    height: 56px;
    gap: 8px;
  }

  .site-logo {
    font-size: 14px;
    gap: 6px;
  }

  .site-logo svg {
    width: 18px;
    height: auto;
  }

  .header-nav {
    gap: 2px;
  }

  .header-nav-link {
    padding: 6px 8px;
    font-size: 12px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .search-wrap {
    min-width: 100%;
  }

  .toolbar-status {
    flex-wrap: wrap;
    justify-content: center;
  }

  .view-toggle {
    align-self: center;
  }

  .sidebar {
    grid-template-columns: 1fr;
  }

  .card-view .video-grid {
    grid-template-columns: 1fr;
  }

  /* 리스트뷰: 모바일에서 작은 썸네일 유지 (가로 레이아웃) */
  .list-view .video-card {
    grid-template-columns: 110px 1fr;
    gap: 10px;
    padding: 10px;
  }

  .list-view .video-title {
    font-size: 14px;
    -webkit-line-clamp: 3;
  }

  .card-view .video-info {
    padding: 12px;
  }

}

/* Extra Small (≤ 480px) */
@media (max-width: 480px) {
  .site-main {
    padding: 20px 0 40px;
  }

  .mobile-drawer {
    width: 260px;
  }

  .sidebar-section {
    border-radius: var(--radius);
  }

  .channel-scroll {
    max-height: 300px;
  }

  .search-input {
    height: 36px;
    font-size: 13px;
  }

  .toolbar {
    padding: 10px;
  }
}

/* Print */
@media print {
  .site-header,
  .sidebar,
  .toolbar,
  .site-footer {
    display: none;
  }

  .page-layout {
    grid-template-columns: 1fr;
  }

  .video-card {
    break-inside: avoid;
  }
}

/* Accessibility */

/* Focus visible styles */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .sidebar-section {
    border-width: 2px;
  }

  .video-card {
    border-width: 2px;
  }

  .channel-btn:hover,
  .category-btn:hover {
    outline: 2px solid var(--accent);
  }
}

/* ===== Admin ===== */
.admin-wrap {
  max-width: 920px;
  padding-top: 24px;
  padding-bottom: 48px;
}

.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.admin-page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  margin: 0;
}

.admin-tabs {
  display: flex;
  gap: 4px;
}

.admin-tab {
  padding: 6px 14px;
  border-radius: var(--radius);
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.admin-tab:hover { background: var(--canvas-subtle); color: var(--fg); }
.admin-tab.active { background: var(--accent); color: #fff; }

.admin-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-muted);
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-add {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}

.admin-form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--canvas-subtle);
  color: var(--fg);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  flex: 1;
  min-width: 140px;
}
.admin-input:focus { border-color: var(--accent); background: var(--canvas); }

.admin-table-wrap {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--canvas-subtle);
  color: var(--fg-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--canvas-subtle); }

.admin-ch-link {
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
}
.admin-ch-link:hover { color: var(--accent); text-decoration: underline; }

.admin-muted {
  color: var(--fg-muted);
  font-family: monospace;
  font-size: 12px;
}

.admin-num { text-align: right; color: var(--fg-muted); }

.admin-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.admin-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--fg-muted);
  font-size: 14px;
}

.admin-import-msg {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}

.btn-edit, .btn-save, .btn-cancel, .btn-danger, .btn-primary {
  padding: 5px 14px;
  border: none;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
  white-space: nowrap;
}
.btn-edit, .btn-save, .btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-cancel {
  background: var(--canvas-subtle);
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger-xs {
  background: none; border: none; color: #dc2626; cursor: pointer;
  font-size: .75rem; padding: 0 2px; line-height: 1;
}
.btn-danger-xs:hover { color: #991b1b; }
.btn-edit:hover, .btn-save:hover, .btn-primary:hover, .btn-danger:hover { opacity: 0.82; }
.btn-cancel:hover { background: var(--border); }

.admin-country-list {
  margin-top: .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.admin-country-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--canvas);
  transition: background .15s;
}
.admin-country-row:last-child { border-bottom: none; }
.admin-country-row:hover { background: var(--canvas-subtle); }
.admin-country-label { flex: 1; font-size: .9rem; font-weight: 500; }
.admin-country-code-badge {
  font-size: .72rem;
  font-family: monospace;
  color: var(--fg-muted);
  background: var(--canvas-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
}

/* Inline country code used in various UI elements */
.country-code {
  font-size: .78rem;
  font-family: monospace;
  color: var(--fg-muted);
  background: var(--canvas-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: .5rem;
}
.admin-country-actions { display: flex; align-items: center; gap: .35rem; }
.btn-move {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  padding: 1px 8px;
  font-size: .85rem;
  color: var(--fg);
  line-height: 1.6;
}
.btn-move:hover { background: var(--canvas-subtle); }
.btn-danger-sm {
  background: #dc2626; color: #fff;
  border: none; border-radius: 4px; cursor: pointer;
  padding: 3px 10px; font-size: .8rem;
}
.btn-danger-sm:hover { background: #b91c1c; }
.admin-ok { color: #16a34a; font-size: .9rem; margin: 0 0 .5rem; }

@media (max-width: 640px) {
  .admin-form-row { flex-direction: column; }
  .admin-form-row .admin-input,
  .admin-form-row .btn-primary { width: 100%; flex: none; }
  .admin-table th:nth-child(2),
  .admin-table td:nth-child(2) { display: none; }
}

