/* ===== Reset & Base ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  background: #0a0a0f;
  color: #c8cad0;
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a {
  color: #6ea8fe;
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: #93c5fd;
}
::selection {
  background: #2563eb40;
  color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #444;
}

/* ===== Layout ===== */
.container {
  margin: 0 auto;
  padding: 32px 32px;
}
h1 {
  text-align: center;
  margin-bottom: 16px;
  font-size: 1.75rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.search-bar {
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Navbar ===== */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: rgba(14, 14, 20, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: sticky;
  top: 0;
  z-index: 50;
}
.top-bar-left {
  font-weight: 600;
  color: #fff;
  font-size: 0.95rem;
}
.top-bar-brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  transition: opacity 0.2s;
}
.top-bar-brand:hover {
  opacity: 0.8;
  color: #fff;
}
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.top-bar-user {
  color: #6b7280;
  font-size: 0.85rem;
}
.top-bar-link {
  color: #9ca3af;
  font-size: 0.85rem;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.2s;
}
.top-bar-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

/* Hamburger button (mobile only) */
.top-bar-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  transition: background 0.2s;
  flex-shrink: 0;
}
.top-bar-hamburger:hover {
  background: rgba(255, 255, 255, 0.08);
}
.top-bar-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: #9ca3af;
  border-radius: 2px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  transform-origin: center;
}
.top-bar-hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.top-bar-hamburger.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.top-bar-hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== Site Toggle Switch ===== */
.site-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 24px;
}
.site-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #555;
  transition: color 0.3s;
  user-select: none;
}
.site-label.active {
  color: #fff;
}
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-radius: 28px;
  transition: background 0.4s;
}
.slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.switch input:checked + .slider {
  background: linear-gradient(135deg, #9333ea, #7c3aed);
}
.switch input:checked + .slider::before {
  transform: translateX(24px);
}

/* ===== Search Bar ===== */
.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 32px;
}
.search-bar input {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e0e0e0;
  font-size: 0.95rem;
  outline: none;
  transition:
    border-color 0.2s,
    background 0.2s,
    box-shadow 0.2s;
}
.search-bar input:focus {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.06);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.search-bar input::placeholder {
  color: #555;
}
.search-bar button {
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.search-bar button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}
.search-bar button:active {
  transform: translateY(0);
}
.search-bar button:disabled {
  background: #1e1e2a;
  color: #555;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ===== Spinner ===== */
.spinner {
  display: none;
  text-align: center;
  padding: 24px;
  color: #6b7280;
  font-size: 0.9rem;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Results Grid ===== */
.results {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
}
.results .card {
  width: 150px;
  flex: 0 0 150px;
}
.card {
  width: 100%;
  max-width: 200px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  border-color: rgba(37, 99, 235, 0.3);
}
.card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: #12121a;
  display: block;
}
.card .info {
  padding: 12px 14px;
}
.card .title {
  font-size: 0.88rem;
  font-weight: 600;
  color: #e2e4e9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Downloaded Badge ===== */
.downloaded-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.9);
  box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
  pointer-events: none;
  z-index: 2;
}
.downloaded-badge::after {
  content: "";
  display: block;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  margin: 5px auto 0;
}

/* ===== Modal Overlay ===== */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 100;
  overflow: hidden;
}
.modal {
  background: #111118;
  max-width: 720px;
  margin: 48px auto;
  border-radius: 16px;
  padding: 28px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}
