@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:wght@400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #eef3fb;
  --surface:   #ffffff;
  --card:      #f7faff;
  --border:    #ccd9f0;
  --accent:    #1a56db;
  --accent2:   #e63946;
  --green:     #16a34a;
  --text:      #0f172a;
  --muted:     #64748b;
  --radius:    10px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
}

/* ── HEADER ── */
header {
  background: linear-gradient(135deg, #1a56db 0%, #1e40af 100%);
  border-bottom: 2px solid #1e3a8a;
  padding: 16px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(26,86,219,0.15);
}
.header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.header-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.8rem;
  letter-spacing: 2px;
  color: #ffffff;
  line-height: 1;
  flex: 1;
}
.header-title span { color: #93c5fd; }

/* ── SEARCH ── */
.search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 280px;
}
.search-wrap input {
  width: 100%;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  color: #ffffff;
  padding: 8px 12px 8px 36px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.search-wrap input::placeholder { color: rgba(255,255,255,0.6); }
.search-wrap input:focus { border-color: #ffffff; background: rgba(255,255,255,0.25); }
.search-wrap .ico {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 0.9rem;
}

/* ── FILTERS ── */
.filters {
  max-width: 900px;
  margin: 0 auto;
  padding: 10px 20px 0;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  color: rgba(255,255,255,0.8);
  padding: 5px 14px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-btn:hover { background: rgba(255,255,255,0.25); color: #fff; }
.filter-btn.active { background: #ffffff; border-color: #ffffff; color: #1a56db; font-weight: 600; }

/* ── MAIN ── */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* ── STATS ── */
#stats-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  box-shadow: 0 1px 6px rgba(26,86,219,0.07);
}
.stat-item { text-align: center; }
.stat-value {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  color: var(--accent);
  line-height: 1;
}
.stat-label { font-size: 0.75rem; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: 1px; }

.progress-bar-wrap {
  grid-column: 1 / -1;
  background: var(--border);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22c55e);
  border-radius: 4px;
  transition: width 0.4s ease;
}

/* ── EXPORT BUTTONS ── */
.export-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 16px;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.green { border-color: var(--green); color: var(--green); }
.btn.green:hover { background: var(--green); color: #fff; }
.btn.red { border-color: var(--accent2); color: var(--accent2); }
.btn.red:hover { background: var(--accent2); color: #fff; }

/* ── SECTION ── */
.section-block { margin-bottom: 28px; }
.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  user-select: none;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(26,86,219,0.06);
  transition: border-color 0.15s;
}
.section-header:hover { border-color: var(--accent); }
.section-flag { font-size: 1.4rem; }
.section-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.15rem;
  letter-spacing: 1px;
  color: var(--text);
}
.section-id {
  font-size: 0.75rem;
  color: var(--accent);
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}
.section-progress {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}
.section-progress b { color: var(--green); }
.section-chevron { color: var(--muted); font-size: 0.8rem; transition: transform 0.2s; }
.section-block.collapsed .section-chevron { transform: rotate(-90deg); }
.section-block.collapsed .sticker-grid { display: none; }

/* ── STICKER GRID ── */
.sticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  padding: 4px 2px;
}

.sticker-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  transition: all 0.15s;
}
.sticker-card.have {
  border-color: var(--green);
  background: #f0fdf4;
}
.sticker-card.duplicate {
  border-color: #f59e0b;
  background: #fffbeb;
}

.sticker-label {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.5px;
}
.sticker-card.have .sticker-label { color: var(--green); }
.sticker-card.duplicate .sticker-label { color: #b45309; }

.sticker-qty {
  font-size: 0.7rem;
  color: var(--muted);
  margin: 2px 0 6px;
  min-height: 14px;
  font-weight: 600;
}
.sticker-card.have .sticker-qty { color: var(--green); }
.sticker-card.duplicate .sticker-qty { color: #b45309; }

.qty-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.qty-btn {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qty-btn:hover { border-color: var(--accent); color: var(--accent); background: #eff6ff; }
.qty-btn.minus:hover { border-color: var(--accent2); color: var(--accent2); background: #fff5f5; }

/* ── TOAST ── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 0.9rem;
  color: #fff;
  transition: transform 0.3s ease;
  z-index: 999;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
#toast.show { transform: translateX(-50%) translateY(0); }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty-state .big { font-size: 3rem; margin-bottom: 8px; }

/* ── RESPONSIVE ── */
@media (max-width: 520px) {
  .header-title { font-size: 1.4rem; }
  .sticker-grid { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 6px; }
  main { padding: 12px; }
}