﻿@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap");

/* ── Tokens ─────────────────────────────────────── */
:root {
  /* Arduino page uses teal/green accent */
  --accent: #10b981;
  --accent-2: #06b6d4;
  --accent-3: #7c6fee;
  --accent-glow: rgba(16, 185, 129, 0.22);

  --bg: #f0f2f8;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-s: #ffffff;
  --input-bg: rgba(0, 0, 0, 0.04);
  --border: rgba(0, 0, 0, 0.07);
  --text-h: #0d0f1a;
  --text-p: #4a5069;
  --text-muted: #8892b0;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.13);
  --header-bg: rgba(240, 242, 248, 0.88);

  --r-xl: 24px;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;

  /* legacy compat */
  --font: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --app-max-width: 640px;
  --bottom-nav-height: 0px;

  /* kept for modal resource buttons that reference these directly */
  --btn-bg: rgba(255, 255, 255, 0.9);
  --border-light: rgba(0, 0, 0, 0.04);
  --text-primary: #0d0f1a;
  --text-secondary: #4a5069;
}

[data-theme="dark"] {
  --bg: #0a0a0f;
  --surface: rgba(22, 22, 34, 0.82);
  --surface-s: #16161f;
  --input-bg: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --text-h: #f0f2ff;
  --text-p: #8892b0;
  --text-muted: #4a5069;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.7);
  --header-bg: rgba(10, 10, 15, 0.88);

  --btn-bg: rgba(22, 22, 34, 0.9);
  --border-light: rgba(255, 255, 255, 0.06);
  --text-primary: #f0f2ff;
  --text-secondary: #8892b0;
}

/* ── Reset ──────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-h);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  transition:
    background 0.4s,
    color 0.4s;
}

::selection {
  background: rgba(16, 185, 129, 0.18);
}

/* ── Mesh Background ────────────────────────────── */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bg-mesh::before,
.bg-mesh::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.28;
}
[data-theme="dark"] .bg-mesh::before,
[data-theme="dark"] .bg-mesh::after {
  opacity: 0.14;
}

.bg-mesh::before {
  width: 70vw;
  height: 70vw;
  top: -20vw;
  left: -20vw;
  background: radial-gradient(circle, #10b981, #06b6d4);
  animation: floatA 18s ease-in-out infinite alternate;
}
.bg-mesh::after {
  width: 55vw;
  height: 55vw;
  bottom: -15vw;
  right: -15vw;
  background: radial-gradient(circle, #7c6fee, #10b981);
  animation: floatB 22s ease-in-out infinite alternate;
}
@keyframes floatA {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(6vw, 5vw) scale(1.1);
  }
}
@keyframes floatB {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(-5vw, -6vw) scale(1.08);
  }
}

/* ── App Layout ─────────────────────────────────── */
.app-layout {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  max-width: var(--app-max-width);
  margin: 0 auto;
}

.background-pattern {
  display: none;
}

/* ── Sticky Header ──────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  /* Break out of .app-layout max-width to span full viewport */
  width: 100vw;
  margin-left: calc(50% - 50vw);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: 56px;
  background: var(--header-bg);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border-bottom: 1px solid var(--border);
  transition:
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
    background 0.4s;
  animation: slideDown 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header.hidden {
  transform: translateY(-100%);
}

/* Back button */
.back-button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-h);
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.back-button:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.back-button:active {
  transform: scale(0.9);
}
.back-button svg {
  width: 16px;
  height: 16px;
}

/* Header content */
.header-content {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title-block {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.header-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1;
}
.header h1 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-h);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(135deg, var(--text-h) 40%, var(--text-p));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.header p {
  display: none;
}