.modal .close {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 1.4rem;
  cursor: pointer;
  color: #555;
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.modal .close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* Modal Header */
.modal-header {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}
.modal-header img {
  width: 140px;
  height: 200px;
  object-fit: cover;
  border-radius: 10px;
  background: #12121a;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}
.modal-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.modal-meta h2 {
  font-size: 1.25rem;
  margin-bottom: 8px;
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.modal-meta .genres {
  font-size: 0.8rem;
  color: #6ea8fe;
  margin-bottom: 6px;
}
.modal-meta .year {
  font-size: 0.8rem;
  color: #6b7280;
  margin-bottom: 10px;
}
.modal-meta .desc {
  font-size: 0.85rem;
  color: #9ca3af;
  line-height: 1.55;
  max-height: 110px;
  overflow-y: auto;
}

/* Controls row */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  align-items: center;
}
.controls select {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background-color: #1a1a2e;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  color: #c8cad0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
  padding-right: 30px;
}
.controls select option {
  background-color: #1a1a2e;
  color: #c8cad0;
}
.controls select:hover {
  border-color: rgba(255, 255, 255, 0.2);
}
.controls select:focus {
  border-color: #2563eb;
  outline: none;
}

/* Episodes header */
.episodes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.episodes-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #e2e4e9;
}
.select-all-label {
  font-size: 0.8rem;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}
.select-all-label:hover {
  color: #9ca3af;
}
.select-all-label input {
  margin-right: 5px;
  accent-color: #2563eb;
}

/* Queue sync source badge */
.queue-sync-badge {
  color: #4ade80;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Sync selects (settings & autosync pages) */
.sync-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e0e0e0;
  font-size: 0.9rem;
  cursor: pointer;
}
.sync-select option {
  color: #000;
  background: #fff;
}

/* Episode list (legacy, kept for compatibility) */
.episode-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}
.episode-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
  transition: background 0.15s;
}
.episode-item:last-child {
  border-bottom: none;
}
.episode-item:hover {
  background: rgba(255, 255, 255, 0.03);
}
.episode-item input {
  margin-right: 12px;
  flex-shrink: 0;
  accent-color: #2563eb;
}
.episode-item .ep-num {
  color: #6ea8fe;
  width: 50px;
  flex-shrink: 0;
  font-weight: 600;
  font-size: 0.8rem;
}
.episode-item .ep-downloaded {
  color: #22c55e;
  font-size: 0.85rem;
  margin: 0 6px;
}
.season-label .season-downloaded {
  color: #22c55e;
  font-size: 0.8rem;
  margin-left: 8px;
}
.episode-item .ep-title {
  color: #9ca3af;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.ep-langs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: 8px;
}
.ep-lang-flag {
  width: 20px;
  height: auto;
  display: block;
  opacity: 0.85;
}

/* Status bar */
.status-bar {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.15);
  border-radius: 10px;
  font-size: 0.85rem;
  color: #6ea8fe;
  display: none;
}
.status-bar.active {
  display: block;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1a1a24;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 14px 20px;
  color: #e0e0e0;
  font-size: 0.85rem;
  z-index: 200;
  display: none;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
}

/* ===== Navbar ===== */
/* (already defined above in Top bar section) */

/* ===== Auth Pages (login / setup) ===== */
.auth-container {
  max-width: 400px;
  margin: 80px auto;
  padding: 36px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.auth-container h1 {
  text-align: center;
  margin-bottom: 8px;
  font-size: 1.5rem;
  color: #fff;
}
.auth-container h2 {
  text-align: center;
  margin-bottom: 20px;
  font-size: 1rem;
  color: #6b7280;
  font-weight: 400;
}
.auth-container .auth-info {
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 16px;
  line-height: 1.5;
}
.auth-container .auth-error {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  text-align: center;
}
.auth-container form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-container input {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e0e0e0;
  font-size: 0.95rem;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.auth-container input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.auth-container button {
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.auth-container button:hover {
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}

/* ===== Settings Page ===== */
.settings-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 20px;
}
.settings-container h1 {
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: left;
}
.settings-notice {
  font-size: 0.84rem;
  color: #fbbf24;
  line-height: 1.5;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.2);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 24px;
}
.settings-notice code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-family: "SF Mono", "Fira Code", monospace;
}
.settings-section {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
}
.settings-section h2 {
  font-size: 1.05rem;
  color: #e2e4e9;
  margin-bottom: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-subtitle {
  font-size: 0.9rem;
  color: #9ca3af;
  font-weight: 500;
  margin-bottom: 10px;
}
.settings-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.settings-row input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e0e0e0;
  font-size: 0.9rem;
  outline: none;
  min-width: 200px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  font-family: "SF Mono", "Fira Code", monospace;
}
.settings-row input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.settings-row button {
  padding: 10px 20px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}
