/* ==========================================================================
   KeepTrack - Save for Later
   Premium Design System & Stylesheet
   ========================================================================== */

:root {
  /* Color Palette - Dark Mode Default */
  --bg-dark: #090d16;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 34, 52, 0.9);
  --bg-glass: rgba(15, 23, 42, 0.65);
  --bg-input: rgba(13, 19, 32, 0.8);
  --bg-input-focus: rgba(20, 29, 48, 0.95);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(99, 102, 241, 0.4);
  --border-glow: rgba(99, 102, 241, 0.25);

  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;
  --text-dim: #6B7280;
  --text-white: #FFFFFF;
  --text-heading: #FFFFFF;

  --bg-header: rgba(9, 13, 22, 0.75);
  --bg-modal: #0F172A;
  --bg-dropdown: #111726;
  --bg-poster-wrap: #111726;
  --bg-toast: #1E293B;
  --bg-secondary-btn: rgba(255, 255, 255, 0.08);
  --bg-secondary-btn-hover: rgba(255, 255, 255, 0.14);
  --bg-ghost-hover: rgba(255, 255, 255, 0.05);
  --bg-icon-btn: rgba(255, 255, 255, 0.05);
  --bg-icon-btn-hover: rgba(255, 255, 255, 0.1);
  --bg-tab: rgba(255, 255, 255, 0.04);
  --bg-tab-hover: rgba(255, 255, 255, 0.08);
  --bg-tab-active: rgba(26, 34, 52, 0.9);
  --bg-segmented: rgba(13, 19, 32, 0.7);
  --bg-select: rgba(13, 19, 32, 0.8);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-shadow: none;
  --card-shadow-hover: 0 16px 32px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.15);
  --ambient-opacity: 0.35;
  --detail-box-bg: rgba(99, 102, 241, 0.08);
  --detail-box-border: rgba(99, 102, 241, 0.2);
  --detail-box-color: #C7D2FE;

  /* Accent Gradients & Brand */
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --primary-gradient: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #EC4899 100%);
  --accent-cyan: #06B6D4;
  --accent-amber: #F59E0B;
  --accent-emerald: #10B981;
  --accent-rose: #F43F5E;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.35);

  /* Dimensions & Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ==========================================================================
   Light Theme Color System
   ========================================================================== */
[data-theme="light"] {
  --bg-dark: #F4F6FB;
  --bg-card: rgba(255, 255, 255, 0.94);
  --bg-card-hover: #FFFFFF;
  --bg-glass: rgba(255, 255, 255, 0.85);
  --bg-input: #F8FAFC;
  --bg-input-focus: #FFFFFF;
  
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-accent: rgba(99, 102, 241, 0.45);
  --border-glow: rgba(99, 102, 241, 0.2);

  --text-main: #1E293B;
  --text-muted: #64748B;
  --text-dim: #94A3B8;
  --text-white: #0F172A;
  --text-heading: #0F172A;

  --bg-header: rgba(255, 255, 255, 0.88);
  --bg-modal: #FFFFFF;
  --bg-dropdown: #FFFFFF;
  --bg-poster-wrap: #E2E8F0;
  --bg-toast: #FFFFFF;
  --bg-secondary-btn: rgba(15, 23, 42, 0.05);
  --bg-secondary-btn-hover: rgba(15, 23, 42, 0.09);
  --bg-ghost-hover: rgba(15, 23, 42, 0.04);
  --bg-icon-btn: rgba(15, 23, 42, 0.05);
  --bg-icon-btn-hover: rgba(15, 23, 42, 0.09);
  --bg-tab: rgba(15, 23, 42, 0.04);
  --bg-tab-hover: rgba(15, 23, 42, 0.08);
  --bg-tab-active: #FFFFFF;
  --bg-segmented: rgba(15, 23, 42, 0.06);
  --bg-select: #FFFFFF;
  
  --card-border: rgba(15, 23, 42, 0.08);
  --card-shadow: 0 4px 18px rgba(15, 23, 42, 0.05);
  --card-shadow-hover: 0 16px 36px rgba(15, 23, 42, 0.1), 0 0 20px rgba(99, 102, 241, 0.12);
  --ambient-opacity: 0.18;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.12);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.22);

  --detail-box-bg: rgba(99, 102, 241, 0.06);
  --detail-box-border: rgba(99, 102, 241, 0.18);
  --detail-box-color: #3730A3;
}

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

