/* =========================================================
   ClicksCollab – Creators (Production CSS)
   ========================================================= */

/* -------------------------
   Design tokens
------------------------- */
:root{
  --teal:#2cc5cf;
  --bg:#f4f7fb;
  --card:#ffffff;
  --text:#1f2937;
  --muted:#6b7280;
  --line:#e5e7eb;
  --yellow:#f1c40f;

  --radius:16px;
  --container:1200px;      /* base (≤1366) */
  --gap:18px;

  --topbar-h:64px;
  --search-h:56px;
  --card-media-h:220px;

  /* stacking */
  --z-topbar: 300;
  --z-search: 200;
  --z-resultsbar: 40;
  --z-dropdown: 1000;
}

/* -------------------------
   Base / Reset
------------------------- */
*{ box-sizing:border-box; }
html,body{
  height:auto;
  min-height:100%;
}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font:14.5px/1.45 "Inter",system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}
img{ max-width:100%; display:block; }
a{ color:inherit; }

/* Screen-reader only */
.sr-only{
  position:absolute !important;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);
  border:0;
}

/* =========================================================
   Topbar
   ========================================================= */
.topbar{
  background:var(--teal);
  position:sticky;
  top:0;
  z-index:var(--z-topbar);
  box-shadow:0 2px 0 rgba(0,0,0,.03);

  /* critical: allow dropdown to render outside header */
  overflow:visible;
}

.topbar__wrap{
  max-width:var(--container);
  margin:0 auto;
  display:flex;
  align-items:center;
  gap:24px;
  padding:12px 16px;
  min-height:var(--topbar-h);

  /* ensures dropdown always above search (same header) */
  position:relative;
  z-index: calc(var(--z-search) + 1);
  overflow:visible;
}

/* Brand / nav */
.brand{ display:flex; align-items:baseline; gap:10px; }
.brand__logo{ font-weight:800; font-size:28px; color:#fff; letter-spacing:.3px; }
.brand__by{ font-size:11px; color:#eafafa; opacity:.9; }

.nav{ margin-left:auto; display:flex; gap:16px; }
.nav__link{
  color:#e8fdff;
  text-decoration:none;
  font-weight:600;
  padding:6px 8px;
  border-radius:8px;
}
.nav__link--active,
.nav__link:hover{
  background:rgba(255,255,255,.14);
}

/* =========================================================
   Profile dropdown (NEW – single source of truth)
   Uses: #profileBtn + #profileMenu from your HTML
   ========================================================= */
.profile{
  position:relative;
  margin-left:12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;

  z-index: var(--z-dropdown);
}

/* Trigger button */
#profileBtn{
  display:inline-flex;
  align-items:center;
  gap:10px;
  border:0;
  cursor:pointer;
  background:transparent;
  padding:6px 8px;
  border-radius:999px;

  position:relative;
  z-index: var(--z-dropdown);
}

#profileBtn:focus{
  outline:2px solid rgba(255,255,255,.55);
  outline-offset:2px;
}

/* Avatar bubble */
.profile__avatar{
  width:42px;
  height:42px;
  border-radius:999px;
  background:rgba(255,255,255,.95);
  display:grid;
  place-items:center;
  box-shadow:0 10px 22px rgba(0,0,0,.12);
}

.profile__avatar svg{
  width:22px;
  height:22px;
  color:#0ea5b7;
}

/* Chevron bubble */
.profile__chev{
  width:32px;
  height:32px;
  border-radius:999px;
  background:rgba(255,255,255,.25);
  display:grid;
  place-items:center;
  color:#fff;
}
.profile__chev svg{ width:18px; height:18px; }

/* Dropdown panel */
#profileMenu{
  position:absolute;
  top:calc(100% + 12px);
  right:0;
  width:320px;
  border-radius:18px;
  background:#fff;
  border:1px solid rgba(15,23,42,.08);
  box-shadow:0 18px 55px rgba(0,0,0,.18);
  overflow:hidden;

  /* open/close animation (robust) */
  opacity:0;
  pointer-events:none;
  transform:translateY(-6px);
  transition:opacity .16s ease, transform .16s ease;

  z-index: var(--z-dropdown);
}

#profileMenu.is-open{
  opacity:1;
  pointer-events:auto;
  transform:translateY(0);
}

/* Dropdown content styling (pm__*) */
.pm__head{
  padding:16px 16px 10px 16px;
  background:rgba(14,165,183,.08);
  border-bottom:1px solid rgba(15,23,42,.06);
}
.pm__head-title{
  font-weight:900;
  font-size:18px;
  color:#0f172a;
  line-height:1.15;
  margin-bottom:6px;
}
.pm__head-sub{
  font-size:13px;
  color:rgba(15,23,42,.75);
  font-weight:700;
}