.settings-row button:hover {
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.settings-hint {
  font-size: 0.8rem;
  color: #4b5563;
  margin-top: 10px;
}

/* ===== User Management ===== */
.add-user-form {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 20px;
}
.add-user-form h3 {
  font-size: 0.9rem;
  color: #e2e4e9;
  margin-bottom: 12px;
  font-weight: 600;
}
.add-user-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.add-user-row input,
.add-user-row select {
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e0e0e0;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s;
}
.add-user-row input:focus {
  border-color: #2563eb;
}
.add-user-row button {
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.add-user-row button:hover {
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.user-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
}
.user-table th,
.user-table td {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.user-table th {
  background: rgba(255, 255, 255, 0.03);
  color: #6b7280;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.user-table td {
  color: #c8cad0;
}
.user-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}
.user-table select {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #c8cad0;
  font-size: 0.8rem;
}
.btn-del {
  padding: 5px 12px;
  border-radius: 6px;
  border: none;
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}
.btn-del:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* ===== SSO ===== */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
}
.auth-divider span {
  color: #6b7280;
  font-size: 0.85rem;
}
.sso-button {
  display: block;
  text-align: center;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #c8cad0;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.sso-button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

/* Auth badges */
.auth-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.auth-local {
  background: rgba(37, 99, 235, 0.15);
  color: #6ea8fe;
}
.auth-sso {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
}

/* ===== Season Accordion ===== */
.season-accordion {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.season-section {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.season-section:last-child {
  border-bottom: none;
}
.season-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.2s;
}
.season-header:hover {
  background: rgba(255, 255, 255, 0.06);
}
.season-header .season-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  color: #e2e4e9;
  font-weight: 500;
}
.season-header .season-arrow {
  font-size: 0.65rem;
  color: #6b7280;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
}
.season-header.expanded .season-arrow {
  transform: rotate(90deg);
}
.season-header .season-all-label {
  font-size: 0.8rem;
  color: #6b7280;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color 0.2s;
}
.season-header .season-all-label:hover {
  color: #9ca3af;
}
.season-header .season-all-label input {
  cursor: pointer;
  accent-color: #2563eb;
}
.season-body {
  display: none;
  background: rgba(0, 0, 0, 0.15);
}
.season-body.expanded {
  display: block;
}

/* ===== Modal Download Actions ===== */
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  justify-content: flex-end;
}
.modal-actions button {
  padding: 11px 22px;
  border-radius: 10px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-download-all {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.btn-download-all:hover {
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}
.btn-download-all:active {
  transform: translateY(0);
}
.btn-download-all:disabled {
  background: #1e1e2a;
  color: #555;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.btn-download-selected {
  background: rgba(255, 255, 255, 0.04);
  color: #6ea8fe;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-download-selected:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #93c5fd;
  border-color: rgba(255, 255, 255, 0.15);
}
.btn-download-selected:disabled {
  background: #1e1e2a;
  color: #444;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.04);
}
.btn-download-all-langs {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}
.btn-download-all-langs:hover {
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
  transform: translateY(-1px);
}
.btn-download-all-langs:active {
  transform: translateY(0);
}
.btn-download-all-langs:disabled {
  background: #1e1e2a;
  color: #555;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* ===== Browse Sections ===== */
.browse-section {
  margin-bottom: 48px;
}
.browse-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.browse-heading::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 1em;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 2px;
}
.browse-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}
.browse-card {
  width: 140px;
  flex: 0 0 140px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.browse-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  border-color: rgba(37, 99, 235, 0.3);
}
.browse-card img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: #12121a;
  display: block;
}
.browse-card .browse-info {
  padding: 10px 12px;
}
.browse-card .browse-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: #e2e4e9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.browse-card .browse-genre {
  font-size: 0.72rem;
  color: #6b7280;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Random Button ===== */
/* Inherits .search-bar button styles */

/* ===== Queue Badge ===== */
.queue-badge {
  display: inline-block;
  background: #2563eb;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 4px;
  vertical-align: middle;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}

/* ===== Queue Modal ===== */
.queue-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 150;
  overflow-y: auto;
}
.queue-modal {
  background: #111118;
  max-width: 640px;
  margin: 48px auto;
  border-radius: 16px;
  padding: 28px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
.queue-modal .close {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 1.4rem;
  cursor: pointer;
  color: #555;
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.queue-modal .close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.queue-modal-title {
  font-size: 1.15rem;
  color: #fff;
  font-weight: 700;
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}

/* Queue list */
.queue-list {
  max-height: 500px;
  overflow-y: auto;
}
.queue-empty {
  text-align: center;
  color: #6b7280;
  padding: 40px 20px;
  font-size: 0.9rem;
}

/* Queue item */
.queue-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: all 0.2s;
}
.queue-item:last-child {
  margin-bottom: 0;
}
.queue-item-active {
  border-color: rgba(37, 99, 235, 0.3);
  background: rgba(37, 99, 235, 0.06);
}
.queue-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.queue-item-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e4e9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
  padding-top: 1px;
}
.queue-item-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.queue-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 6px;
}
.queue-meta-pill {
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 8px;
  border-radius: 5px;
}
.queue-user {
  color: #a78bfa !important;
  background: rgba(167, 139, 250, 0.1) !important;
}
.queue-path {
  color: #9ca3af !important;
}

