/* =========================================================
   GLOBAL
   ========================================================= */
html, body { min-height: 100%; }

body{
  background: linear-gradient(
    to bottom,
    #cfd3d8 0%,     /* mörkare grå upptill */
    #e3e6ea 22%,
    #f2f3f5 55%,
    #f7f8fa 100%
  );
}

/* extra “top shade” för att toningen ska synas tydligare */
body::before{
  content:"";
  position: fixed;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0.10),
    rgba(0,0,0,0.00) 35%
  );
  pointer-events: none;
  z-index: -1;
}

/* =========================================================
   HEADER
   ========================================================= */
\.header{
  position: relative;
  top: auto;
  z-index: 60;
  border-bottom: 0;            /* ingen tunn linje */
  background: transparent;
}

/* samma bredd som footer/content */
.header-inner{
  position: relative;
  z-index: 1;

  max-width: 1140px;
  margin: 4px auto 4px;        /* mindre luft under header */
  padding: clamp(12px, 2.2vw, 18px) clamp(12px, 2vw, 16px); /* responsivt */
  min-height: clamp(110px, 18vw, 180px);

  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;

  background-image: var(--header-bg, url("../img/headbg.png"));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  border: 0;
  border-radius: 18px;
  box-shadow:
    0 10px 30px rgba(0,0,0,0.06),
    0 2px 10px rgba(0,0,0,0.04);
}

.header-inner::before{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(
    to bottom,
	rgba(0,0,0,0),
	rgba(0,0,0,0)
  );
  border-radius: 18px;
  pointer-events:none;
}

.header-inner > *{
  position: relative;
  z-index: 1;
}

/* Brand (visuellt dold – används som klickzon för hem/"Annonser")
   Vi låter den finnas kvar för att slippa ändra HTML på alla sidor,
   men gör den till en osynlig klickzon över vänstra 25% av bannern.
*/
.brand{
  position: absolute;
  inset: 0 auto 0 0; /* top right bottom left */
  width: 25%;
  height: 100%;
  z-index: 2;

  /* gör den "osynlig" men klickbar */
  display: block;
  text-decoration: none;
  color: transparent;
}

/* Dölj allt innehåll i brand (logo/text) visuellt */
.brand > *{
  opacity: 0;
  pointer-events: none;
}

/* Nav wrapper (desktopmenyn ligger i .nav-desktop) */
.nav{
  display:flex;
  align-items:center;
  gap:10px;
}

/* Dropdown */
.drop{ position: relative; }
.drop > button{ user-select:none; }

.menu{
  position:absolute;
  right:0;
  top: calc(100% + 8px);
  min-width:220px;
  padding:8px;
  border-radius:14px;
  border:1px solid var(--border);
  /* Force a light dropdown even when theme-runtime uses dark cards */
  background:#fff !important;
  box-shadow: var(--shadow);
  display:none;
  z-index: 150; /* över overlay i header */
}
.menu a{
  display:block;
  padding:10px 10px;
  border-radius:10px;
}
.menu a:hover{ background: rgba(17,24,39,0.06); text-decoration:none; }
.drop[data-open="1"] .menu{ display:block; }

/* Header dropdown menus must stay light (user request) */
.header .menu.card{
  background:#fff !important;
  color:#111827 !important;
}
.header .menu.card a{
  color:#111827 !important;
}
.header .menu.card a:hover{
  background: rgba(17,24,39,0.06) !important;
}

/* Underkategorier i kategorimenyn */
.menu-sub{
  margin: 6px 0 10px 10px;
  padding-left: 10px;
  border-left: 1px solid rgba(17,24,39,0.12);
}
.menu a.sub{
  padding: 8px 10px;
  font-size: .95em;
  opacity: .92;
}

.mobile-sub{
  margin: 4px 0 10px 12px;
  padding-left: 10px;
  border-left: 1px solid rgba(255,255,255,0.16);
}
.mobile-menu a.sub{
  padding-left: 18px;
  font-size: .98em;
  opacity: .92;
}

/* =========================================================
   MAIN LAYOUT
   ========================================================= */
.grid{
  display:grid;
  grid-template-columns: 3fr 1fr;
  gap:16px;
  margin-top: 4px; /* tajtare mot headern */
}

/* =========================================================
   ADS (LIST)
   ========================================================= */
.lst-panel{
  padding:14px;
}

/* Själva rutnätet för annonserna (2 kolumner med lika bredd) */
.lst-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:14px;
  width:100%;
}