.pm__item{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  text-decoration:none;
  color:#0f172a;
  background:#fff;
  font-weight:900;
  transition:background .15s ease;
}
.pm__item:hover{ background:rgba(2,132,199,.06); }

.pm__right{
  font-weight:800;
  color:rgba(15,23,42,.55);
  white-space:nowrap;
}

.pm__divider{
  height:1px;
  background:rgba(15,23,42,.08);
  margin:6px 0;
}

.pm__danger{
  color:#b91c1c;
}
.pm__danger:hover{
  background:rgba(185,28,28,.06);
}
.pm__danger .pm__right{
  color:rgba(185,28,28,.65);
}

/* =========================================================
   Search
   ========================================================= */
.search{
  background:var(--teal);
  padding:0 16px 18px;

  /* keep search under dropdown */
  position:relative;
  z-index: var(--z-search);
}
.search__wrap{
  max-width:900px;
  margin:0 auto;
  position:relative;
  display:flex;
  align-items:center;
  gap:10px;
  background:#fff;
  border-radius:28px;
  height:var(--search-h);
  padding:0 16px;
  box-shadow:0 8px 20px rgba(0,0,0,.08);
}
.search__icon{ width:20px; height:20px; color:#8b97a3; }
.search__input{ border:0; outline:0; width:100%; font:500 14px/1 "Inter",sans-serif; }

/* =========================================================
   Page layout
   ========================================================= */
.page__inner{
  max-width:var(--container);
  margin:18px auto 48px;
  padding:0 16px;
  display:grid;
  grid-template-columns:280px 1fr;
  gap:var(--gap);
}

/* =========================================================
   Filters
   ========================================================= */
.filters{
  position:sticky;
  top:calc(var(--topbar-h) + var(--search-h) + 18px);
  align-self:start;
}
.filters__section{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:16px;
  padding:16px;
  margin-bottom:12px;
}
.filters__title{ font-weight:800; margin-bottom:8px; }
.filters__subtitle{ color:var(--muted); font-weight:700; margin:10px 0 6px; }
.mt-12{ margin-top:12px; }

.select{ position:relative; }
.select select{
  width:100%;
  height:40px;
  border-radius:10px;
  border:1px solid var(--line);
  padding:0 36px 0 12px;
  appearance:none;
  background:#fff;
  color:var(--text);
}
.select--sm select{ height:34px; border-radius:8px; }
.select__chev{
  position:absolute;
  right:10px;
  top:50%;
  width:18px;
  height:18px;
  transform:translateY(-50%);
  color:#7a8591;
}

.check{
  display:block;
  user-select:none;
  margin:6px 0;
  color:#1f2937;
  position:relative;
}
.check input{ position:absolute; opacity:0; }
.check span{
  display:inline-block;
  width:16px;height:16px;
  border:1.6px solid #c8d0d8;
  border-radius:4px;
  margin-right:8px;
  transform:translateY(3px);
}
.check input:checked + span{
  background:var(--teal);
  border-color:var(--teal);
  box-shadow:inset 0 0 0 2px #fff;
}

.filters__reset{
  appearance:none;
  background:none;
  border:0;
  padding:0;
  margin-top:8px;
  color:var(--teal);
  font-weight:800;
  cursor:pointer;
}

/* =========================================================
   Results header bar
   ========================================================= */
.results__bar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:10px;
  padding:2px 2px 2px 0;

  position:sticky;
  top:0;
  z-index:var(--z-resultsbar);
  background:var(--bg);
}
.sort{
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--muted);
  font-weight:700;
}

/* =========================================================
   Cards grid
   ========================================================= */