/* Status badges */
.queue-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.queue-status-running {
  background: rgba(37, 99, 235, 0.15);
  color: #6ea8fe;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sync-spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid rgba(110, 168, 254, 0.3);
  border-top-color: #6ea8fe;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
.queue-status-queued {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}
.queue-status-completed {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}
.queue-status-failed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}
.queue-status-cancelling {
  background: rgba(251, 146, 36, 0.15);
  color: #fb923c;
}
.queue-status-cancelled {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

/* Progress bar */
.queue-progress {
  margin-top: 10px;
}
.queue-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.queue-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.queue-progress-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.78rem;
  color: #9ca3af;
  margin-top: 5px;
  gap: 8px;
}
.queue-progress-footer > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.queue-progress-pct {
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.queue-progress-dl {
  font-size: 0.72rem;
  color: #6b7280;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Errors */
.queue-errors {
  margin-top: 8px;
  font-size: 0.78rem;
  color: #f87171;
}
.queue-errors-expandable {
  cursor: pointer;
  user-select: none;
}
.queue-errors-expandable:hover {
  color: #fca5a5;
}
.queue-errors-toggle {
  font-size: 0.6rem;
  display: inline-block;
  transition: transform 0.2s;
  margin-left: 4px;
}
.queue-error-details {
  display: none;
  margin-top: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.12);
}
.queue-error-details.expanded {
  display: block;
}
.queue-errors-expandable.expanded .queue-errors-toggle {
  transform: rotate(90deg);
}
.queue-error-detail {
  font-size: 0.75rem;
  color: #fca5a5;
  padding: 4px 0;
  border-bottom: 1px solid rgba(239, 68, 68, 0.08);
  word-break: break-word;
}
.queue-error-detail:last-child {
  border-bottom: none;
}

/* Remove button */
.queue-remove {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s;
  line-height: 1;
}
.queue-remove:hover {
  color: #f87171;
}
.queue-move {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0 3px;
  transition: color 0.2s;
  line-height: 1;
}
.queue-move:hover {
  color: #6ea8fe;
}
.queue-cancel {
  background: none;
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #fbbf24;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.queue-cancel:hover {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.5);
}

/* ===== Library Page ===== */
.library-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 20px;
}
.library-container h1 {
  font-size: 1.5rem;
  color: #fff;
  margin-bottom: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: left;
}
.library-list {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
}
.library-empty {
  text-align: center;
  color: #6b7280;
  padding: 40px 20px;
  font-size: 0.9rem;
}

/* Location header */
.library-location-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  background: rgba(37, 99, 235, 0.06);
  border-bottom: 1px solid rgba(37, 99, 235, 0.1);
  transition: background 0.2s;
}
.library-location-header:hover {
  background: rgba(37, 99, 235, 0.1);
}

/* Title accordion */
.library-title-section {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.library-title-section:last-child {
  border-bottom: none;
}
.library-title-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.2s;
}
.library-title-header:hover {
  background: rgba(255, 255, 255, 0.06);
}
.library-title-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.library-title-name {
  font-size: 0.88rem;
  color: #e2e4e9;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-title-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.library-arrow {
  font-size: 0.65rem;
  color: #6b7280;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
  flex-shrink: 0;
}
.library-arrow.expanded {
  transform: rotate(90deg);
}
.library-title-body {
  display: none;
  background: rgba(0, 0, 0, 0.15);
}
.library-title-body.expanded {
  display: block;
}

/* Season rows */
.library-season-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px 10px 32px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
  font-size: 0.85rem;
  color: #c8cad0;
}
.library-season-header:hover {
  background: rgba(255, 255, 255, 0.03);
}
.library-season-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.library-season-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.library-season-body {
  display: none;
  background: rgba(0, 0, 0, 0.1);
}
.library-season-body.expanded {
  display: block;
}

