/* ===========================================
   PANINI WORLD CUP — Modern Sticker Trading
   =========================================== */

:root {
  --bg-deep: #0e0f12;
  --bg: #16181d;
  --bg-soft: #1d2026;
  --bg-card: #232830;
  --silver-100: #f3f5f8;
  --silver-200: #d9dde3;
  --silver-300: #b3bac4;
  --silver-400: #8a91a0;
  --silver-500: #5b6270;
  --silver-600: #3a3f49;
  --gold: #f5c542;
  --gold-deep: #c9a02b;
  --accent-red: #e63946;
  --accent-blue: #1e88ff;
  --accent-green: #22c55e;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --grad-rainbow: linear-gradient(135deg, #c9a02b 0%, #f5c542 100%);
  --grad-silver: linear-gradient(135deg, #d9dde3 0%, #8a91a0 50%, #f3f5f8 100%);
  --grad-silver-soft: linear-gradient(135deg, #2a2f38 0%, #1d2026 100%);
  --grad-card: linear-gradient(160deg, #2a2f38, #181b21);
  --shadow-md: 0 8px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 18px 48px rgba(0,0,0,.45);
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --font-display: 'Bebas Neue', 'Oswald', 'Inter', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg-deep);
  color: var(--silver-100);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.55;
}

body {
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(245,197,66,.08), transparent 60%),
    radial-gradient(900px 600px at -10% 30%, rgba(201,160,43,.07), transparent 60%),
    radial-gradient(900px 700px at 50% 110%, rgba(245,197,66,.05), transparent 60%),
    linear-gradient(180deg, #0e0f12 0%, #16181d 100%);
  background-attachment: fixed;
}

a { color: var(--silver-100); text-decoration: none; }
a:hover { color: var(--gold); }

h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: .5px; font-weight: 700; }
h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); }
h3 { font-size: 1.3rem; }

img { max-width: 100%; display: block; }

/* ================= NAV ================= */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1.5rem;
  padding: .9rem 2rem;
  background: rgba(14,15,18,.78);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.nav .brand {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: 1.5px;
  color: var(--gold);
  display: flex; align-items: center; gap: .55rem;
  text-shadow: 0 0 18px rgba(245,197,66,.25);
}
.nav .brand::before,
.nav .brand::after {
  content: none !important;
  display: none !important;
}
.brand-logo {
  width: 20px !important;
  height: 20px !important;
  display: inline-block !important;
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(245,197,66,.4));
  flex-shrink: 0;
  vertical-align: middle;
}
.nav .nav-links {
  display: flex; align-items: center; gap: 1.2rem;
  list-style: none;
  margin-left: 1rem;
}
.nav .nav-links a {
  color: var(--silver-300);
  font-weight: 500;
  font-size: .95rem;
  padding: .4rem 0;
  position: relative;
  transition: color .2s;
}
.nav .nav-links a:hover, .nav .nav-links a.active {
  color: var(--silver-100);
}
.nav .nav-links a.active::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: var(--grad-rainbow);
  border-radius: 2px;
}

.nav .spacer { flex: 1; }

.nav .actions { display: flex; align-items: center; gap: .7rem; }

/* Language dropdown */
.lang-dropdown { position: relative; }
.lang-btn {
  display: flex; align-items: center; gap: .45rem;
  background: var(--bg-soft);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: .32rem .8rem .32rem .55rem;
  color: var(--silver-300);
  cursor: pointer;
  font-size: .8rem; font-weight: 700;
  transition: border-color .2s, color .2s;
  white-space: nowrap;
}
.lang-btn:hover { border-color: rgba(255,255,255,.22); color: var(--silver-100); }
.lang-btn .lang-flag { height: 14px; border-radius: 2px; flex-shrink: 0; }
.lang-btn .lang-arrow {
  font-size: .6rem; opacity: .65;
  transition: transform .2s; margin-left: 1px;
}
.lang-dropdown.open .lang-arrow { transform: rotate(180deg); }

.lang-options {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding: 4px;
  min-width: 170px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 300;
  box-shadow: var(--shadow-lg);
}
.lang-dropdown.open .lang-options { display: block; }