/* Menu button */
.menu-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-p);
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.menu-btn:hover {
  color: var(--text-h);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.menu-btn:active {
  transform: scale(0.93);
}

/* Icon button (theme toggle etc.) */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-p);
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
  flex-shrink: 0;
  font-size: 0;
}
.icon-btn:hover {
  color: var(--text-h);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.icon-btn:active {
  transform: scale(0.93);
}

.header-extras {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Controls (search + filter pills) ──────────── */
.controls {
  padding: 10px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-box {
  position: relative;
}

.search-box::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238892b0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.7;
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text-h);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font);
  backdrop-filter: blur(12px);
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}
.search-box input::placeholder {
  color: var(--text-muted);
}
.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Filter pills */
.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  height: 34px;
  padding: 0 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-p);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-transform: capitalize;
  box-shadow: var(--shadow);
}
.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text-h);
  transform: translateY(-1px);
}
.filter-btn.active {
  background: linear-gradient(
    135deg,
    var(--accent),
    color-mix(in srgb, var(--accent) 60%, var(--accent-2))
  );
  color: white;
  border-color: transparent;
  box-shadow: 0 6px 18px var(--accent-glow);
}

/* ── Setup Grid ─────────────────────────────────── */
.setup-grid {
  padding: 8px 16px 100px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Setup Card ─────────────────────────────────── */
.setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  cursor: pointer;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

@media (hover: hover) {
  .setup-card:hover {
    transform: translateY(-5px);
    box-shadow:
      var(--shadow-lg),
      0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
    border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  }
  .setup-card:hover .tap-to-view {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    color: var(--accent);
    letter-spacing: 0.3px;
  }
}

.setup-card:active {
  transform: scale(0.98);
  opacity: 0.95;
}

.setup-image {
  width: 100%;
  height: 260px;
  object-fit: cover;
  display: block;
  background: var(--input-bg);
}

.card-caption {
  padding: 12px 14px;
}

.caption-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-h);
  letter-spacing: -0.3px;
  margin-bottom: 6px;
  line-height: 1.3;
}

.caption-text {
  font-size: 13px;
  color: var(--text-p);
  line-height: 1.55;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.caption-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.caption-category {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--accent);
  text-transform: capitalize;
}

.caption-footer .icon-btn {
  width: 32px;
  height: 32px;
}
.caption-footer .icon-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.tap-to-view {
  padding: 10px 16px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  border-top: 1px solid var(--border);
  background: var(--surface);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* ── Detail Modal (Modern Sheet / Card) ─────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition:
    opacity 0.3s cubic-bezier(0.32, 0.72, 0, 1),
    visibility 0.3s;
}
.modal.active {
  visibility: visible;
  opacity: 1;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 640px;
  height: 100%;
  max-height: 100%;
  margin-top: 0;
  background: var(--surface-s);
  border-radius: 0;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 501;
  box-shadow: none;
}

@media (min-width: 640px) {
  .modal {
    align-items: center;
    padding: 24px;
  }
  .modal-content {
    margin-top: 0;
    height: auto;
    max-height: 85vh;
    border-radius: 24px;
    border: 1px solid var(--border);
    transform: scale(0.96) translateY(30px);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.25);
  }
}

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

.modal-close {
  position: sticky;
  top: max(16px, env(safe-area-inset-top, 16px));
  margin-left: 16px;
  margin-right: auto;
  margin-top: max(16px, env(safe-area-inset-top, 16px));
  margin-bottom: calc(-36px - max(16px, env(safe-area-inset-top, 16px)));
  z-index: 50;
  width: 36px;
  height: 36px;
  background: rgba(13, 15, 26, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.modal-close:hover {
  background: rgba(13, 15, 26, 0.75);
  transform: scale(1.08);
  border-color: rgba(255, 255, 255, 0.3);
}
.modal-close:active {
  transform: scale(0.95);
}

.modal-body {
  padding: 0 0 32px;
}

.modal-image {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: 0;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  background: var(--input-bg);
  position: relative;
  z-index: 10;
}

@media (min-width: 640px) {
  .modal-image {
    border-radius: 24px 24px 0 0;
  }
}

.modal-content-inner {
  padding: 0 20px;
}

.modal-header {
  margin-bottom: 8px;
}

.modal-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: -0.8px;
  color: var(--text-h);
  margin-bottom: 4px;
  line-height: 1.15;
}

.setup-category {
  display: inline-block;
  padding: 4px 12px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--accent);
  text-transform: capitalize;
}