/* Episode rows */
.library-episode {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 48px;
  font-size: 0.82rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.15s;
}
.library-episode:last-child {
  border-bottom: none;
}
.library-episode:hover {
  background: rgba(255, 255, 255, 0.02);
}
.library-ep-num {
  color: #6ea8fe;
  width: 44px;
  flex-shrink: 0;
  font-weight: 600;
}
.library-ep-file {
  color: #9ca3af;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.library-ep-size {
  color: #6b7280;
  flex-shrink: 0;
  font-size: 0.78rem;
}

/* Meta badges */
.library-meta {
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
  text-align: center;
}
.library-meta-size {
  width: 76px;
  flex-shrink: 0;
}

/* Delete button */
.library-delete {
  background: none;
  border: none;
  color: #6b7280;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  transition: color 0.2s;
  line-height: 1;
  flex-shrink: 0;
}
.library-delete:hover {
  color: #f87171;
}

/* ===== Captcha Modal ===== */
.captcha-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
  z-index: 300;
  overflow-y: auto;
}
.captcha-modal {
  background: #111118;
  max-width: 700px;
  margin: 48px auto;
  border-radius: 16px;
  padding: 28px;
  position: relative;
  border: 1px solid rgba(251, 191, 36, 0.2);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}
.captcha-modal .close {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 1.4rem;
  cursor: pointer;
  color: #555;
  background: none;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.captcha-modal .close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.captcha-modal-title {
  font-size: 1.1rem;
  color: #fbbf24;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.captcha-hint {
  font-size: 0.82rem;
  color: #9ca3af;
  margin-bottom: 14px;
}
.captcha-img-wrap {
  width: 100%;
  background: #0d0d14;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.captcha-screenshot {
  width: 100%;
  display: block;
  cursor: crosshair;
}

/* Captcha status badge */
.queue-status-captcha {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

/* Captcha solve button */
.queue-captcha-btn {
  background: linear-gradient(135deg, #d97706, #b45309);
  border: none;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: 4px;
}
.queue-captcha-btn:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
}

/* ===== Index: Hero / Heading area ===== */
.site-hero {
  text-align: center;
  padding: 48px 20px 32px;
}
.site-hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  background: linear-gradient(135deg, #fff 30%, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}
.site-hero .hero-sub {
  font-size: 0.9rem;
  color: #6b7280;
}

/* ===== Settings: field grouping ===== */
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 140px;
}
.settings-field-label {
  font-size: 0.78rem;
  color: #6b7280;
  font-weight: 500;
}
.settings-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  cursor: pointer;
}
.settings-checkbox-row input[type="checkbox"] {
  accent-color: #2563eb;
  cursor: pointer;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.settings-checkbox-row span {
  font-size: 0.88rem;
  color: #c8cad0;
}

/* ===== Modal: subtitle info text & bottom action row ===== */
.modal-info-text {
  color: #6ea8fe;
  font-size: 0.9rem;
  margin-bottom: 18px;
  word-break: break-word;
}
.modal-btn-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

/* ===== Button: ghost (neutral bordered) ===== */
.btn-ghost {
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #c8cad0;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ===== Autosync container ===== */
.autosync-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 24px;
}
.autosync-container h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.autosync-intro {
  font-size: 0.9rem;
  color: #6b7280;
  margin-bottom: 28px;
}

/* ===== Push Button ===== */
.top-bar-push-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

/* ===== Page Container (stats, favourites, etc.) ===== */
.page-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 36px 24px;
}
.page-header {
  margin-bottom: 32px;
}
.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
  text-align: left;
}
.page-subtitle {
  font-size: 0.9rem;
  color: #6b7280;
  margin-bottom: 0;
}

/* ===== Stats Page ===== */
.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.stats-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
/* Main KPI row: exactly 3 columns */
.stats-kpi-main {
  grid-template-columns: repeat(3, 1fr);
}
.stat-card {
  --kpi-color: #6b7280;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-top: 3px solid var(--kpi-color);
  border-radius: 14px;
  padding: 20px 18px;
  text-align: left;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
  border-color: var(--kpi-color);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--kpi-color);
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 6px;
}
.stat-label {
  font-size: 0.85rem;
  color: #e2e4e9;
  font-weight: 600;
  margin-bottom: 4px;
}
.stat-sub {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 2px;
  line-height: 1.4;
}
.stats-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 24px;
}
.stats-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #e2e4e9;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}
.stats-loading {
  text-align: center;
  color: #6b7280;
  padding: 60px 20px;
  font-size: 0.9rem;
}