/* 2 kolumner på desktop, 1 på mindre skärmar */
@media (max-width: 1100px){
  .lst-grid{ grid-template-columns: 1fr; }
}

.lst-item{
  display:grid;
  grid-template-columns: 110px 1fr;
  column-gap: 16px;            /* mer luft mellan bild och text */
  padding:12px;
  border-radius:14px;
  border:1px solid var(--border);
  height:100%;
  align-items:stretch;
}

.thumb{
  position: relative;
  width:120px;
  height:90px;
  border-radius:14px;
  border:1px solid var(--border);
  background: linear-gradient(135deg, rgba(0,0,0,0.03), rgba(0,0,0,0.01));
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0; /* förhindrar att miniatyrbilden krymper vid liten skärm */
}

.thumb img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
  background: rgba(0,0,0,0.03);
  position: relative;
  z-index: 2;
}

/* ======= STACK-EFFEKT (flere bilder) =======
   index.php sätter class "thumb thumb-stack" när img_count > 1
   ========================================== */
.thumb.thumb-stack{ overflow: visible; }

.thumb.thumb-stack::before,
.thumb.thumb-stack::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius:14px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(17,24,39,0.12);
  z-index: 0;
  pointer-events:none;
  box-shadow:
    0 14px 28px rgba(0,0,0,0.10),
    0 4px 10px rgba(0,0,0,0.06);
}

.thumb.thumb-stack::after{
  transform: translate(4px, 4px);
  opacity: 0.60;
}
.thumb.thumb-stack::before{
  transform: translate(8px, 8px);
  opacity: 0.40;
}

/* Meta */
.lst-meta{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-height:100%;
  min-width: 0;               /* viktigt så text inte “trycker bort” */
  padding-left: 2px;
}

.lst-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.lst-head strong{
  display:block;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}



/* Annons-footer: "Öppna annons" + köpes/säljes-badge */
.lst-foot{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;

  /* Variant B: lås footern till botten av kortet */
  margin-top:auto;
  padding-top:8px;

  flex-wrap:nowrap;
}

.lst-foot .lst-open{
  margin:0;
  display:inline-flex;
  align-items:center;
  white-space:nowrap;
}

.lst-foot .badge-intent{
  flex:0 0 auto;
  white-space:nowrap;
}

.price{ font-weight:800; white-space:nowrap; }

.muted-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  color:var(--muted);
  font-size:13px;
}

.lst-meta > .small{ margin-top:auto; }

/* =========================================================
   SPONSORS
   ========================================================= */
.prtnr-col{ padding:14px; }

.prtnr-stack{
  display:grid;
  gap:12px;
}

.prtnr-hero{
  padding:12px;
  border-radius:16px;
  border:1px solid var(--border);
  background: rgba(0,0,0,0.01);
}

.prtnr-hero .prtnr-img{ height:160px; }

.prtnr-item{
  padding:12px;
  border-radius:14px;
  border:1px solid var(--border);
  display:grid;
  grid-template-columns: 74px 1fr;
  gap:10px;
  align-items:center;
}

.prtnr-item .prtnr-img{
  height:64px;
  border-radius:12px;
}

.prtnr-img{
  width:100%;
  border:1px solid var(--border);
  overflow:hidden;
  background: rgba(0,0,0,0.03);
  display:flex;
  align-items:center;
  justify-content:center;
}

.prtnr-img img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
}

.prtnr-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  font-size:12px;
  color:var(--muted);
}

/* Fix för “skräp/underline/focus” runt sponsor-länkar */
.prtnr-hero,
.prtnr-item{
  display: block;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.prtnr-hero .small,
.prtnr-item .small{
  text-decoration: none;
}

.prtnr-hero:focus,
.prtnr-item:focus{
  outline: none;
}

.prtnr-hero:focus-visible,
.prtnr-item:focus-visible{
  box-shadow:
    0 0 0 3px rgba(17,24,39,0.14),
    0 10px 30px rgba(0,0,0,0.06),
    0 2px 10px rgba(0,0,0,0.04);
  border-radius: 16px;
}

/* =========================================================
   SPONSORS – enhetlig storlek i sidokolumn
   Fixar att hero annars blir större än övriga.
   ========================================================= */

/* Gör alla sponsor-kort "hero-stora" (image överst) */
.prtnr-item{
  display:block;                 /* override tidigare grid */
  grid-template-columns: none;   /* safety */
}

.prtnr-hero,
.prtnr-item{
  min-height: 210px;             /* håller jämna höjder */
}

.prtnr-hero .prtnr-img,
.prtnr-item .prtnr-img{
  height: 160px;
  border-radius: 14px;
}

/* Ge textdelen luft när prtnr-item blivit vertikal */
.prtnr-item > div:last-child{
  margin-top: 10px;
}

/* =========================================================
   AD DETAIL (annons-sidan)
   ========================================================= */
.detail{ padding:14px; }

.ad-photos{
  display: grid;
  gap: 12px;
}

.ad-photos .hero{
  position: relative;
  height: 320px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.03);
  box-shadow:
    0 18px 42px rgba(0,0,0,0.10),
    0 6px 16px rgba(0,0,0,0.06);
}