.modal-description {
  font-size: 14px;
  color: var(--text-p);
  line-height: 1.6;
  margin-bottom: 16px;
  letter-spacing: -0.1px;
}

/* Product section */
.modal-products {
  margin-bottom: 0;
}

.products-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.products-list {
  display: flex;
  flex-direction: column;
  position: relative;
  margin-bottom: 0;
}

.product-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 10px 12px;
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 48px;
  margin-bottom: 6px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow);
}
.product-item:hover {
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.product-item:last-child {
  margin-bottom: 0 !important;
}

.product-icon-box {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.product-icon-box svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
}

.product-details {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.product-category {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
  line-height: 1;
}

.product-item .product-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-h);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-links {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Affiliate buttons */
.affiliate-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: 0.2px;
  transition: all 0.2s ease;
  white-space: nowrap;
  cursor: pointer;
  /* resource buttons get overridden via inline style, keep these as defaults */
  color: var(--text-h);
  background: var(--input-bg);
  border-color: var(--border);
}

.affiliate-btn.disabled {
  cursor: not-allowed;
  pointer-events: none;
  background: var(--input-bg);
  color: var(--text-muted);
  border: 1px dashed var(--border);
  box-shadow: none;
}

.shopee-btn {
  background: color-mix(in srgb, #ee4d2d 10%, transparent);
  color: #e8562a;
  border-color: color-mix(in srgb, #ee4d2d 20%, transparent);
}
.shopee-btn:not(.disabled):hover {
  background: color-mix(in srgb, #ee4d2d 16%, transparent);
  border-color: color-mix(in srgb, #ee4d2d 35%, transparent);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(238, 77, 45, 0.15);
}

.tiktok-btn {
  background: var(--input-bg);
  color: var(--text-h);
  border-color: var(--border);
}
.tiktok-btn:not(.disabled):hover {
  background: var(--surface-s);
  border-color: color-mix(in srgb, var(--text-h) 30%, transparent);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.btn-label {
  font-size: 12px;
  font-weight: 700;
}

/* Collapse / expand */
.hidden-item {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition:
    max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin-bottom: 0;
  padding: 0;
  border-width: 0;
  min-height: 0;
}
.products-list.expanded .hidden-item {
  opacity: 1;
  margin-bottom: 6px;
  padding: 10px 12px;
  border-width: 1px;
  max-height: 500px;
}

.show-more-btn-inline,
.show-more-btn-simple {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-radius: var(--r-lg);
  color: var(--accent);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  min-height: 42px;
  letter-spacing: -0.1px;
  transition: all 0.2s ease;
  backdrop-filter: blur(12px);
}
.show-more-btn-simple {
  margin-top: 6px;
  margin-bottom: 16px;
}

.show-more-btn-inline:hover,
.show-more-btn-simple:hover {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px var(--accent-glow);
}
.show-more-btn-inline:active,
.show-more-btn-simple:active {
  transform: translateY(0);
}

.show-more-icon {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  opacity: 0.5;
}
.show-more-text {
  font-weight: 700;
  font-size: 14px;
}
.chevron-icon {
  transition: transform 0.3s ease;
  flex-shrink: 0;
  opacity: 0.65;
}
.show-more-btn-inline.expanded .chevron-icon,
.show-more-btn-simple.expanded .chevron-icon {
  transform: rotate(180deg);
}

/* Affiliate disclosure */
.affiliate-disclosure {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  font-size: 12px;
  color: var(--text-p);
  line-height: 1.6;
  backdrop-filter: blur(8px);
}
.affiliate-disclosure strong {
  color: var(--text-h);
}

/* ── Load More ──────────────────────────────────── */
.load-more-container {
  padding: 16px 16px;
  text-align: center;
}

.load-more-btn {
  width: 100%;
  max-width: 400px;
  height: 48px;
  padding: 0 24px;
  background: linear-gradient(
    135deg,
    var(--accent),
    color-mix(in srgb, var(--accent) 70%, var(--accent-2))
  );
  border: none;
  border-radius: 99px;
  color: white;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 10px;
  box-shadow: 0 6px 20px var(--accent-glow);
}
.load-more-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.load-more-btn:active {
  transform: scale(0.98);
}

.showing-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Empty State ────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}
.empty-state-icon {
  font-size: 52px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state h3 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-h);
}
.empty-state p {
  font-size: 14px;
  color: var(--text-p);
}

/* ── Search / Filter Modals (bottom sheet) ──────── */
.search-modal,
.filter-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  z-index: 600;
  display: none;
  align-items: flex-end;
}
.search-modal.active,
.filter-modal.active {
  display: flex;
}

.search-modal-content,
.filter-modal-content {
  width: 100%;
  background: var(--surface-s);
  border-radius: 28px 28px 0 0;
  padding: 24px 20px;
  max-height: 80vh;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
}

.search-modal-header,
.filter-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.search-modal-title,
.filter-modal-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-h);
  letter-spacing: -0.4px;
}

.search-modal-close,
.filter-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--input-bg);
  border-radius: 50%;
  font-size: 16px;
  color: var(--text-p);
  cursor: pointer;
  transition: all 0.2s;
}
.search-modal-close:hover,
.filter-modal-close:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text-h);
}