.lang-option {
  display: flex; align-items: center; gap: .55rem;
  width: 100%;
  background: none; border: none;
  padding: .48rem .75rem;
  color: var(--silver-300);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: .85rem; font-weight: 500;
  text-align: left;
  transition: background .15s, color .15s;
}
.lang-option:hover:not(.active) { background: rgba(255,255,255,.06); color: var(--silver-100); }
.lang-option.active { font-weight: 700; }
.lang-option .lang-flag { height: 13px; border-radius: 2px; flex-shrink: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .65rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.08);
  background: var(--bg-soft);
  color: var(--silver-100);
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  transition: all .2s;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.18); }
.btn-primary {
  background: var(--grad-rainbow);
  border: none;
  color: #16181d;
  font-weight: 700;
}
.btn-primary:hover { box-shadow: 0 8px 22px rgba(245,197,66,.45); }
.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-deep) 100%);
  color: #16181d;
  border: none;
  font-weight: 700;
}
.btn-ghost {
  background: transparent;
}
.btn-danger { background: var(--accent-red); border: none; color: white; }
.btn-sm { padding: .4rem .8rem; font-size: .8rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============= LAYOUT ============= */
.container { max-width: 1280px; margin: 0 auto; padding: 2rem; }
.container-sm { max-width: 760px; margin: 0 auto; padding: 2rem; }

/* ============= HERO ============= */
.hero {
  position: relative;
  padding: 5rem 2rem 4rem;
  overflow: hidden;
  text-align: center;
}
.hero::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(600px 400px at 20% 30%, rgba(201,160,43,.14), transparent 60%),
    radial-gradient(600px 400px at 80% 70%, rgba(245,197,66,.10), transparent 60%);
  pointer-events: none;
}
.hero h1 {
  background: linear-gradient(180deg, #fff 0%, #b3bac4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative; z-index: 2;
  margin-bottom: 1rem;
}
.hero .tag {
  display: inline-block;
  padding: .3rem .8rem;
  border-radius: 999px;
  background: rgba(245,197,66,.12);
  border: 1px solid rgba(245,197,66,.3);
  color: var(--gold);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
  position: relative; z-index: 2;
}
.hero p.lead {
  font-size: 1.15rem;
  color: var(--silver-300);
  max-width: 680px;
  margin: 0 auto 2rem;
  position: relative; z-index: 2;
}
.hero .hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; position: relative; z-index: 2; }

/* Floating cards on hero */
.floating-cards {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.float-card {
  position: absolute;
  width: 120px; height: 170px;
  background: var(--grad-card);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: var(--shadow-md);
  display: flex; flex-direction: column;
  padding: .6rem;
  opacity: .55;
  animation: floaty 9s ease-in-out infinite;
}
.float-card .fc-head {
  height: 22px; border-radius: 6px;
  background: var(--grad-silver);
  margin-bottom: .5rem;
  opacity: .65;
}
.float-card .fc-body {
  flex: 1; border-radius: 6px;
  background: linear-gradient(135deg, #3a3f49, #1d2026);
}
.float-card.fc1 { left: 4%; top: 20%; transform: rotate(-12deg); animation-delay: 0s; }
.float-card.fc2 { right: 6%; top: 18%; transform: rotate(11deg); animation-delay: 1.5s; }
.float-card.fc3 { left: 14%; bottom: 8%; transform: rotate(-7deg); animation-delay: 3s; }
.float-card.fc4 { right: 16%; bottom: 12%; transform: rotate(8deg); animation-delay: 4.5s; }
@keyframes floaty {
  0%,100% { transform: translateY(0) rotate(var(--r, 0deg)); }
  50% { transform: translateY(-22px) rotate(var(--r, 0deg)); }
}

/* ============= FEATURES ============= */
.section {
  padding: 3rem 2rem;
  max-width: 1280px;
  margin: 0 auto;
}
.section .section-title {
  text-align: center;
  margin-bottom: 2.5rem;
}
.section .section-title .label {
  color: var(--gold);
  font-size: .85rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 700;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.4rem;
}
.feature {
  background: var(--grad-card);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  padding: 1.6rem 1.4rem;
  transition: all .25s;
  position: relative;
  overflow: hidden;
}
.feature::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--grad-rainbow);
  opacity: .6;
}
.feature:hover { transform: translateY(-4px); border-color: rgba(255,255,255,.18); }
.feature .icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--grad-silver);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 1rem;
  color: #16181d;
}
.feature h3 { margin-bottom: .5rem; color: var(--silver-100); }
.feature p { color: var(--silver-300); font-size: .95rem; }