/* “kort bakom” på annons-sidan (du ville ha stack, inte +2) */
.ad-photos .hero.has-stack::before,
.ad-photos .hero.has-stack::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: rgba(255,255,255,0.35);
  border: 1px solid rgba(17,24,39,0.10);
  pointer-events: none;
  z-index: 0;
}

.ad-photos .hero.has-stack::before{
  transform: translate(10px, 10px);
  opacity: 0.55;
}
.ad-photos .hero.has-stack::after{
  transform: translate(18px, 18px);
  opacity: 0.35;
}

.ad-photos .hero img{
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: rgba(0,0,0,0.03);
}

.ad-photos .thumbs{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.tbtn{
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,0.65);
  cursor: pointer;
  box-shadow:
    0 10px 24px rgba(0,0,0,0.08),
    0 3px 10px rgba(0,0,0,0.05);
  transition: transform .16s ease, box-shadow .16s ease;
}

.tbtn img{
  width: 100%;
  height: 110px;
  object-fit: contain;
  display: block;
  background: rgba(0,0,0,0.03);
}

.tbtn:hover{
  transform: translateY(-2px);
  box-shadow:
    0 14px 30px rgba(0,0,0,0.10),
    0 5px 16px rgba(0,0,0,0.06);
}

/* =========================================================
   RESPONSIV MENY: Portrait = hamburger, Landscape = desktop
   (hamburger-knappen är till vänster i headern via HTML)
   ========================================================= */
.nav-desktop{
  display: flex;
  align-items: center;
  gap: 10px;
}

.hamburger{
  display: none;
  margin-right: 6px;
}

.mobile-overlay{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
}
.mobile-overlay[hidden]{ display:none; }