/* Component rules set `display: flex` on buttons, which beats the UA
   `[hidden] { display: none }` — so `hidden` must win explicitly. */
[hidden] {
  display: none !important;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Headings font */
h1, h2, h3, h4, h5, .brand-title, .month-year-title {
  font-family: 'Outfit', sans-serif;
  letter-spacing: -0.02em;
}

/* Ambient Backdrops */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.35;
}
.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
  top: -150px;
  left: -100px;
}
.glow-2 {
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, #ec4899 0%, transparent 70%);
  top: 30%;
  right: -200px;
}
.glow-3 {
  width: 450px;
  height: 450px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  bottom: -150px;
  left: 30%;
}

/* Layout */
.app-layout {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ==========================================================================
   Header & Navbar
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1rem 0;
  transition: background-color var(--transition-smooth), border-color var(--transition-smooth);
}

.header-container {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.logo-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
  box-shadow: var(--shadow-glow);
  transform: rotate(-3deg);
  transition: transform var(--transition-bounce);
}

.logo-area:hover .logo-icon {
  transform: rotate(0deg) scale(1.05);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-heading);
  transition: color var(--transition-fast);
}

.gradient-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

/* Header Search */
.header-search {
  flex: 1;
  max-width: 460px;
  position: relative;
  display: flex;
  align-items: center;
}

.header-search .search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-dim);
  font-size: 0.95rem;
  pointer-events: none;
}

.header-search input {
  width: 100%;
  height: 44px;
  padding: 0 2.5rem 0 2.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-main);
  font-size: 0.9rem;
  font-family: inherit;
  transition: all var(--transition-fast);
}

.header-search input:focus {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.header-search .clear-search-btn {
  position: absolute;
  right: 0.85rem;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.25rem;
  font-size: 0.85rem;
  border-radius: 50%;
  transition: color var(--transition-fast);
}

.header-search .clear-search-btn:hover {
  color: var(--text-main);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-icon-btn);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.theme-toggle-btn:hover {
  background: var(--bg-icon-btn-hover);
  color: var(--text-heading);
  transform: scale(1.08) rotate(15deg);
  border-color: var(--primary);
  box-shadow: 0 0 16px rgba(99, 102, 241, 0.3);
}

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

[data-theme="dark"] .theme-toggle-btn .icon-moon {
  display: block;
  color: #A5B4FC;
  filter: drop-shadow(0 0 4px rgba(165, 180, 252, 0.6));
}
[data-theme="dark"] .theme-toggle-btn .icon-sun {
  display: none;
}

[data-theme="light"] .theme-toggle-btn .icon-moon {
  display: none;
}
[data-theme="light"] .theme-toggle-btn .icon-sun {
  display: block;
  color: #D97706;
  filter: drop-shadow(0 0 5px rgba(217, 119, 6, 0.5));
}

.lang-selector {
  display: flex;
  align-items: center;
  background: var(--bg-icon-btn);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.25rem 0.6rem;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
}

.lang-selector .fa-globe {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.lang-dropdown {
  position: relative;
}

.lang-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  color: var(--text-heading);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.3rem 0.1rem;
}

.lang-caret {
  font-size: 0.62rem;
  color: var(--text-dim);
  transition: transform var(--transition-fast);
}

.lang-dropdown-btn[aria-expanded="true"] .lang-caret {
  transform: rotate(180deg);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 60;
  min-width: 180px;
  padding: 0.4rem;
  border-radius: var(--radius-md);
  background: var(--bg-dropdown);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.18s ease-out;
}

.lang-menu[hidden] {
  display: none;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: none;
  border-radius: calc(var(--radius-md) - 4px);
  background: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.lang-option:hover {
  background: var(--bg-icon-btn-hover);
  color: var(--text-heading);
}

.lang-option .lang-check {
  font-size: 0.7rem;
  width: 0.9rem;
  color: transparent;
}

.lang-option.active {
  color: var(--text-heading);
}

.lang-option.active .lang-check {
  color: var(--primary);
}

.lang-option-code {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
}

/* ==========================================================================
   Buttons & Micro-interactions
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-secondary-btn);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
  background: var(--bg-secondary-btn-hover);
  color: var(--text-heading);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border-subtle);
}

.btn-ghost:hover {
  background: var(--bg-ghost-hover);
  color: var(--text-heading);
  border-color: var(--primary);
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.825rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-icon-btn);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  color: var(--text-heading);
  background: var(--bg-icon-btn-hover);
  transform: rotate(30deg);
}

/* ==========================================================================
   Controls Section (Category Tabs, Segmented View, Sort)
   ========================================================================== */
.controls-section {
  padding: 2rem 0 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.group-navigation-wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
  scrollbar-width: none;
}
.group-navigation-wrap::-webkit-scrollbar {
  display: none;
}

.group-tabs-scroll {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.group-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 1.15rem;
  background: var(--bg-tab);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.group-tab i {
  font-size: 0.95rem;
}

.group-tab:hover {
  background: var(--bg-tab-hover);
  color: var(--text-heading);
  transform: translateY(-1px);
}

.group-tab.active {
  background: var(--bg-tab-active);
  border-color: var(--active-color, var(--primary));
  color: var(--text-heading);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15), 0 0 12px var(--active-glow, rgba(99, 102, 241, 0.3));
}

.group-tab-count {
  font-size: 0.75rem;
  background: var(--bg-icon-btn);
  color: var(--text-muted);
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
}

.group-tab.active .group-tab-count {
  background: rgba(99, 102, 241, 0.2);
  color: var(--primary);
}

.add-group-btn {
  flex-shrink: 0;
  border-radius: var(--radius-full);
  padding: 0.55rem 1rem;
}

/* Toolbar Controls */
.toolbar-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  padding: 0.9rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.toolbar-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-dim);
}