/* ===== Favourites / Results Grid (new pages) ===== */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
}
.result-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.result-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
  border-color: rgba(37, 99, 235, 0.3);
}
.result-poster-wrap {
  position: relative;
  overflow: hidden;
}
.result-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: #12121a;
  display: block;
}
.result-info {
  padding: 10px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.result-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e2e4e9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-meta {
  font-size: 0.72rem;
  color: #6b7280;
}
.result-actions {
  padding: 8px 12px 10px;
  display: flex;
  gap: 6px;
}

/* ===== Generic Button Utilities ===== */
.btn {
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: 6px;
}
.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
}

/* ===== Mobile Nav ===== */
@media (max-width: 768px) {
  .top-bar {
    flex-wrap: wrap;
    padding: 12px 16px;
    gap: 0;
  }
  .top-bar-hamburger {
    display: flex;
  }
  .top-bar-right {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    padding: 12px 0 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 10px;
  }
  .top-bar-right.open {
    display: flex;
  }
  .top-bar-link {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.95rem;
    border-radius: 8px;
  }
  .top-bar-push-btn {
    width: 100%;
    text-align: left;
    padding: 10px 14px;
  }
  .top-bar-user {
    padding: 8px 14px;
    font-size: 0.85rem;
  }
}

/* ===== Responsive improvements ===== */
@media (max-width: 600px) {
  .container {
    padding: 20px 14px;
  }
  /* Modal: slide-up bottom sheet on mobile */
  .overlay {
    padding: 0;
  }
  .overlay .modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    max-height: 92vh;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
  }
  /* Accordion scrollbar mit fixem Limit damit Buttons immer sichtbar bleiben */
  .season-accordion {
    flex-shrink: 0;
    min-height: 60px;
    max-height: calc(92vh - 370px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Buttons immer unten sichtbar */
  .modal-actions {
    flex-shrink: 0;
    flex-direction: column;
    margin-top: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }
  .modal-actions button {
    width: 100%;
  }
  .modal-header {
    flex-shrink: 0;
    flex-direction: row;
    align-items: flex-start;
    text-align: left;
    gap: 12px;
  }
  .modal-header img {
    width: 60px;
    height: 90px;
    flex-shrink: 0;
    border-radius: 6px;
  }
  .modal-meta .desc {
    display: none;
  }
  .modal-meta h2 {
    font-size: 1rem;
    margin-bottom: 4px;
  }
  /* Alle fixen Leisten im Modal nicht zusammendrücken */
  .controls,
  .episodes-header,
  .status-bar,
  .spinner {
    flex-shrink: 0;
  }
  .search-bar {
    flex-wrap: wrap;
  }
  .search-bar input {
    min-width: 100%;
  }
  .settings-row {
    flex-direction: column;
  }
  .settings-row input {
    width: 100%;
    min-width: 0;
  }
  .settings-row button {
    width: 100%;
  }
  .queue-modal {
    margin: 0 12px 12px;
    padding: 20px;
  }
  .library-container {
    padding: 20px 14px;
  }
  .page-container {
    padding: 20px 14px;
  }
  .page-title {
    font-size: 1.4rem;
  }
  .stats-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-kpi-main {
    grid-template-columns: repeat(2, 1fr);
  }
  .results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .results .card {
    width: calc(50% - 9px);
    flex: 0 0 calc(50% - 9px);
  }
  .browse-card {
    width: calc(50% - 7px);
    flex: 0 0 calc(50% - 7px);
  }
  .browse-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  /* Tables: horizontal scroll on mobile */
  .user-table, .stats-section .user-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Toast: move up above mobile browser bar */
  .toast {
    bottom: 72px;
    right: 14px;
    left: 14px;
    max-width: none;
  }
  /* Queue modal on mobile */
  .queue-overlay {
    align-items: flex-end;
  }
  .queue-modal {
    margin: 0;
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    overflow-y: auto;
  }
  /* Autosync container */
  .autosync-container {
    padding: 20px 14px;
  }
  .site-hero {
    padding: 28px 14px 20px;
  }
  .site-hero h1 {
    font-size: 1.6rem;
  }
}
