/* ── Reset & Variables ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0a;
  --surface: #151515;
  --text: #f0f0f0;
  --text-muted: #888;
  --accent-pink: #fe2c55;
  --accent-cyan: #25f4ee;
  --radius: 12px;
  --gap: 10px;
  --header-h: 56px;

  --gradient-btn: linear-gradient(135deg, var(--accent-pink), #ff6b6b);
  --gradient-tiktok: linear-gradient(135deg, var(--accent-cyan), var(--accent-pink));
}

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100dvh;
  padding-top: var(--header-h);
}

/* ── Header ── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient-tiktok);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Grid ── */
.outfit-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
  padding: var(--gap);
  max-width: 1200px;
  margin: 0 auto;
}

/* ── Outfit Card ── */
.outfit-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.outfit-card:active {
  transform: scale(0.97);
}

.outfit-image-wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #1a1a1a;
}

.outfit-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
}

.outfit-image {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.outfit-image[src=""] {
  display: none;
}

.outfit-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px 12px 12px;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

.outfit-name {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ── Modal ── */
.modal[hidden] { display: none; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
}

.modal-scroll {
  width: 100%;
  max-width: 560px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: var(--bg);
}

/* Row 1: Image + close */
.modal-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #1a1a1a;
  flex-shrink: 0;
}

.modal-image-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
}

.modal-image {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-image[src=""] {
  display: none;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: background 0.2s;
  z-index: 1;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.8);
}

/* Row 2: Name + description */
.modal-info {
  padding: 20px 16px 16px;
}

.modal-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.modal-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-desc:empty {
  display: none;
}

/* Row 3: Product list */
.modal-products {
  padding: 0 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-product {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--surface);
  border-radius: 10px;
}

.modal-product-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(135deg, #2d1b4e, #1a1a2e);
  flex-shrink: 0;
}

.modal-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-product-thumb img[src=""] {
  display: none;
}

.modal-product-name {
  font-size: 0.85rem;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-checkout {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--gradient-tiktok);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.btn-checkout:hover {
  opacity: 0.85;
}

/* ── Loading State ── */
.outfit-grid.loading {
  display: flex;
  justify-content: center;
  padding: 80px 20px;
}

.outfit-grid.loading::after {
  content: "Loading...";
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Empty State ── */
.outfit-grid.empty::after {
  content: "No outfits yet";
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Responsive ── */
@media (min-width: 768px) {
  :root {
    --gap: 16px;
  }

  .outfit-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .outfit-name {
    font-size: 1rem;
  }

  .modal-product-thumb {
    width: 64px;
    height: 64px;
  }

  .modal-product {
    grid-template-columns: 64px 1fr auto;
    padding: 12px;
  }

  .modal-product-name {
    font-size: 0.9rem;
  }

  .btn-checkout {
    font-size: 0.75rem;
    padding: 9px 18px;
  }
}

@media (min-width: 1024px) {
  .outfit-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