/* Segmented Control */
.segmented-control {
  display: flex;
  align-items: center;
  background: var(--bg-segmented);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}

.segmented-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.segmented-btn:hover {
  color: var(--text-heading);
}

.segmented-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* Custom Select Wrap */
.custom-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.form-select-sm {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-select);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 500;
  padding: 0.45rem 2rem 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.form-select-sm:focus {
  outline: none;
  border-color: var(--primary);
}

.select-chevron {
  position: absolute;
  right: 0.75rem;
  font-size: 0.7rem;
  color: var(--text-dim);
  pointer-events: none;
}

.toolbar-stats {
  margin-left: auto;
}

.stats-counter {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-icon-btn);
  padding: 0.35rem 0.8rem;
  border-radius: var(--radius-full);
}

.sync-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  background: var(--bg-icon-btn);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.sync-status.is-synced { color: var(--accent-cyan); }
.sync-status.is-blocked { color: var(--accent-amber); }

/* ==========================================================================
   Cloud Account Chip & Menu
   ========================================================================== */
.account-area {
  position: relative;
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-icon-btn);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

.account-chip:hover {
  background: var(--bg-icon-btn-hover);
  color: var(--text-heading);
  border-color: var(--primary);
}

.account-chip:disabled {
  opacity: 0.55;
  cursor: default;
}

.account-avatar {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-full);
  object-fit: cover;
}

#accountAvatarFallback {
  font-size: 1.3rem;
}

.account-chip-label {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 60;
  min-width: 210px;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-dropdown);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-md);
}

.account-menu-email {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
}

.account-menu-action {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: var(--bg-secondary-btn);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.account-menu-action:hover {
  background: var(--bg-secondary-btn-hover);
  color: var(--text-heading);
  border-color: var(--primary);
}

@media (max-width: 900px) {
  .account-chip-label {
    display: none;
  }
}

/* ==========================================================================
   Group Sections (Month/Year & Category Sections)
   ========================================================================== */
.section-block {
  margin-bottom: 2.75rem;
  animation: fadeIn 0.4s ease-out;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.section-header-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.section-badge-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
  letter-spacing: -0.01em;
}

.section-count {
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg-icon-btn);
  color: var(--text-muted);
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
}

/* Section header share button (specificity beats the generic .action-btn:hover) */
.section-header .section-share-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  font-size: 0.82rem;
  background: var(--bg-icon-btn);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}

.section-header .section-share-btn:hover {
  background: var(--bg-icon-btn-hover);
  border-color: var(--primary);
  color: var(--primary);
}