/* ============= AUTH ============= */
.auth-wrap {
  min-height: calc(100vh - 76px);
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
}
.auth-card {
  width: 100%; max-width: 460px;
  background: var(--grad-card);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-lg);
  padding: 2.4rem;
  box-shadow: var(--shadow-lg);
}
.auth-tabs {
  display: flex; gap: .5rem; margin-bottom: 1.6rem;
  background: var(--bg-soft);
  padding: 4px;
  border-radius: 999px;
}
.auth-tabs button {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--silver-400);
  padding: .65rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: all .2s;
}
.auth-tabs button.active {
  background: var(--grad-rainbow);
  color: #16181d;
}
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .82rem;
  color: var(--silver-300);
  margin-bottom: .35rem;
  font-weight: 600;
  letter-spacing: .3px;
}
.input, .select, textarea {
  width: 100%;
  padding: .7rem .9rem;
  background: var(--bg);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-sm);
  color: var(--silver-100);
  font-family: inherit;
  font-size: .95rem;
  transition: all .2s;
}
.input:focus, .select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(245,197,66,.15);
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }

.alert {
  padding: .7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 1rem;
}
.alert.error { background: rgba(230,57,70,.13); border: 1px solid rgba(230,57,70,.35); color: #ffb3b9; }
.alert.success { background: rgba(34,197,94,.13); border: 1px solid rgba(34,197,94,.35); color: #b3ffce; }
.alert.info { background: rgba(30,136,255,.12); border: 1px solid rgba(30,136,255,.3); color: #b8d8ff; }

/* ============= PROFILE ============= */
.profile-header {
  display: flex; align-items: center; gap: 1.6rem;
  background: var(--grad-card);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius-lg);
  padding: 1.8rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}
.profile-header::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 4px;
  background: var(--grad-rainbow);
}
.avatar {
  width: 90px; height: 90px;
  border-radius: 50%;
  background: var(--grad-silver);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem;
  font-weight: 800;
  color: #16181d;
  border: 3px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.profile-meta h2 { margin-bottom: .25rem; }
.profile-meta .loc {
  color: var(--silver-300);
  font-size: .95rem;
  display: flex; align-items: center; gap: .4rem;
  margin-bottom: .4rem;
}
.profile-meta .bio { color: var(--silver-400); font-size: .9rem; max-width: 500px; }

.tabs {
  display: flex; gap: .5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.tabs button {
  background: none;
  border: none;
  padding: .8rem 1.2rem;
  color: var(--silver-400);
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: .95rem;
  transition: all .2s;
}
.tabs button.active {
  color: var(--silver-100);
  border-bottom-color: var(--gold);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============= ALBUM ============= */
.album-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.6rem;
}
.stat {
  background: var(--grad-card);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
}
.stat .v {
  font-family: var(--font-display);
  font-size: 2rem;
  background: var(--grad-silver);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat .l { color: var(--silver-400); font-size: .8rem; text-transform: uppercase; letter-spacing: 1px; }

.team-section {
  margin-bottom: 2rem;
  background: var(--grad-card);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem 1.4rem;
}
.team-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: .8rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.team-head h3 {
  display: flex; align-items: center; gap: .65rem;
}
.team-head .flag {
  font-size: 1.55rem;
}
.team-head .progress {
  font-size: .8rem;
  color: var(--silver-300);
}
.progress-bar {
  width: 130px; height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
  margin-left: .5rem;
  vertical-align: middle;
}
.progress-bar .fill { height: 100%; background: var(--grad-rainbow); transition: width .3s; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .7rem;
}
.sticker {
  aspect-ratio: 3/4;
  background: var(--bg-soft);
  border: 2px dashed rgba(255,255,255,.08);
  border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding: .5rem;
  cursor: pointer;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.sticker:hover { border-color: var(--gold); transform: translateY(-2px); }
.sticker.owned {
  background: var(--grad-card);
  border: 2px solid rgba(245,197,66,.35);
  background-image: linear-gradient(160deg, #2a2f38, #181b21);
}
.sticker.owned::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 40%, rgba(255,255,255,.08) 50%, transparent 60%);
  background-size: 200% 100%;
  animation: shine 3.6s infinite;
}
@keyframes shine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.sticker.special.owned { border-color: var(--gold); box-shadow: 0 0 12px rgba(245,197,66,.35); }
.sticker .num {
  font-family: var(--font-display);
  font-size: .85rem;
  color: var(--silver-400);
  margin-bottom: .15rem;
}
.sticker.owned .num { color: var(--gold); }
.sticker .name {
  font-size: .7rem;
  text-align: center;
  color: var(--silver-300);
  line-height: 1.2;
  font-weight: 600;
}
.sticker.owned .name { color: var(--silver-100); }
.sticker .pos {
  font-size: .58rem;
  color: var(--silver-500);
  margin-top: .2rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.sticker .star {
  position: absolute; top: 4px; right: 6px;
  font-size: .75rem;
  color: var(--gold);
}
.sticker-img {
  width: 100%;
  flex: 1;
  min-height: 0;
  border-radius: 6px;
  object-fit: cover;
  filter: grayscale(1) brightness(.35);
  transition: filter .35s ease;
  margin-bottom: .15rem;
  display: block;
  cursor: zoom-in;
}
.sticker.owned .sticker-img {
  filter: none;
}
.sticker-no-img {
  width: 100%;
  flex: 1;
  min-height: 0;
  background: var(--bg-deep);
  border-radius: 6px;
  margin-bottom: .15rem;
}
@keyframes pop-in {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  70% { transform: scale(.96); }
  100% { transform: scale(1); }
}
.sticker.pop-in { animation: pop-in .45s cubic-bezier(.36,.07,.19,.97); }

/* ============= LISTINGS ============= */
.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.listing-card {
  background: var(--grad-card);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  padding: 1rem;
  position: relative;
  transition: all .2s;
}
.listing-card:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.18); }
.listing-card .ltype {
  position: absolute; top: 10px; right: 10px;
  font-size: .65rem;
  text-transform: uppercase;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: .8px;
}
.ltype.trade { background: rgba(30,136,255,.18); color: #b8d8ff; }
.ltype.sale { background: rgba(34,197,94,.18); color: #b3ffce; }
.ltype.both { background: rgba(245,197,66,.18); color: var(--gold); }
.listing-card .lp {
  font-family: var(--font-display);
  font-size: 1.2rem;
  margin: .5rem 0 .25rem;
}
.listing-card .lt { color: var(--silver-400); font-size: .82rem; }
.listing-card .lnum {
  display: inline-block;
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: .75rem;
  color: var(--silver-300);
  margin-top: .35rem;
}
.listing-card .lprice {
  margin-top: .6rem;
  color: var(--gold);
  font-weight: 700;
  font-size: 1rem;
}
.listing-card .lnotes { color: var(--silver-400); font-size: .82rem; margin-top: .4rem; }
.listing-card .lactions {
  display: flex; gap: .4rem; margin-top: .8rem;
}

/* ============= SEARCH ============= */
.search-bar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: .7rem;
  background: var(--grad-card);
  border: 1px solid rgba(255,255,255,.08);
  padding: 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}
@media (max-width: 720px) {
  .search-bar { grid-template-columns: 1fr; }
}

.result-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  background: var(--grad-card);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  margin-bottom: .7rem;
  transition: all .2s;
}
.result-row:hover { border-color: rgba(255,255,255,.18); transform: translateX(3px); }
.result-row .mini-card {
  width: 70px; aspect-ratio: 3/4;
  background: var(--grad-card);
  border: 2px solid rgba(245,197,66,.4);
  border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: .3rem;
  font-size: .65rem;
  text-align: center;
}
.result-row .mini-card .n { color: var(--gold); font-family: var(--font-display); font-size: .9rem; }
.result-row .meta h4 { font-family: var(--font-body); font-size: 1rem; margin-bottom: .2rem; }
.result-row .meta .sub { color: var(--silver-400); font-size: .85rem; }
.result-row .meta .by { color: var(--silver-300); font-size: .82rem; margin-top: .3rem; }
.result-row .meta .by a { color: var(--gold); font-weight: 600; }

/* ============= USERS LIST ============= */
.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.user-tile {
  background: var(--grad-card);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-align: center;
  transition: all .2s;
}
.user-tile:hover { transform: translateY(-3px); border-color: rgba(255,255,255,.18); }
.user-tile .avatar { width: 64px; height: 64px; font-size: 1.6rem; margin: 0 auto .7rem; }
.user-tile .uname { font-weight: 700; font-size: 1rem; }
.user-tile .uloc { color: var(--silver-400); font-size: .82rem; margin: .25rem 0 .6rem; }

/* ============= MESSAGES ============= */
.chat-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 120px);
  background: var(--grad-card);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
@media (max-width: 720px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-layout .threads { display: none; }
  .chat-layout.show-threads .threads { display: block; }
  .chat-layout.show-threads .chat-main { display: none; }
}
.threads {
  border-right: 1px solid rgba(255,255,255,.06);
  overflow-y: auto;
}
.thread-item {
  padding: 1rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,.04);
  transition: background .2s;
}
.thread-item:hover { background: rgba(255,255,255,.03); }
.thread-item.active { background: rgba(245,197,66,.07); border-left: 3px solid var(--gold); }
.thread-item .tname { font-weight: 700; }
.thread-item .tlast { color: var(--silver-400); font-size: .8rem; margin-top: .25rem; }
.thread-item .unread-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold);
  display: inline-block;
  margin-left: .4rem;
}

