*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

:root {
  --bg:         hsl(220, 20%, 97%);
  --card:       hsl(0, 0%, 100%);
  --foreground: hsl(224, 71%, 4%);
  --primary:    hsl(262, 83%, 58%);
  --primary-fg: hsl(0, 0%, 100%);
  --muted:      hsl(220, 14%, 96%);
  --muted-fg:   hsl(220, 9%, 46%);
  --border:     hsl(220, 13%, 91%);
  --shadow-sm:  0 1px 3px 0 hsl(0 0% 0% / 0.06), 0 1px 2px -1px hsl(0 0% 0% / 0.06);
  --radius:     0.75rem;
}

body {
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--foreground);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ── */
header {
  position: sticky; top: 0; z-index: 50;
  height: 64px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
}
.logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  text-decoration: none;
}
.logo-stable { color: var(--foreground); }
.logo-scout  { color: var(--primary); }
.header-sub {
  font-size: 0.78rem;
  color: var(--muted-fg);
  border-left: 1px solid var(--border);
  padding-left: 1rem;
  margin-left: 0.25rem;
}

/* ── MAIN ── */
main {
  flex: 1;
  padding: 2rem 1.5rem;
}
.container {
  max-width: 90%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ── CARD ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.card-header {
  padding: 1.25rem 1.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.card-body {
  padding: 1.25rem 1.5rem;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--foreground);
}
.card-desc {
  font-size: 0.82rem;
  color: var(--muted-fg);
  line-height: 1.5;
  padding-bottom: 0.1rem;
}
.card-desc strong { color: var(--foreground); font-weight: 600; }

.step-badge {
  width: 20px;
  height: 20px;
  background: var(--primary);
  color: var(--primary-fg);
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── DROPZONE ── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 2.25rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}
.dropzone:hover,
.dropzone.drag-over {
  border-color: var(--primary);
  background: hsl(262, 83%, 58%, 0.04);
}
.dropzone.has-file {
  border-color: hsl(160, 84%, 39%);
  background: hsl(160, 84%, 39%, 0.04);
}
.drop-icon {
  color: var(--muted-fg);
  margin-bottom: 0.25rem;
}
.dropzone.has-file .drop-icon { color: hsl(160, 84%, 28%); }

.drop-primary {
  font-size: 0.875rem;
  color: var(--foreground);
  font-weight: 500;
}
.browse-link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 0;
  font-family: inherit;
}
.browse-link:hover { opacity: 0.8; }
.drop-secondary {
  font-size: 0.75rem;
  color: var(--muted-fg);
}
.dropzone.has-file .drop-secondary {
  color: hsl(160, 84%, 28%);
  font-size: 0.85rem;
  font-weight: 600;
}

/* ── THEME PICKER ── */
.theme-body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.theme-option {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--card);
}
.theme-option:hover { background: var(--muted); }
.theme-option.selected {
  border-color: var(--primary);
  background: hsl(262, 83%, 58%, 0.04);
}

.theme-swatch {
  width: 64px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.sw-bg {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 4px 5px 5px;
  gap: 3px;
}
.sw-bursa-navy { background: #002378; }
.sw-prestige   { background: #FFFFFF; border: 1px solid #E0DAD0; }
.sw-gold       { background: #B8922A; }
.sw-stripe { height: 3px; border-radius: 2px; flex-shrink: 0; }
.sw-red    { background: #FF0000; }
.sw-bars {
  flex: 1;
  background: #E8EFFC;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  padding: 3px 4px;
  gap: 2px;
}
.sw-bars-white    { background: #E7E8EC; }
.sw-bars-prestige { background: #F5F0E8; }
.sw-bar { height: 5px; border-radius: 2px; }

.theme-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.theme-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--foreground);
}
.theme-desc {
  font-size: 0.75rem;
  color: var(--muted-fg);
}

.theme-check {
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: var(--muted);
  color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.theme-option.selected .theme-check {
  background: var(--primary);
  color: white;
}

/* ── ACTIONS ── */
.actions {
  display: flex;
  gap: 0.75rem;
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  background: var(--primary);
  color: var(--primary-fg);
  border: none;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-text { display: inline-flex; align-items: center; gap: 0.4rem; }
.btn-spinner { display: inline-flex; align-items: center; gap: 0.5rem; }

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid hsl(262, 83%, 80%);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── ERROR ── */
.error-box {
  margin-top: 0.9rem;
  padding: 0.65rem 0.9rem;
  background: hsl(0, 80%, 93%);
  border: 1px solid hsl(0, 72%, 80%);
  border-radius: calc(var(--radius) - 4px);
  color: hsl(0, 72%, 36%);
  font-size: 0.82rem;
  line-height: 1.5;
}

/* ── SLIDES INFO ── */
.slides-info {
  padding: 0 0.25rem;
}
.slides-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted-fg);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.65rem;
}
.slides-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.slide-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.8rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.8rem;
  color: var(--foreground);
  box-shadow: var(--shadow-sm);
}
.chip-num {
  width: 18px;
  height: 18px;
  background: var(--muted);
  color: var(--muted-fg);
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── SPONSOR BUTTON ── */
.sponsor-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  background: #ea4aaa;
  color: #fff;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.sponsor-btn:hover { background: #d63b97; }
.sponsor-btn svg { flex-shrink: 0; }

/* ── BASELINE SECTION ── */
.baseline-section {
  margin-top: 0.85rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}
.baseline-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted-fg);
  margin-bottom: 0.55rem;
}
.baseline-picker {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.baseline-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--muted);
  color: var(--muted-fg);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.baseline-btn:hover { border-color: var(--primary); color: var(--primary); }
.optional-tag {
  font-size: 0.68rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: var(--border);
  color: var(--muted-fg);
}
.baseline-name {
  font-size: 0.78rem;
  color: var(--foreground);
  font-weight: 500;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.baseline-clear {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted-fg);
  font-size: 1rem;
  line-height: 1;
  padding: 0 0.2rem;
  transition: color 0.15s;
}
.baseline-clear:hover { color: var(--foreground); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  main { padding: 1.5rem 1rem; }
  header { padding: 0 1rem; }
  .header-sub { display: none; }
  .sponsor-btn { display: none; }
  .slides-grid { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .btn-primary { width: 100%; justify-content: center; }
}
@media (max-width: 480px) {
  .card-header, .card-body { padding-left: 1.1rem; padding-right: 1.1rem; }
}