/* Items Grid */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

/* ==========================================================================
   Card Design (High Aesthetics)
   ========================================================================== */
.item-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth), border-color var(--transition-smooth), background-color var(--transition-smooth);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: pointer;
}

.item-card:hover {
  transform: translateY(-6px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow: var(--card-shadow-hover);
  background: var(--bg-card-hover);
}

/* Poster Aspect */
.card-poster-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  background: var(--bg-poster-wrap);
  overflow: hidden;
}

.card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.item-card:hover .card-poster {
  transform: scale(1.05);
}

/* Language Badge on Poster */
.card-lang-badge {
  position: absolute;
  top: 2.75rem;
  right: 0.75rem;
  background: rgba(10, 14, 23, 0.82);
  backdrop-filter: blur(8px);
  color: #93C5FD;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(147, 197, 253, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  z-index: 5;
  pointer-events: none;
}

/* Poster Placeholder when no image */
.card-poster-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: linear-gradient(135deg, #131b2e 0%, #1e293b 100%);
  color: var(--text-dim);
}

.card-poster-placeholder i {
  font-size: 2.75rem;
  opacity: 0.5;
}

/* Floating Badges on Poster */
.card-floating-top {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 5;
  pointer-events: none;
}

.card-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(10, 14, 23, 0.8);
  backdrop-filter: blur(8px);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(255, 255, 255, 0.12);
  pointer-events: auto;
}

.card-fav-btn {
  pointer-events: auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(10, 14, 23, 0.8);
  backdrop-filter: blur(8px);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.card-fav-btn:hover, .card-fav-btn.is-fav {
  color: #FBBF24;
  transform: scale(1.1);
  background: rgba(10, 14, 23, 0.95);
}

/* Rating Badge */
.card-rating-badge {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(8px);
  color: #FBBF24;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(251, 191, 36, 0.25);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  z-index: 5;
}

/* Added Date Badge */
.card-date-badge {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(8px);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 5;
}

/* Card Body */
.card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.5rem;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-year {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
  white-space: nowrap;
}

.card-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0.1rem;
}

.card-notes {
  font-size: 0.75rem;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-style: italic;
}

/* Card Footer & Action Buttons */
.card-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Status Pill */
.status-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.status-pill.planned {
  background: rgba(99, 102, 241, 0.15);
  color: #A5B4FC;
  border-color: rgba(99, 102, 241, 0.3);
}

.status-pill.in_progress {
  background: rgba(245, 158, 11, 0.15);
  color: #FCD34D;
  border-color: rgba(245, 158, 11, 0.3);
}

.status-pill.completed {
  background: rgba(16, 185, 129, 0.15);
  color: #6EE7B7;
  border-color: rgba(16, 185, 129, 0.3);
}

.status-pill:hover {
  filter: brightness(1.2);
  transform: scale(1.03);
}

/* Card Action Buttons */
.card-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.action-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.85rem;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-white);
}

.action-btn.delete-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-rose);
}

/* ==========================================================================
   Autocomplete Component & Modal Forms
   ========================================================================== */
.autocomplete-container {
  position: relative;
}

.autocomplete-hint {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0.5rem;
}

.input-with-loader {
  position: relative;
  display: flex;
  align-items: center;
}

.input-leading-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-dim);
  pointer-events: none;
}

.input-with-loader .form-input {
  padding-left: 2.75rem;
  padding-right: 2.75rem;
}

.search-spinner {
  position: absolute;
  right: 1rem;
  color: var(--primary);
  font-size: 1rem;
}

/* Autocomplete Dropdown List */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-dropdown);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75), 0 0 20px rgba(99, 102, 241, 0.2);
  z-index: 100;
  max-height: 380px;
  overflow-y: auto;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-subtle);
}