.chat-main {
  display: flex; flex-direction: column;
  height: 100%;
}
.chat-head {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: .8rem;
}
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.4rem;
  display: flex; flex-direction: column; gap: .6rem;
}
.bubble {
  max-width: 70%;
  padding: .65rem .95rem;
  border-radius: 16px;
  font-size: .92rem;
  word-wrap: break-word;
}
.bubble.mine {
  align-self: flex-end;
  background: var(--grad-rainbow);
  color: #16181d;
  border-bottom-right-radius: 4px;
}
.bubble.theirs {
  align-self: flex-start;
  background: var(--bg-soft);
  border: 1px solid rgba(255,255,255,.06);
  border-bottom-left-radius: 4px;
}
.bubble .ts { display: block; font-size: .65rem; opacity: .65; margin-top: .25rem; }
.chat-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.06);
  display: flex; gap: .6rem;
}
.chat-footer input { flex: 1; }

/* ============= MODAL ============= */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
  padding: 1rem;
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--grad-card);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-lg);
  padding: 2rem;
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg);
}
.modal h3 { margin-bottom: 1.2rem; }
.modal .modal-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1rem; }

/* ============= FOOTER ============= */
.footer {
  text-align: center;
  padding: 2rem;
  color: var(--silver-500);
  font-size: .85rem;
  border-top: 1px solid rgba(255,255,255,.04);
  margin-top: 4rem;
}

