/* ── WORLDS PAGE STYLES ──
   Used by: worlds.html
   Requires: themes.css, base.css
── */

/* ── WORLDS BODY LAYOUT ── */
.worlds-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* Grid content area */
.worlds-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Top bar: results count + mobile filter btn */
.worlds-bar {
  padding: 11px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.results-count { font-size: 13px; color: var(--text3); flex: 1; }

/* Filter toggle button — visible only on mobile */
.filter-toggle-btn {
  display: none;
  align-items: center;
  gap: 5px;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 20px;
  padding: 5px 13px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.filter-toggle-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-toggle-btn.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

/* Scrollable grid wrapper */
.worlds-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}
.worlds-scroll::-webkit-scrollbar { width: 4px; }
.worlds-scroll::-webkit-scrollbar-track { background: transparent; }
.worlds-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── VERTICAL FILTER PANEL ── */
.filter-panel {
  width: 220px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Mobile-only panel header with close button */
.fp-mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  flex-shrink: 0;
}

.fp-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
}

.fp-close-btn {
  width: 28px; height: 28px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: var(--text3);
  transition: all var(--transition);
}
.fp-close-btn:hover { color: var(--text); background: var(--border2); }

/* Scrollable filter content */
.fp-scroll {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 16px;
}
.fp-scroll::-webkit-scrollbar { width: 3px; }
.fp-scroll::-webkit-scrollbar-track { background: transparent; }
.fp-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* Each filter section */
.fp-section {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.fp-section:last-child { border-bottom: none; }

.fp-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 9px;
}

/* Vertical chip stack */
.fp-chips {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Search in filter panel */
.fp-search-wrap { position: relative; }
.fp-search-icon {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--text3);
  pointer-events: none;
}

/* ── FILTER CHIP ── */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }

/* Inside the filter panel — chips fill full width */
.filter-panel .filter-chip { width: 100%; }

/* Search input (shared) */
.search-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 7px 12px 7px 30px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text);
  outline: none;
  transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text3); }

/* Mobile filter backdrop */
.filter-panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.48);
  z-index: 197;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.filter-panel-backdrop.open { display: block; }

/* ── WORLDS GRID ── */
.worlds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
}
@media (min-width: 1600px) {
  .worlds-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ── WORLD CARD ── */
.world-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}
.world-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}

.world-card-img {
  height: 150px;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.world-card-img-pattern {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 20px, rgba(255,255,255,0.04) 20px, rgba(255,255,255,0.04) 21px);
}
/* Dark overlay when card has a photo background */
.world-card-img[style*="background-image"] .world-card-img-pattern {
  background-image: none;
  background: rgba(0,0,0,0.25);
}

.world-emoji {
  font-size: 40px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.5));
}

.world-badges {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 10px;
  backdrop-filter: blur(4px);
  letter-spacing: 0.04em;
}
.badge-18  { background: rgba(200,50,50,0.75);   color: #fff; }
.badge-21  { background: rgba(120,30,180,0.8);   color: #fff; }
.badge-new { background: rgba(45,139,93,0.8);    color: #fff; }
.badge-hot { background: rgba(196,120,42,0.8);   color: #fff; }
.badge-free{ background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.85); }

.world-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  backdrop-filter: blur(3px);
}
.world-lock-overlay span:first-child { font-size: 24px; }
.world-lock-overlay span:last-child  { font-size: 10px; color: rgba(255,255,255,0.65); font-family: var(--font-ui); }

.world-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.world-genre-tags  { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.world-genre-tag {
  font-size: 10px;
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 2px 8px;
  border-radius: 8px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.world-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}

.world-desc {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text2);
  font-style: italic;
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.world-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.world-meta      { display: flex; align-items: center; gap: 10px; }
.world-meta-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text3); }

.world-play-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.world-play-btn:hover  { background: var(--accent2); }
.world-play-btn.locked { background: var(--bg3); color: var(--text3); cursor: default; }

/* ── WORLD DETAIL MODAL ── */
.modal { width: 100%; max-width: 560px; }

.modal-img {
  height: 200px;
  display: flex;
  align-items: flex-end;
  padding: 24px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.modal-img-pattern {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(45deg, transparent, transparent 20px, rgba(255,255,255,0.04) 20px, rgba(255,255,255,0.04) 21px);
}
.modal-img.has-photo .modal-img-pattern {
  background-image: linear-gradient(to top, rgba(0,0,0,0.55), rgba(0,0,0,0.15));
}
.modal-emoji {
  font-size: 56px;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.6));
}
.modal-img-badges { position: absolute; top: 16px; right: 16px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

/* Override base modal-close for dark-overlay position */
.modal-close {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 10;
  width: 32px;
  height: 32px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: rgba(255,255,255,0.8);
  transition: all var(--transition);
}
.modal-close:hover { background: rgba(0,0,0,0.6); color: #fff; }

.modal-body { padding: 24px 28px 28px; }

.modal-genres   { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }

.modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.modal-desc-full {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text2);
  font-style: italic;
  line-height: 1.7;
  margin-bottom: 20px;
}

.modal-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.modal-stat {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}
.modal-stat-val   { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.modal-stat-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; }

.modal-features { margin-bottom: 20px; }
.modal-features-title { font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text3); margin-bottom: 10px; }
.modal-features-list  { display: flex; flex-direction: column; gap: 7px; }
.modal-feature { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text2); }
.modal-feature::before { content: '✦'; color: var(--accent); font-size: 10px; flex-shrink: 0; }

.modal-actions { display: flex; gap: 10px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px 24px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-family: var(--font-ui);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn-locked {
  background: var(--bg3);
  color: var(--text3);
  border: none;
  border-radius: var(--radius);
  padding: 12px 24px;
  font-family: var(--font-ui);
  font-size: 14px;
  cursor: default;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* ── TABLET (769px – 1024px) ── */
@media (min-width: 769px) and (max-width: 1024px) {
  .filter-panel { width: 190px; }
  .worlds-scroll { padding: 16px 18px; }
  .worlds-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
}

/* ── MOBILE (≤ 768px) ── */
@media (max-width: 768px) {

  /* Show filter toggle button */
  .filter-toggle-btn { display: inline-flex; }

  /* Filter panel becomes a right-side drawer */
  .filter-panel {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 280px;
    max-width: 85vw;
    z-index: 198;
    transform: translateX(100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    box-shadow: -8px 0 32px rgba(0,0,0,0.2);
  }
  .filter-panel.open { transform: translateX(0); }

  /* Show the mobile header inside panel */
  .fp-mobile-header { display: flex; }

  /* Worlds bar */
  .worlds-bar { padding: 10px 14px; }

  /* Grid: 2 columns */
  .worlds-scroll { padding: 12px 14px; }
  .worlds-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }

  /* World card image smaller */
  .world-card-img { height: 110px; }
  .world-emoji { font-size: 32px; }

  /* World modal — full screen bottom sheet */
  .modal-overlay { align-items: flex-end; }
  .modal {
    max-width: 100%;
    width: 100%;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    max-height: 90dvh;
    overflow-y: auto;
  }
  .modal-stats { grid-template-columns: 1fr 1fr; }
  .modal-actions { flex-direction: column; }
  .modal-actions .btn-primary,
  .modal-actions .btn-ghost { flex: auto; width: 100%; }
}

@media (max-width: 480px) {
  .worlds-grid { grid-template-columns: 1fr; }
  .world-card-img { height: 130px; }
}