.dropdown-title {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.source-tag {
  font-size: 0.7rem;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
}

.suggestions-list {
  display: flex;
  flex-direction: column;
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover, .suggestion-item.highlighted {
  background: rgba(99, 102, 241, 0.15);
}

.suggestion-thumb {
  width: 44px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #1e293b;
  flex-shrink: 0;
}

.suggestion-thumb-fallback {
  width: 44px;
  height: 60px;
  border-radius: var(--radius-sm);
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.suggestion-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.suggestion-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestion-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.suggestion-rating {
  color: #FBBF24;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.suggestion-desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

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

.modal-dialog {
  background: var(--bg-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), 0 0 30px rgba(99, 102, 241, 0.2);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(15px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-lg {
  max-width: 680px;
}
.modal-md {
  max-width: 560px;
}
.modal-sm {
  max-width: 440px;
}

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

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.modal-icon {
  font-size: 1.2rem;
  color: var(--primary);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-heading);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}

.float-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

.modal-body {
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* Form Controls */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.form-label .required {
  color: var(--accent-rose);
}

.label-help {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: normal;
}

.form-input, .form-textarea {
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all var(--transition-fast);
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  background: var(--bg-input-focus);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.form-row {
  display: flex;
  gap: 1rem;
}
.flex-1 {
  flex: 1;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.cover-quick-preview {
  margin-top: 0.5rem;
  width: 100%;
  height: 90px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.cover-quick-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.no-preview-text {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.rating-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.rating-input-wrap .star-icon {
  position: absolute;
  left: 0.85rem;
  color: #FBBF24;
  font-size: 0.85rem;
  pointer-events: none;
}

.rating-input-wrap input {
  padding-left: 2.25rem;
}

/* Checkbox */
.checkbox-container {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
}

.checkbox-container input {
  display: none;
}

.checkmark {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.checkbox-container input:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-container input:checked + .checkmark::after {
  content: '✓';
  color: white;
  font-size: 0.8rem;
  font-weight: 800;
}

.checkbox-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-main);
}

/* Custom Group Modal Pickers */
.icon-selector-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
}

.icon-choice {
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-choice:hover, .icon-choice.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.05);
}

.color-palette-picker {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.color-bubble {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.color-bubble:hover, .color-bubble.active {
  transform: scale(1.18);
  border-color: white;
  box-shadow: 0 0 12px var(--c);
}

/* ==========================================================================
   Detail Modal View
   ========================================================================== */
.detail-dialog {
  position: relative;
  overflow: hidden;
}

.detail-banner {
  position: relative;
  height: 220px;
  overflow: hidden;
}

.detail-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(20px) brightness(0.4);
  transform: scale(1.15);
}

.detail-header-overlay {
  position: absolute;
  bottom: 1.25rem;
  left: 1.5rem;
  right: 1.5rem;
  display: flex;
  align-items: flex-end;
  gap: 1.25rem;
}

.detail-poster-thumb {
  width: 105px;
  height: 155px;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: var(--shadow-lg);
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.detail-header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.detail-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  line-height: 1.2;
}

.detail-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.detail-body-pad {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.detail-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 0.35rem;
}

.detail-synopsis {
  font-size: 0.925rem;
  line-height: 1.6;
  color: var(--text-main);
}

.detail-notes-box {
  background: var(--detail-box-bg);
  border: 1px solid var(--detail-box-border);
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--detail-box-color);
}

/* Multilingual Detail Modal Components */
.detail-lang-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-tab);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.5rem 0.85rem;
  margin-bottom: 0.85rem;
  gap: 0.5rem;
}

.detail-lang-label {
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.detail-lang-pills {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.detail-lang-pill {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.detail-lang-pill:hover {
  color: var(--text-heading);
  background: var(--bg-tab-hover);
  border-color: var(--primary);
}

.detail-lang-pill.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

.detail-lang-pill.has-content:not(.active) {
  border-color: rgba(99, 102, 241, 0.4);
  color: var(--text-main);
  background: rgba(99, 102, 241, 0.08);
}

.detail-lang-delete {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 0.7rem;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.detail-lang-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--accent-rose);
  color: var(--accent-rose);
}

.detail-no-translation-box {
  background: var(--bg-tab);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: flex-start;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.lang-candidate-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.lang-candidate-item {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 0.7rem 0.85rem;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-main);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.lang-candidate-item:last-child {
  border-bottom: none;
}

.lang-candidate-item:hover {
  background: var(--bg-tab-hover);
}

.lang-candidate-poster {
  width: 42px;
  height: 58px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-poster-wrap);
  flex-shrink: 0;
}

.lang-candidate-poster-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.lang-candidate-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.lang-candidate-title {
  font-size: 0.9rem;
  font-weight: 600;
}

.lang-candidate-year {
  color: var(--text-dim);
  font-weight: 500;
}

.lang-candidate-desc {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lang-candidate-source {
  font-size: 0.7rem;
  color: var(--text-dim);
}

.form-lang-pill {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  margin-right: 0.75rem;
}

/* ==========================================================================
   Empty State & Toast Notifications
   ========================================================================== */
.empty-state {
  text-align: center;
  padding: 5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-icon-wrap {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-icon-btn);
  border: 1px dashed var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-dim);
  margin-bottom: 1.25rem;
}

.empty-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-heading);
  margin-bottom: 0.5rem;
}

.empty-desc {
  max-width: 440px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--bg-toast);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.875rem;
  font-weight: 600;
  animation: slideInRight 0.3s ease;
  transition: opacity 0.3s ease;
}

.toast.toast-success i {
  color: var(--accent-emerald);
}

.toast.toast-info i {
  color: var(--primary);
}

/* Light Theme Component Overrides */
[data-theme="light"] .status-pill.planned {
  background: rgba(99, 102, 241, 0.1);
  color: #4F46E5;
  border-color: rgba(99, 102, 241, 0.25);
}

[data-theme="light"] .status-pill.in_progress {
  background: rgba(245, 158, 11, 0.12);
  color: #B45309;
  border-color: rgba(245, 158, 11, 0.25);
}

[data-theme="light"] .status-pill.completed {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.25);
}

[data-theme="light"] .card-notes {
  background: rgba(99, 102, 241, 0.08);
  color: #4338CA;
}

[data-theme="light"] .card-poster-placeholder {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  color: #64748B;
}

[data-theme="light"] .card-title {
  color: #0F172A;
}

[data-theme="light"] .card-description {
  color: #475569;
}

[data-theme="light"] .modal-overlay {
  background: rgba(15, 23, 42, 0.45);
}

[data-theme="light"] .suggestion-item:hover,
[data-theme="light"] .suggestion-item.highlighted {
  background: rgba(99, 102, 241, 0.08);
}

/* ==========================================================================
   Keyframes & Utilities
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.text-amber { color: #FBBF24; }

/* Responsive adjustments */
@media (max-width: 900px) {
  .header-container {
    flex-wrap: wrap;
    gap: 1rem;
  }
  .header-search {
    order: 3;
    max-width: 100%;
    width: 100%;
  }
  .toolbar-controls {
    flex-direction: column;
    align-items: flex-start;
  }
  .toolbar-stats {
    margin-left: 0;
  }
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .items-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }
  .brand-subtitle {
    display: none;
  }
  .form-row {
    flex-direction: column;
  }
  .segmented-btn span {
    display: none;
  }
  .lang-selector .fa-globe {
    display: none;
  }
}

/* ==========================================================================
   SHARE LINK MODAL
   ========================================================================== */
.share-modal-subject {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
}

.share-link-box {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
}

.share-link-box .form-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  text-overflow: ellipsis;
}

.share-link-box .form-input[disabled] {
  opacity: 0.6;
  cursor: default;
}

.share-link-note {
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.share-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   SHARED-LIST VIEW (a link someone opened from a friend)
   ========================================================================== */
/* The visitor is reading, not editing: anything that would touch their own
   library is taken away until they leave the shared view. */
body[data-shared="true"] .controls-section,
body[data-shared="true"] .header-search,
body[data-shared="true"] #openAddModalBtn,
body[data-shared="true"] #emptyState {
  display: none;
}

.shared-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.shared-banner-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.shared-banner-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  background: var(--primary-gradient);
  color: #fff;
  font-size: 1.05rem;
}

.shared-banner-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-heading);
  overflow-wrap: anywhere;
}

.shared-banner-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  max-width: 60ch;
}

.shared-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.shared-all-saved {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--accent-emerald);
}

/* Read-only card: no status cycling, no favourite toggle, no edit or delete. */
.shared-card .card-poster-wrap {
  cursor: default;
}

.shared-card-source {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.shared-card-saved {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--accent-emerald);
  font-size: 0.85rem;
}

@media (max-width: 600px) {
  .shared-banner {
    align-items: flex-start;
  }
  .share-link-box {
    flex-direction: column;
  }
}