/* ============= UTIL ============= */
.text-muted { color: var(--silver-400); }
.text-gold { color: var(--gold); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--silver-400);
}
.empty .icon-big {
  font-size: 3rem;
  display: block;
  margin-bottom: .5rem;
  opacity: .55;
}

/* ===================== NAV MOBILE ===================== */
.nav-toggle { display: none; background: none; border: none; color: var(--silver-100); font-size: 1.4rem; cursor: pointer; }
@media (max-width: 880px) {
  .nav { padding: .8rem 1rem; }
  .nav-toggle { display: block; }
  .nav .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column;
    background: var(--bg);
    padding: 1rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
    display: none;
    z-index: 99;
  }
  .nav .nav-links.open { display: flex; }
  .nav .actions { gap: .4rem; }
  .nav .actions .btn:not(.btn-primary):not(.btn-icon) { display: none; }
}
@media (max-width: 420px) {
  .nav { padding: .65rem .85rem; gap: .5rem; }
  .nav .brand > span:last-child { display: none; }
  .lang-options { left: 0; right: auto; }
  .nav .actions .btn-primary { padding: .35rem .65rem; font-size: .78rem; }
}

/* ===================== CONTAINER ===================== */
@media (max-width: 640px) {
  .container, .container-sm { padding: 1.2rem 1rem; }
  .section { padding: 2rem 1rem; }
}