.filter-modal .filter-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.filter-modal .filter-btn {
  width: 100%;
  justify-content: center;
  height: 44px;
}

/* ── Bottom Navigation ──────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px;
  background: var(--surface-s);
  border: 1px solid var(--border);
  border-radius: 99px;
  box-shadow:
    var(--shadow-lg),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  z-index: 400;
  animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 18px;
  border-radius: 99px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  min-width: 60px;
}

.nav-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.nav-btn:hover {
  color: var(--text-h);
  background: color-mix(in srgb, var(--text-h) 6%, transparent);
}

.nav-btn:hover svg {
  transform: translateY(-2px);
}

.nav-btn:active {
  transform: scale(0.93);
}

.nav-btn.active {
  color: white;
  background: linear-gradient(
    135deg,
    var(--accent),
    color-mix(in srgb, var(--accent) 60%, var(--accent-2))
  );
  box-shadow: 0 4px 14px var(--accent-glow);
}

.nav-btn.active svg {
  stroke: white;
}

.nav-btn-label {
  line-height: 1;
}

/* ── Popover menu ───────────────────────────────── */
.click-outside {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
}

.popover-menu {
  position: fixed;
  background: var(--surface-s);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 8px;
  width: 220px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
  box-shadow: var(--shadow-lg);
  transform-origin: top right;
  animation: menuIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes menuIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.popover-menu.active {
  display: flex;
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: 12px;
  cursor: pointer;
  color: var(--text-h);
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  transition: background 0.15s;
  font-family: var(--font);
  text-decoration: none;
}
.menu-item:hover {
  background: color-mix(in srgb, var(--text-h) 6%, transparent);
}

/* Toggle switch */
.switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--text-muted);
  transition: 0.3s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
input:checked + .slider {
  background: var(--accent);
}
input:checked + .slider:before {
  transform: translateX(16px);
}

/* ── Info modal ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 700;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.3s;
}
.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-card-info {
  background: var(--surface-s);
  padding: 36px 32px 28px;
  border-radius: 28px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  transform: translateY(24px) scale(0.96);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.modal-overlay.active .modal-card-info {
  transform: translateY(0) scale(1);
}

.info-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-h);
  margin-bottom: 12px;
}
.info-text {
  font-size: 14px;
  color: var(--text-p);
  line-height: 1.65;
  margin-bottom: 24px;
}
.info-text strong {
  color: var(--text-h);
  font-weight: 700;
}

.info-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border: none;
  padding: 13px 32px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 8px 20px var(--accent-glow);
  transition:
    opacity 0.2s,
    transform 0.2s;
  font-family: var(--font);
}
.info-btn:hover {
  opacity: 0.9;
}
.info-btn:active {
  transform: scale(0.97);
}

/* ── Animations ─────────────────────────────────── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.setup-card {
  animation: fadeIn 0.4s ease both;
}

/* ── Screen reader util ─────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