.mobile-menu{
  position: fixed;
  top: 0;
  /*
    Viktigt: göm menyn helt utanför skärmen oavsett faktisk bredd.
    (right:-320px + width:min(320px,86vw) kan lämna en synlig remsa på små skärmar)
  */
  right: 0;
  width: 86vw;
  max-width: 320px;
  transform: translateX(110%);
  height: 100vh;
  background: rgba(250,250,252,0.98);
  border-left: 1px solid rgba(17,24,39,0.12);
  box-shadow: -30px 0 60px rgba(0,0,0,0.18);
  padding: 14px;
  z-index: 210;
  transition: transform .22s ease;
  backdrop-filter: blur(10px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
}

.mobile-menu[hidden]{ display:block !important; visibility:hidden; pointer-events:none; } /* JS hanterar via transform + hardClose */
.mobile-menu.open{ transform: translateX(0); visibility:visible; pointer-events:auto; }

.mobile-menu-head{
  position: sticky;
  top: 0;
  background: rgba(250,250,252,0.98);
  z-index: 1;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 10px 6px 12px;
  border-bottom: 1px solid rgba(17,24,39,0.10);
  margin-bottom: 10px;
}

.mobile-menu-section{ padding: 10px 6px; }

.mobile-title{
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}

.mobile-menu a{
  display:block;
  padding: 10px 10px;
  border-radius: 12px;
}

.mobile-menu a:hover{
  background: rgba(17,24,39,0.06);
  text-decoration: none;
}

/* Portrait: hamburger på, desktop av */
@media (orientation: portrait){
  .nav-desktop{ display: none; }
  .hamburger{ display: inline-flex; }

  /* Mobilscroll: header scrollar bort, men hamburgaren ligger kvar */
  .header{ position: relative; top: auto; }
  .hamburger{
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: 10px;
    z-index: 200;
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
    backdrop-filter: blur(8px);
  }
  /* Liten buffert så första annonsraden inte hamnar under hamburgaren */
  .grid{ margin-top: 10px; }
}

/* Landscape: normalt = desktop, men på låg mobilhöjd vill vi ha hamburger + header scrollar bort */
@media (orientation: landscape){
  .nav-desktop{ display: flex; }
  .hamburger{ display: none; }
}
@media (orientation: landscape) and (max-height: 520px){
  .nav-desktop{ display: none; }
  .hamburger{ display: inline-flex; }

  /* Header ska kunna scrollas bort (inte sticky) */
  .header{ position: relative; top: auto; }

  /* Hamburgaren ligger kvar */
  .hamburger{
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    left: 10px;
    z-index: 200;
    box-shadow: 0 10px 30px rgba(0,0,0,.18);
    backdrop-filter: blur(8px);
  }

  /* Komprimera headern i landscape så den inte äter skärmhöjd */
  .header-inner{
    padding: 12px 14px;
    min-height: 120px;
  }

  /* Liten buffert så innehåll inte hamnar under hamburgaren */
  .grid{ margin-top: 10px; }
}

/* =========================================================
   MEDIA QUERIES (layout)
   ========================================================= */
@media (max-width: 900px){
  .grid{ grid-template-columns: 1fr; }
  .lst-grid{ grid-template-columns: 1fr; }

  .thumb{ width: 132px; height: 98px; }
  .ad-photos .hero{ height: 260px; }
}

/* Mobil: säkra att text inte hamnar under headern */
@media (max-width: 520px){
  .header-inner{
    margin: 0;
    min-height: clamp(92px, 26vw, 130px);
    padding: 12px 12px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
  .header-inner::before{ border-radius: 0; pointer-events: none; }

  /* vi döljer den “vanliga” nav-wrapen, eftersom hamburger/portrait tar över */
  .nav{ display:none; }

  .lst-panel{ grid-template-columns: 1fr; }

  .lst-item{
    grid-template-columns: 120px 1fr;
    column-gap: 14px;
    align-items: start;
  }

  .thumb{
    width: 120px;
    height: 92px;
  }

  .muted-row{ font-size: 12px; }
  .price{ font-size: 14px; }

  .ad-photos .hero{ height: 240px; }
  .ad-photos .thumbs{ grid-template-columns: 1fr; }
  .tbtn img{ height: 160px; }
}

/* Landscape (telefon/platta): mer “fullskärm” + 2 annonser i bredd */
@media (orientation: landscape) and (max-height: 520px) and (max-width: 1024px){
  .grid{ grid-template-columns: 1fr; } /* sponsor under i låg höjd */

  .lst-grid{
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .lst-item{
    grid-template-columns: 96px 1fr;
    padding: 10px;
    column-gap: 12px;
  }

  .thumb{
    width: 96px;
    height: 72px;
  }

  .lst-head strong{ font-size: 14px; }
  .muted-row{ font-size: 12px; }
}

/* =========================================================
   LIGHTBOX
   ========================================================= */
.lightbox{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
  background: rgba(0,0,0,0.60);
  z-index:9999;
}
.lightbox[data-open="1"]{ display:flex; }

.lightbox-inner{
  width: min(1100px, 96vw);
  height: min(85vh, 800px);
  border-radius:18px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,0.15);
  background: rgba(0,0,0,0.20);
  display:flex;
}

.lightbox-inner img{
  width:100%;
  height:100%;
  object-fit:contain;
  display:block;
  background: rgba(0,0,0,0.40);
}

/* =========================================================
   FOOTER
   ========================================================= */
.footer{
  margin-top: 32px;
  background: transparent;
}

.footer-inner{
  max-width: 1140px;
  margin: 0 auto;
  padding: 12px 16px 20px;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;

  border-top: 1px solid rgba(17,24,39,0.08);
}

.footer-left{
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-left strong{ font-size: 14px; }

.footer-left span{
  font-size: 12px;
  color: var(--muted);
}

.footer-nav{
  display: flex;
  gap: 14px;
}

.footer-nav a{
  font-size: 13px;
  color: var(--muted);
}

.footer-nav a:hover{
  color: inherit;
  text-decoration: underline;
}

@media (max-width: 520px){
  .footer-inner{
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .footer-nav{
    gap: 10px;
    flex-wrap: wrap;
  }
}


/* --- Create Ad: 3-bilders uppladdare (en i taget) --- */
.upload-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}
@media (max-width: 840px){
  .upload-grid{ grid-template-columns:1fr; }
}
.upload-slot{
  border:1px solid rgba(17,24,39,.10);
  border-radius:16px;
  padding:12px;
  background:rgba(255,255,255,.65);
  box-shadow:0 1px 0 rgba(17,24,39,.03);
}
.upload-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-weight:700;
  font-size:.9rem;
  margin-bottom:10px;
}
.upload-clear{
  border:1px solid rgba(17,24,39,.12);
  background:rgba(255,255,255,.8);
  border-radius:999px;
  width:28px;
  height:28px;
  line-height:26px;
  cursor:pointer;
}
.upload-pick{
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px dashed rgba(17,24,39,.20);
  border-radius:14px;
  padding:10px;
  background:rgba(255,255,255,.7);
  cursor:pointer;
  user-select:none;
}
.upload-pick input{ display:none; }
.upload-thumb{
  margin-top:10px;
  border-radius:14px;
  overflow:hidden;
  height:140px;
  background:rgba(0,0,0,.03);
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid rgba(17,24,39,.08);
}
.upload-thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:none;
}
.upload-placeholder{
  color:rgba(17,24,39,.55);
  font-size:.85rem;
}

/* =========================================================
   SEARCH (index + advanced)
   ========================================================= */

/* Index: inline search bar (harmoniserar med header + kort) */
.searchbar{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-left:auto;
}

.searchbar input[type="search"]{
  width: min(520px, 60vw);
  background: linear-gradient(to bottom, rgba(255,255,255,0.92), rgba(255,255,255,0.82));
  border-color: rgba(17,24,39,0.12);
}

.searchbar a.btn{
  background: rgba(255,255,255,0.70);
}

@media (max-width: 820px){
  .searchbar{ width:100%; }
  .searchbar input[type="search"]{ width: 100%; }
}

/* Advanced search layout */
.search-page{
  display:grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  align-items:start;
  margin-top: 8px;
}

.search-sidebar{ padding: 14px; }
.search-sidebar-title{ display:grid; gap:6px; margin-bottom: 12px; }

.lan-chips{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
}

.lan-chip{
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(17,24,39,0.10);
  background: rgba(255,255,255,0.60);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  line-height: 1;
}

.lan-chip:hover{ text-decoration:none; background: rgba(255,255,255,0.85); }
.lan-chip.active{
  color:#fff;
  border-color: rgba(37,99,235,.35);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.callout{
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  border: 1px dashed rgba(17,24,39,0.16);
  background: rgba(17,24,39,0.03);
}

.search-main{ min-width:0; }
.search-form{ padding: 14px; }
.search-form-head{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 12px;
  flex-wrap:wrap;
}

.search-form-meta{ display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }

.search-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-span-2{ grid-column: 1 / -1; }

.search-actions{
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
  align-items:center;
}

.active-filters{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  margin-top: 12px;
}

/* Range UI (prisreglage) */
.range-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.range-badges{ display:flex; gap:8px; flex-wrap:wrap; }
.range-pill{
  display:inline-flex;
  align-items:baseline;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(17,24,39,0.10);
  background: rgba(255,255,255,0.65);
}

.range-wrap{
  position:relative;
  margin-top: 10px;
  height: 34px;
}

.range{ 
  position:absolute;
  left:0; right:0;
  top: 10px;
  width:100%;
  height: 16px;
  background: transparent;
  -webkit-appearance:none;
  appearance:none;
  pointer-events: none; /* thumbs only */
}

.range::-webkit-slider-thumb{
  pointer-events: auto;
  -webkit-appearance:none;
  appearance:none;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(17,24,39,0.16);
  background: linear-gradient(135deg, #fff, rgba(255,255,255,0.7));
  box-shadow: 0 10px 20px rgba(0,0,0,0.12);
}

/* =========================================================
   RANGE UI (prisreglage) – EN version (ingen krock)
   ========================================================= */

.range-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}

.range-badges{ display:flex; gap:8px; flex-wrap:wrap; }
.range-pill{
  display:inline-flex;
  align-items:baseline;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid rgba(17,24,39,0.10);
  background: rgba(255,255,255,0.65);
}

/* Wrapper runt hela prisfältet (större hit-area) */
[data-price-range]{
  padding: 12px 6px;
  user-select:none;
  -webkit-user-select:none;
  touch-action: pan-y;  /* scroll ok, drag bättre */
}

.range-wrap{
  position:relative;
  margin-top:10px;
  height: 44px;         /* större träffyta */
}

/* De två range inputs (min/max) ligger ovanpå varandra */
.range{
  position:absolute;
  inset:0;
  width:100%;
  height:44px;          /* större klickyta */
  background: transparent;
  margin:0;
  -webkit-appearance:none;
  appearance:none;

  /* thumbs-only (du kan byta till auto om du vill klicka på spåret) */
  pointer-events:none;
}

/* Track (spåret) – om du inte stylar detta kan track bli “osynligt” */
.range::-webkit-slider-runnable-track{
  height:10px;
  border-radius:999px;
  background: rgba(17,24,39,0.10);
}
.range::-moz-range-track{
  height:10px;
  border-radius:999px;
  background: rgba(17,24,39,0.10);
}

/* Thumb – större + tydlig + lätt att träffa */
.range::-webkit-slider-thumb{
  pointer-events:auto;
  -webkit-appearance:none;
  appearance:none;

  width:28px;
  height:28px;
  border-radius:999px;
  border:1px solid rgba(17,24,39,0.18);
  background: linear-gradient(135deg, #fff, rgba(255,255,255,0.7));
  box-shadow: 0 10px 20px rgba(0,0,0,0.12);

  margin-top:-9px; /* centrerar thumb mot 10px-track */
}
.range::-moz-range-thumb{
  pointer-events:auto;
  width:28px;
  height:28px;
  border-radius:999px;
  border:1px solid rgba(17,24,39,0.18);
  background: linear-gradient(135deg, #fff, rgba(255,255,255,0.7));
  box-shadow: 0 10px 20px rgba(0,0,0,0.12);
}

/* Extra “osynlig” hit-area runt thumb (Chromium/WebKit) */
@supports selector(input[type="range"]::-webkit-slider-thumb){
  .range::-webkit-slider-thumb{
    box-shadow:
      0 10px 20px rgba(0,0,0,0.12),
      0 0 0 10px rgba(255,255,255,0);
  }
}
/* Ta bort blå fokusram på prisreglage */
.range:focus,
.range:focus-visible{
  outline: none !important;
  box-shadow: none !important;
}

/* (ibland ligger fokus på thumb i WebKit) */
.range::-webkit-slider-thumb:focus{
  outline: none !important;
}


/* Cursor feedback */
.range-wrap:hover .range{ cursor: grab; }
.range-wrap:active .range{ cursor: grabbing; }


.range-track{
  position:absolute;
  left:0; right:0;
  top: 17px;
  height: 6px;
  border-radius: 999px;
  background: rgba(17,24,39,0.10);
}

.range-fill{
  position:absolute;
  top:0;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.range-inputs{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.search-results{ padding: 14px; }
.search-results .lst-item{
  background: rgba(255,255,255,0.65);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.search-results .lst-item:hover{
  text-decoration:none;
  background: rgba(255,255,255,0.90);
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(0,0,0,0.08);
}

.thumb-count{
  position:absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: rgba(17,24,39,0.70);
  backdrop-filter: blur(6px);
  z-index: 5;
}

.pager{
  display:flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  flex-wrap:wrap;
}

.page{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 12px;
  border: 1px solid rgba(17,24,39,0.10);
  background: rgba(255,255,255,0.65);
  font-weight: 800;
  font-size: 13px;
}

.page:hover{ text-decoration:none; background: rgba(255,255,255,0.92); }
.page.current{ color:#fff; border-color: rgba(37,99,235,.35); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.page.dots{ border: 0; background: transparent; min-width:auto; padding:0 2px; }
.page.nav{ min-width: 46px; }

@media (max-width: 980px){
  .search-page{ grid-template-columns: 1fr; }
}

@media (max-width: 640px){
  .search-grid{ grid-template-columns: 1fr; }
  .field-span-2{ grid-column: auto; }
}

/* =========================================================
   BANNER: osynlig hem-zon (vänster 25%)
   - Länkar hem (relativt per sida)
   - Visar "Annonser" som diskret tooltip-pill på hover (desktop)
   - Diskret hover-highlight
   ========================================================= */

.header-inner{ position: relative; }

/* Se till att knappar (t.ex. hamburger) alltid ligger ovanför klickzonen */
.header-inner .hamburger,
.header-inner .btn,
.header-inner .nav,
.header-inner .header-actions{
  position: relative;
  z-index: 10;
}

/* Ta bort blå fokusram (osynlig zon) */
.header-inner .nav-homezone:focus,
.header-inner .nav-homezone:focus-visible,
.header-inner a.brand:focus,
.header-inner a.brand:focus-visible{
  outline: none;
  box-shadow: none;
}

/* Hover-highlight (desktop: hover + fin pointer) */
@media (hover: hover) and (pointer: fine){
  .header-inner .nav-homezone::before,
  .header-inner a.brand::before{
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: linear-gradient(90deg, rgba(255,255,255,.12), rgba(255,255,255,0));
    opacity: 0;
    transition: opacity .18s ease;
    pointer-events: none;
  }

  .header-inner .nav-homezone::after,
  .header-inner a.brand::after{
    content: "Annonser";
    position: absolute;
    left: 16px;
    top: 16px;
    font-size: 12px;
    font-weight: 800;
    color: #fff;
    opacity: 0;
    transition: opacity .18s ease;
    pointer-events: none;

    /* pill */
    background: rgba(3, 11, 23, .82);
    border: 1px solid rgba(255,255,255,.16);
    padding: 8px 10px;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0,0,0,.25);
    backdrop-filter: blur(6px);
  }

  .header-inner .nav-homezone:hover::before,
  .header-inner a.brand:hover::before{ opacity: .9; }
  .header-inner .nav-homezone:hover::after,
  .header-inner a.brand:hover::after{
    opacity: .92;
  }
}

/* Header buttons: solid hover (white buttons should NOT become transparent) */
.header-inner .btn{
  transition: background-color .12s ease, box-shadow .12s ease, transform .12s ease, filter .12s ease;
}

/* =========================================================
   HEADER NAV POLISH (Desktop/Landscape)
   - Make all header menu buttons identical size
   - Place the button row between the header centerline and bottom
   ========================================================= */

/* 1) Identical sizes for all header menu buttons */
.header-inner .nav-desktop .btn{
  height: 44px;
  padding: 0 16px;
  line-height: 1;
  box-sizing: border-box;
}

/* 2) Position nav row: between centerline and bottom of header-inner */
@media (orientation: landscape){
  .header-inner .nav{
    align-self: flex-end;
    margin-bottom: 10px; /* tweakable: 24-34px */
  }
}

/* Desktop (wide) also gets the same placement */
@media (min-width: 521px){
  .header-inner .nav{
    align-self: flex-end;
    margin-bottom: 10px;
  }
}


/* Admin/alt header button row: keep actions 10px from bottom like main nav */
.header-inner .header-actions{
  display: flex;
  gap: 10px;
  align-items: center;
  align-self: flex-end;
  margin-bottom: 10px;
}
/* Only non-accent buttons */
.header-inner .btn:not(.btn-accent):hover,
.header-inner .btn:not(.btn-accent):focus-visible{
  background-color: #f1f3f5 !important;
  background-image: none !important;
  opacity: 1 !important;
  filter: none !important;
  box-shadow: 0 10px 22px rgba(0,0,0,0.08);
  transform: translateY(-1px);
  text-decoration: none;
  outline: none;
}

.header-inner .btn:not(.btn-accent):active{
  transform: translateY(0px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.10);
}

/* Dropdown/menu links hover: also solid light gray */
.menu a:hover,
.mobile-menu a:hover{
  background: #f1f3f5 !important;
}


/* =========================================================
   MOBILE FIXES (admin tools)
   - Prevent tool cards from overflowing on small screens
   - Stack grid rows (seed/flush, sitepack, theme controls)
   - Keep banner preview within card width
   ========================================================= */
@media (max-width: 720px){

  /* Ensure cards never exceed viewport */
  .container{ padding: 12px; }
  .card{ width: 100%; max-width: 100%; overflow: hidden; }

  /* Header buttons: wrap + full width if needed */
  .header-actions{ flex-wrap: wrap; gap: 8px; }
  .header-actions .btn{ width: 100%; }

  /* Inputs/Selects/Buttons should not force horizontal scroll */
  .card input,
  .card select,
  .card textarea,
  .card button{
    max-width: 100%;
  }

  /* Stack inline grid blocks used in tools UI */
  .card [style*="grid-template-columns"]{
    grid-template-columns: 1fr !important;
  }

  /* Stack inline flex rows used in tools UI */
  .card [style*="display:flex"]{
    flex-direction: column !important;
    align-items: stretch !important;
  }

  /* Range should always fit */
  input[type="range"]{ width: 100% !important; }

  /* Banner preview wrappers (if present) */
  .bannerPreviewWrap,
  #bannerPreviewWrap{
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  /* If preview is an <img> */
  img#bannerPreview,
  img.bannerPreview{
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
  }
}


/* --- Län-beteenden (search.php) --- */
.lan-form .lan-list{
  max-height: 60vh;
  overflow:auto;
  padding-right: 4px;
  display:flex;
  flex-direction:column;
  gap: 6px;
}

/* Klicka på län utan checkboxruta */
.lan-check input{ display:none; }
.lan-check{
  cursor:pointer;
  padding: 7px 10px;
  border-radius: 12px;
  transition: background .12s ease, box-shadow .12s ease, transform .12s ease;
}
.lan-check:hover{ background: rgba(255,255,255,.05); }
.lan-check::before{
  content:"";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 2px solid var(--muted);
  display:inline-block;
  flex: 0 0 auto;
}
.lan-check.is-on{ background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px rgba(255,255,255,.10); }
.lan-check.is-on::before{ background: var(--accent); border-color: var(--accent); }

.lan-actions{
  display:flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap:wrap;
}

.lan-badges{ margin: 10px 0 2px; display:flex; flex-wrap:wrap; gap: 8px; }

/* Badge med egen färg (angränsande län) */
.badge-adj{
  cursor:pointer;
  user-select:none;
  border: 1px solid rgba(59,130,246,.35);
  background: rgba(59,130,246,.14);
}
.badge-adj input{ display:none; }
.badge-adj.is-on{ border-color: rgba(34,197,94,.45); background: rgba(34,197,94,.18); }
.badge-adj.is-disabled{
  opacity: .45;
  cursor: not-allowed;
}

/* ===== Kategori: dropdown med underkategorier ===== */

/* Desktop: hover på huvudkategori visar underkategorier i en "flyout" */
.menu .cat-item{ position: relative; }
.menu .cat-main{ display:block; }
.menu .cat-submenu{
  display:none;
  position:absolute;
  left: 100%;
  top: 0;
  min-width: 220px;
  padding: 8px;
  border-radius: 14px;
  /* Motorcyklar/underkategorier ska vara vit bakgrund + svart text */
  background: #fff !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow);
  z-index: 50;
}
.menu .cat-item.has-sub:hover > .cat-submenu,
.menu .cat-item.has-sub:focus-within > .cat-submenu{ display:block; }
.menu .cat-sub{ display:block; }

/* Flyout-lådan (underkategorier): ge länkarna tydlig textfärg och normal "icke-hover" bakgrund
   så den inte ser ut som en svart klump innan man hovrar. */
.menu .cat-submenu a{
  color: #111827 !important;
  padding: 9px 10px;
  border-radius: 10px;
  text-decoration: none;
  background: transparent;
  display:block;
}
.menu .cat-submenu a:hover{
  /* Tydlig mouseover/highlight */
  background: rgba(59,130,246,.12) !important;
}
.menu .cat-submenu a:focus-visible{
  outline: 2px solid rgba(59,130,246,.55);
  outline-offset: 2px;
}

/* Mobile: details/summary */
.mobile-cat{ margin: 6px 0; }
.mobile-cat > summary{
  list-style:none;
  cursor:pointer;
  padding: 10px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.06);
}
.mobile-cat > summary::-webkit-details-marker{ display:none; }
.mobile-cat[open] > summary{ background: rgba(59,130,246,.12); }
.mobile-cat a.sub{ padding-left: 16px; }


/* Kontaktformulär (popup + sida) */

.contact-form label{display:block;margin:12px 0;font-weight:600;}
.contact-form input,.contact-form textarea{
  width:100%;
  box-sizing:border-box;
  margin-top:6px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(0,0,0,.18);
  background:rgba(255,255,255,.92);
}
.contact-actions{display:flex;align-items:center;gap:12px;margin-top:12px;}
.contact-actions button{padding:10px 14px;border-radius:12px;border:0;cursor:pointer;}
.contact-status{font-weight:600;opacity:.8;}


/* =========================================================
   ADMIN: ANNONS-FÖRHANDSGRANSKNING (pending/rejected)
   - Tydlig apelsinorange så admin ser att något kräver åtgärd
   ========================================================= */

.admin-preview{
  padding: 14px;
  margin-bottom: 12px;
  border-radius: 14px;
  border: 2px solid rgba(251, 146, 60, 0.55); /* orange kant */
  background: rgba(255, 237, 213, 0.85);      /* ljus apelsin */
}

.admin-preview-status{
  font-weight: 800;
  color: rgba(154, 52, 18, 0.95); /* mörk orange */
  opacity: 1 !important;
}

/* Pending: lite starkare */
.admin-preview--pending{
  border-color: rgba(249, 115, 22, 0.70);
  background: rgba(255, 237, 213, 0.95);
}

/* Rejected: rödare ton */
.admin-preview--rejected{
  border-color: rgba(220, 38, 38, 0.55);
  background: rgba(254, 226, 226, 0.90);
}

/* ------------------------------
   Meddelanden (olästa badge)
------------------------------ */
.msg-badge{
  display:inline-block;
  margin-left:6px;
  padding:2px 7px;
  border-radius:999px;
  font-size:11px;
  line-height:1.2;
  background:#e53935;
  color:#fff;
  vertical-align:middle;
}