/* ===================== HERO (index) ===================== */
@media (max-width: 768px) {
  .hero { padding: 5rem 1.5rem 3.5rem; min-height: unset; }
  .float-card { opacity: .18; }
  .float-card.fc3, .float-card.fc4 { display: none; }
}
@media (max-width: 480px) {
  .hero { padding: 4rem 1rem 2.5rem; }
  .floating-cards { display: none; }
  .hero-stats { gap: .65rem; margin: 1.5rem 0 1.2rem; }
  .hero-stat .n { font-size: 1.7rem; }
  .hero-stat .l { font-size: .6rem; letter-spacing: 1px; }
  .hero-stat-divider { display: none; }
  .hero .hero-actions { flex-direction: column; gap: .6rem; align-items: stretch; }
  .hero .hero-actions .btn { justify-content: center; }
}

/* ===================== AUTH ===================== */
@media (max-width: 560px) {
  .auth-wrap { padding: 1.2rem; align-items: flex-start; padding-top: 1.5rem; }
  .auth-card { padding: 1.5rem 1.2rem; border-radius: var(--radius); }
}
@media (max-width: 420px) {
  .row { grid-template-columns: 1fr; }
}

/* ===================== PROFILE ===================== */
@media (max-width: 640px) {
  .profile-header { flex-wrap: wrap; padding: 1.2rem; gap: .8rem; }
  .profile-header-action { margin-left: 0 !important; width: 100%; }
}
@media (max-width: 480px) {
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 0; }
  .tabs button { white-space: nowrap; flex-shrink: 0; font-size: .82rem; padding: .65rem .85rem; }
  .listings-grid { grid-template-columns: repeat(2, 1fr); gap: .65rem; }
}

/* ===================== ALBUM ===================== */
@media (max-width: 480px) {
  .album-stats { grid-template-columns: repeat(2, 1fr); }
  .stat .v { font-size: 1.6rem; }
}

/* ===================== MESSAGES / CHAT ===================== */
.back-to-threads { display: none; }
@media (max-width: 720px) {
  .chat-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 155px);
    border-radius: var(--radius);
  }
  .chat-layout .threads {
    display: none;
    height: 100%;
    overflow-y: auto;
    border-right: none;
  }
  .chat-layout.show-threads .threads { display: flex; flex-direction: column; }
  .chat-layout.show-threads .chat-main { display: none; }
  .back-to-threads {
    display: inline-flex !important;
    align-items: center; gap: .3rem;
    font-size: .82rem; margin-right: .4rem;
    flex-shrink: 0;
  }
}
@media (max-width: 480px) {
  .chat-layout { height: calc(100vh - 148px); }
  .bubble { max-width: 88%; font-size: .88rem; }
  .chat-footer { padding: .6rem .75rem; gap: .3rem; }
  .chat-head { padding: .75rem 1rem; gap: .5rem; }
  .chat-body { padding: 1rem; gap: .5rem; }
}

/* ===================== SEARCH RESULTS ===================== */
@media (max-width: 560px) {
  .result-row { grid-template-columns: 58px 1fr; gap: .6rem; }
  .result-row > div:nth-child(3) { grid-column: 1 / -1; }
  .result-row .mini-card { width: 54px; }
  .result-row { padding: .8rem; }
}

/* ===================== SEARCH / USERS FORM ===================== */
@media (max-width: 720px) {
  .search-bar { grid-template-columns: 1fr !important; }
}

/* ===================== MODAL ===================== */
@media (max-width: 560px) {
  .modal-bg { padding: .5rem; align-items: flex-end; }
  .modal {
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 92vh; overflow-y: auto;
    padding: 1.4rem 1.2rem;
    width: 100%; max-width: 100%;
  }
  .modal .row { grid-template-columns: 1fr; }
  .modal .modal-actions { flex-wrap: wrap; }
}

/* ===================== USER GRID ===================== */
@media (max-width: 480px) {
  .user-grid { grid-template-columns: repeat(2, 1fr); }
  .user-tile .avatar { width: 52px; height: 52px; font-size: 1.2rem; }
  .user-tile { padding: .9rem; }
}

/* ===================== FEATURES ===================== */
@media (max-width: 480px) {
  .features-grid { grid-template-columns: 1fr; }
}

/* ===================== FOOTER ===================== */
@media (max-width: 480px) {
  .footer { padding: 1.5rem 1rem; font-size: .78rem; margin-top: 2rem; }
}
