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

:root {
  --navy: #1c1f2e;
  --navy-light: #252840;
  --red: #cc1111;
  --red-hover: #aa0e0e;
  --white: #ffffff;
  --gray-50: #f9f9fb;
  --gray-100: #f0f0f4;
  --gray-200: #e2e2ea;
  --gray-400: #9898b0;
  --gray-700: #3a3a50;
  --text: #1a1a2e;
  --text-muted: #6b6b85;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);

  /* Status farver */
  --want: #3b82f6;
  --watching: #16a34a;
  --watching1: #16a34a;
  --watching2: #dc2626;
  --watching3: #2563eb;
  --watching4: #7c3aed;
  --watched: #9898b0;
  --skip: #dc2626;
}

html, body { height: 100%; font-family: 'Inter', system-ui, sans-serif; font-size: 15px; color: var(--text); background: var(--gray-50); }

.hidden { display: none !important; }

/* ── LOGIN ─────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy);
}

.login-box {
  background: var(--white);
  border-radius: 12px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 24px;
}
.login-logo .dot { color: var(--red); }

.login-box h1 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--navy);
}
.login-box p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
  line-height: 1.5;
}

.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 1.5px solid var(--gray-200);
  color: var(--text);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  justify-content: center;
}
.btn-google:hover { border-color: var(--gray-400); box-shadow: var(--shadow); }

.login-error {
  margin-top: 16px;
  padding: 10px;
  background: #fef2f2;
  color: var(--red);
  border-radius: var(--radius);
  font-size: 13px;
}

/* ── ABOUT POPUP ────────────────────────────────────── */
.about-box {
  max-width: 480px;
  padding: 28px 24px;
}

.about-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.about-desc a {
  color: var(--red);
  text-decoration: none;
  font-weight: 600;
}

.about-desc a:hover { text-decoration: underline; }

.about-services {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.about-service {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text);
  padding: 10px 4px;
  border-radius: 10px;
  transition: background 0.15s;
}

.about-service:hover {
  background: var(--gray-100);
}

.about-service img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  object-fit: contain;
}

.about-service span {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}

.login-services {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-200);
}

.login-services-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.login-services-label a {
  color: var(--red);
  text-decoration: none;
  font-weight: 600;
}

.login-services-label a:hover { text-decoration: underline; }

.login-service-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.login-service-icons img {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  object-fit: contain;
  background: white;
}

/* ── HEADER ─────────────────────────────────────────── */
header {
  background: var(--navy);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--white);
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.header-logo .dot { color: var(--red); }
.header-sub { color: var(--gray-400); font-weight: 400; font-size: 15px; }

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.filter-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  position: relative;
}
.filter-btn:hover { color: var(--white); background: rgba(255,255,255,0.08); }
.filter-btn.active {
  color: var(--white);
  background: rgba(255,255,255,0.1);
}
.filter-btn.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--red);
  border-radius: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.btn-add {
  background: var(--red);
  color: var(--white);
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
}
.btn-add:hover { background: var(--red-hover); }

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius);
  transition: background 0.15s;
  position: relative;
  color: var(--white);
  font-size: 14px;
}
.user-menu:hover { background: rgba(255,255,255,0.08); }

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--gray-200);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 140px;
  overflow: hidden;
}
.user-dropdown button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  transition: background 0.1s;
}
.user-dropdown button:hover { background: var(--gray-50); }

/* ── MAIN ─────────────────────────────────────────── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}

.page-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
}
.page-header h2 { font-size: 20px; font-weight: 600; color: var(--navy); }
.item-count { font-size: 14px; color: var(--text-muted); }

.toggle-btn {
  margin-left: auto;
  background: none;
  border: 1.5px solid var(--gray-200);
  color: var(--text-muted);
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
}
.toggle-btn:hover { border-color: var(--gray-400); color: var(--text); }
.toggle-btn.active { background: var(--navy); border-color: var(--navy); color: var(--white); }

/* ── GRID ─────────────────────────────────────────── */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.item-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
}
.item-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }

.item-poster {
  aspect-ratio: 2/3;
  background: var(--gray-100);
  position: relative;
  overflow: hidden;
}
.item-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.item-poster-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  gap: 8px;
  font-size: 13px;
}
.item-poster-placeholder svg { opacity: 0.4; }

.type-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(28,31,46,0.85);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.watched-badge, .skip-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  color: var(--white);
  font-size: 15px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.watched-badge { background: var(--watching1); }
.skip-badge    { background: var(--skip); font-size: 12px; }

.item-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.item-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
  color: var(--navy);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.item-title .check { color: var(--watching1); font-weight: 700; }
.item-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.item-members {
  padding: 8px 12px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.member-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}
.member-pill.want      { background: #eff6ff; color: var(--want); }
.member-pill.watching,
.member-pill.watching1 { background: #f0fdf4; color: var(--watching1); }
.member-pill.watching2 { background: #fef2f2; color: var(--watching2); }
.member-pill.watching3 { background: #eff6ff; color: var(--watching3); }
.member-pill.watching4 { background: #f5f3ff; color: var(--watching4); }
.member-pill.watched   { background: var(--gray-100); color: var(--watched); }
.member-pill.skip      { background: var(--gray-100); color: var(--gray-400); }
.member-pill.none      { background: var(--gray-100); color: var(--gray-400); }
.pill-check { font-size: 10px; font-weight: 700; color: #16a34a; }
.pill-skip { font-size: 13px; font-weight: 700; color: #dc2626; line-height: 1; }

/* ── EMPTY STATE ─────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}
.empty-state p { margin-bottom: 16px; font-size: 16px; }

/* ── MODAL ─────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.modal-box {
  position: relative;
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-100);
}
.modal-header h3 { font-size: 16px; font-weight: 600; color: var(--navy); }
.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
}
.modal-close:hover { background: var(--gray-100); }

/* Search modal */
.search-wrap {
  padding: 16px 24px;
  position: relative;
}
.search-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--red); }

.search-results { padding: 0 24px; }

.search-result-item {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.1s;
  align-items: flex-start;
}
.search-result-item:hover { background: var(--gray-50); }
.search-result-item + .search-result-item { border-top: 1px solid var(--gray-100); }

.search-result-poster {
  width: 44px;
  height: 66px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--gray-100);
  flex-shrink: 0;
}
.search-result-info { flex: 1; min-width: 0; }
.search-result-title { font-weight: 600; font-size: 14px; color: var(--navy); }
.search-result-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.search-result-platform {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 500;
  background: #eff6ff;
  color: var(--want);
  padding: 2px 7px;
  border-radius: 4px;
}

.manual-toggle {
  padding: 12px 24px 16px;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--gray-100);
}
.link-btn {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  padding: 0;
}

.manual-form {
  padding: 0 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: var(--white);
  transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--red); }
.form-row { display: flex; gap: 8px; }
.form-row .form-input { flex: 1; }

.btn-primary {
  background: var(--red);
  color: var(--white);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s;
  align-self: flex-start;
}
.btn-primary:hover { background: var(--red-hover); }

/* Status modal */
.status-modal-box { max-width: 460px; }

.status-item-info {
  display: flex;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
}
.status-poster {
  width: 60px;
  height: 90px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--gray-100);
  flex-shrink: 0;
}
.status-item-details { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.status-meta { font-size: 13px; color: var(--text-muted); }

.platform-select {
  padding: 6px 10px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  color: var(--navy);
  background: var(--white);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.platform-select:focus { border-color: var(--red); }

.status-users { padding: 16px 24px; display: flex; flex-direction: column; gap: 14px; }

.status-user-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.status-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--gray-200);
  flex-shrink: 0;
}
.status-user-name { font-size: 14px; font-weight: 500; flex: 1; }
.status-options {
  display: flex;
  gap: 4px;
}
.status-btn {
  background: none;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  padding: 5px 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: all 0.12s;
  white-space: nowrap;
  color: var(--text-muted);
}
.status-btn:hover { border-color: var(--gray-400); color: var(--text); }
.status-btn.active-want      { background: #eff6ff; border-color: var(--want);     color: var(--want); }
.status-btn.active-watching,
.status-btn.active-watching1 { background: #f0fdf4; border-color: var(--watching1); color: var(--watching1); }
.status-btn.active-watching2 { background: #fef2f2; border-color: var(--watching2); color: var(--watching2); }
.status-btn.active-watching3 { background: #eff6ff; border-color: var(--watching3); color: var(--watching3); }
.status-btn.active-watching4 { background: #f5f3ff; border-color: var(--watching4); color: var(--watching4); }
.status-btn.active-watched   { background: var(--gray-100); border-color: var(--watched); color: var(--watched); }
.status-btn.active-skip      { background: #fef2f2; border-color: var(--skip);     color: var(--skip); }

.status-profiles {
  padding: 0 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.profile-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.profile-label {
  font-size: 13px;
  color: var(--text-muted);
  width: 100px;
  flex-shrink: 0;
}
.profile-select {
  flex: 1;
  padding: 6px 10px;
  border: 1.5px solid;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  background: var(--white);
  cursor: pointer;
  outline: none;
}

.status-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
}
.btn-danger {
  background: none;
  border: 1.5px solid #fca5a5;
  color: var(--skip);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-danger:hover { background: #fef2f2; }

/* ── SPINNER ─────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  position: absolute;
  right: 38px;
  top: 50%;
  transform: translateY(-50%);
}
@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }

/* ── RESPONSIVE ──────────────────────────────────── */
@media (max-width: 640px) {
  /* Header forenklet */
  .header-inner { padding: 0 14px; gap: 8px; height: 52px; }
  .header-sub { display: none; }
  .header-logo span:first-of-type { font-size: 16px; }

  /* Nav flyttes til bunden */
  .header-nav { display: none; }

  /* Bruger-menu forenklet */
  #user-name { display: none; }
  .user-menu svg { display: none; }
  .user-menu { padding: 4px; }

  /* Main */
  main { padding: 16px 12px 80px; } /* plads til bottom nav */
  .page-header { margin-bottom: 16px; }
  .page-header h2 { font-size: 17px; }

  /* Grid: 2 kolonner på telefon */
  .items-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* Kortere pills */
  .member-pill { font-size: 10px; padding: 2px 6px; }
  .item-body { padding: 8px 10px 4px; }
  .item-title { font-size: 13px; }
  .item-meta { font-size: 11px; }
  .item-members { padding: 6px 10px 10px; gap: 4px; }

  /* Modaler fylder hele skærmen */
  .modal { padding: 0; align-items: flex-end; }
  .modal-box {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
  }
  .status-modal-box { max-width: 100%; }

  /* Status knapper mindre */
  .status-btn { font-size: 10px; padding: 4px 6px; }
  .status-options { gap: 3px; }

  /* Manuel tilføj */
  .form-row { flex-direction: column; }

  /* Login */
  .login-box { padding: 32px 20px; margin: 16px; border-radius: 12px; }

  /* Bottom navigation bar */
  .bottom-nav {
    display: flex;
  }
}

/* Bottom nav — kun synlig på mobil */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--navy);
  height: 60px;
  z-index: 150;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.5);
  font-size: 10px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  padding: 8px 0;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.bottom-nav-btn.active { color: var(--white); }
.bottom-nav-btn svg { width: 22px; height: 22px; }

/* Tilføj-knap i bunden (mobil) */
.bottom-add-btn {
  position: fixed;
  bottom: 72px;
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--red);
  color: var(--white);
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(204,17,17,0.4);
  z-index: 140;
  display: none;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 640px) {
  .bottom-add-btn { display: flex; }
  .btn-add { display: none; }
}