.grid{
  display:grid;
  gap:16px;
  grid-template-columns:repeat(2,minmax(0,1fr));
}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:16px;
  overflow:hidden;
  display:grid;
  grid-template-rows:var(--card-media-h) auto;
  transition:transform .18s ease, box-shadow .18s ease, outline-color .18s ease;
}
.card__media img{ width:100%; height:100%; object-fit:cover; }
.card__body{ padding:14px 16px 16px; }
.card__title{ margin:2px 0 6px; font-size:18px; }
.card__meta{
  display:flex;
  align-items:center;
  gap:6px;
  color:var(--muted);
  font-weight:700;
  margin-bottom:10px;
}
.i{ width:18px;height:18px; }
.i--pin{ color:#ef476f; }
.card__stats{ display:flex; gap:10px; margin-bottom:10px; }
.pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
  font-weight:800;
}
.i--ig{ color:#c13584; }
.i--web{ color:#1992d4; }
.i--tt{ color:#000; }

/* Highlight from map -> card */
.card.is-highlight{
  outline:2px solid rgba(241,196,15,.55);
  box-shadow:0 18px 55px rgba(0,0,0,.14), 0 0 0 10px rgba(241,196,15,.12);
  transform:translateY(-2px);
}

/* =========================================================
   Buttons
   ========================================================= */
.btn{
  appearance:none;
  border:0;
  border-radius:8px;
  padding:8px 14px;
  font-weight:900;
  cursor:pointer;
  text-decoration:none !important;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  -webkit-tap-highlight-color:transparent;
  color:inherit;
}
.btn:visited{ color:inherit; }

.btn--yellow{
  background:var(--yellow);
  color:#111;
}
.btn--yellow:hover{ filter:brightness(.95); }

.btn--sm{
  padding:8px 12px !important;
  border-radius:12px !important;
  font-size:12px !important;
  font-weight:900 !important;
  line-height:1;
  min-height:34px;
  border:1px solid rgba(0,0,0,.08);
  box-shadow:0 10px 22px rgba(241,196,15,.18);
}
.btn--yellow.btn--sm:hover{
  transform:translateY(-1px);
  filter:brightness(1.01);
}
.btn--yellow.btn--sm:active{
  transform:translateY(0) scale(.99);
}

/* =========================================================
   Map section
   ========================================================= */
.map-wrap{
  margin:10px 0 16px;
  border-radius:18px;
  overflow:hidden;
  background:var(--card);
  border:1px solid var(--line);
  box-shadow:0 10px 30px rgba(0,0,0,.06);

  max-height:520px;
  transition:max-height .38s ease, opacity .22s ease, transform .38s ease, margin .38s ease;
  will-change:max-height, opacity, transform;

  z-index:1; /* lower than sticky results bar */
}

.map-wrap.map-wrap--collapsed{
  max-height:0 !important;
  opacity:0;
  transform:translateY(-10px);
  margin-top:0 !important;
  margin-bottom:12px;
  pointer-events:none;
  border-width:0;
  box-shadow:none;
}

.map-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:16px;
  padding:14px 16px 10px;
}
.map-title{
  font-weight:900;
  letter-spacing:-.02em;
  font-size:16px;
}
.map-subtitle{
  opacity:.72;
  font-weight:800;
  font-size:12px;
  white-space:nowrap;
}

.map-shell{
  position:relative;
  padding:0;
  border-top:1px solid var(--line);
}

.map{
  height:340px;
  width:100%;
  min-height:260px;
  background:#e9eef5;
}

#creatorsMap.leaflet-container{
  height:340px;
  width:100%;
  min-height:260px;
  position:relative;
  z-index:0;
}

#creatorsMap .leaflet-pane,
#creatorsMap .leaflet-control{
  z-index:1;
}

.leaflet-popup-content-wrapper{
  border-radius:14px !important;
  background:rgba(15,15,18,.92) !important;
  color:rgba(255,255,255,.92) !important;
  box-shadow:0 18px 55px rgba(0,0,0,.35) !important;
  border:1px solid rgba(255,255,255,.10) !important;
  backdrop-filter:blur(10px) !important;
}
.leaflet-popup-tip{ background:rgba(15,15,18,.92) !important; }
.leaflet-control-attribution{ opacity:.65; }

.map-legend{
  position:absolute;
  right:14px;
  bottom:14px;
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:999px;
  background:rgba(255,255,255,.85);
  border:1px solid rgba(0,0,0,.06);
  box-shadow:0 10px 24px rgba(0,0,0,.08);
  font-weight:900;
  font-size:12px;
  color:rgba(0,0,0,.78);
}
.map-legend .dot{
  width:10px;
  height:10px;
  border-radius:99px;
  background:var(--yellow);
  box-shadow:0 0 0 6px rgba(241,196,15,.18);
}

/* =========================================================
   1440px tuning
   ========================================================= */
@media (min-width:1400px){
  :root{
    --container:1280px;
    --gap:20px;
    --card-media-h:260px;
  }
  .topbar__wrap{ padding:14px 18px; }
  .search{ padding-bottom:22px; }
  .page__inner{ margin:22px auto 56px; }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width:980px){
  .page__inner{ grid-template-columns:1fr; }
  .filters{ position:static; }
  .grid{ grid-template-columns:1fr; }
  .map-subtitle{ display:none; }
  .map, #creatorsMap.leaflet-container{ height:300px; }
}

@media (max-width:520px){
  .map, #creatorsMap.leaflet-container{ height:260px; }
}
