/* theme-dark.css — FULL REPLACEMENT (CLEANED + MOBILE FIXED)
   Markup:
   body > .sidebar + .app
   .app > .topbar + .page-content + .footer

   Key fixes:
   - Removed duplicate .topbar block that was overriding the header
   - Mobile no longer hides nav; converts sidebar nav into horizontal "chips"
   - Single source of truth for .card-grid (removed duplicate re-definitions)
   - Keeps your existing class names + banner slots + modal + admin icons
*/
:root{
  --bg:#0b1220;
  --panel:#0f172a;
  --panel2:#0b1020;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --line:rgba(255,255,255,.10);
  --shadow:0 20px 60px rgba(0,0,0,.55);
  --radius:18px;

  --accent:#22c55e;
  --warn:#b45309;

  --sidebar-w:260px;
  --topbar-h:86px;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif;
  color:var(--text);
  background:
    radial-gradient(1200px 700px at 25% 10%, rgba(34,197,94,.16), transparent 60%),
    radial-gradient(900px 600px at 70% 80%, rgba(59,130,246,.10), transparent 55%),
    var(--bg);

  display:flex;
  height:100vh;
  overflow:hidden;
}

/* ===== Sidebar (fixed column + internal scroll) ===== */
.sidebar{
  width:var(--sidebar-w);
  min-width:var(--sidebar-w);
  height:100vh;
  overflow:auto;
  padding:14px;

  background:
    radial-gradient(900px 380px at 20% 0%, rgba(34,197,94,.14), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02)),
    #0f172a;

  border-right:1px solid rgba(255,255,255,.10);
}

/* Sidebar content styling */
.nav-brand{
  font-weight:800;
  font-size:20px;
  letter-spacing:.2px;
  margin:6px 6px 12px;
  opacity:.95;
}

/* Sidebar inner container */
.nav-links{
  display:flex;
  flex-direction:column;
  gap:8px;

  padding:10px;
  border-radius:18px;
  background:rgba(0,0,0,.14);
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 12px 35px rgba(0,0,0,.30);
}

.nav-links a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 12px;
  border-radius:14px;
  text-decoration:none;
  color:var(--text);

  background:rgba(255,255,255,.02);
  border:1px solid rgba(255,255,255,.06);
}

.nav-links a:hover{
  background:rgba(255,255,255,.05);
  border-color:rgba(255,255,255,.10);
}

.nav-links a.active{
  border-color:rgba(34,197,94,.55);
  box-shadow:0 0 0 2px rgba(34,197,94,.18) inset;
}

/* Sidebar scrollbar */
.sidebar::-webkit-scrollbar{width:10px}
.sidebar::-webkit-scrollbar-thumb{
  background:rgba(34,197,94,.35);
  border-radius:999px;
  border:2px solid transparent;
  background-clip:content-box;
}

/* ===== App column (its own scroll container so footer behaves) ===== */
.app{
  flex:1 1 auto;
  min-width:0;
  height:100vh;
  overflow:auto;
}

/* ===== Topbar (single definition — no duplicates) ===== */
.topbar{
  position: sticky;
  top: 0;
  z-index: 50;

  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content:space-between;
  gap:14px;
  padding: 14px 22px;

  border-bottom: 1px solid rgba(255,255,255,.10);

  background:
    radial-gradient(900px 380px at 20% 0%, rgba(34,197,94,.18), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0)),
    #0f172a;

  backdrop-filter: blur(10px);
  box-shadow: 0 16px 45px rgba(0,0,0,.35);
}

.topbar-left{
  display:flex;
  align-items:baseline;
  gap:8px;
  min-width:0;
}
.topbar-left .brand{
  font-weight:800;
  font-size:15px;
  white-space:nowrap;
}
.topbar-left .tagline{
  font-size:13px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  min-width:0;
}

.topbar-center{
  min-width:0;
}
.datetime{
  font-size:13px;
  color:var(--muted);
  letter-spacing:.3px;
  white-space:nowrap;
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:10px;
}

.status-pill{
  padding:4px 10px;
  border-radius:999px;
  font-size:11px;
  font-weight:700;
  letter-spacing:.4px;
}
.status-pill.live{
  background:rgba(0,200,120,.15);
  color:#3ddc97;
  border:1px solid rgba(0,200,120,.35);
}

.topbar-admin{
  display:flex;
  gap:8px;
  align-items:center;
}
.admin-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:32px;
  height:32px;
  border-radius:10px;
  font-size:15px;
  text-decoration:none;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.12);
  color:#eaf6f2;
  transition:background .15s ease, transform .1s ease;
}
.admin-icon:hover{
  background:rgba(0,200,120,.22);
  transform:translateY(-1px);
}

/* Page content area */
.page-content{ padding:22px; }

/* Footer */
.footer{
  padding:18px 22px 20px;
  color:var(--muted);
  border-top:1px solid rgba(255,255,255,.10);
  font-size:13px;
  text-align:center;
}

/* ===== Common UI ===== */
a{color:inherit}
.text-muted{color:var(--muted)}
.mt-24{margin-top:24px}

h1,h2,h3{margin:0 0 10px}
h2{font-size:28px; letter-spacing:.2px}

/* ===== Hero ===== */
.hero{
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 12px 0 18px;
  box-shadow: 0 12px 35px rgba(0,0,0,.28);
}
.hero h1{
  font-size: 42px;
  letter-spacing: .2px;
  margin: 0 0 6px;
}
.hero p{
  margin: 0;
  opacity: .85;
}

/* ===== Cards ===== */
/* ================= DIRECTORY CARD IMAGE NORMALIZER =================
   Fixes: blank/huge top area + missing top image on directory cards
   Works for either <img> thumbs OR divs with background-image.
*/
.card .card-thumb,
.card .thumb,
.card .media,
.card .cover,
.card .card-media,
.card .card-cover,
.card .dir-thumb,
.card .directory-thumb,
.card .item-thumb{
  display:block !important;
  width:100% !important;
  height:160px !important;          /* prevents “exploded” tall cards */
  overflow:hidden !important;
  border-bottom:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.10);
}

/* If the thumb is an <img> */
.card .card-thumb img,
.card .thumb img,
.card .media img,
.card .cover img,
.card img.card-thumb,
.card img.thumb,
.card img.media,
.card img.cover,
.card img.dir-thumb,
.card img.directory-thumb,
.card img.item-thumb{
  display:block !important;
  width:100% !important;
  height:100% !important;
  object-fit:cover !important;
}

/* If the thumb is a div with background-image */
.card .card-thumb,
.card .thumb,
.card .media,
.card .cover,
.card .card-media,
.card .card-cover,
.card .dir-thumb,
.card .directory-thumb,
.card .item-thumb{
  background-size:cover !important;
  background-position:center !important;
  background-repeat:no-repeat !important;
}




.card-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:12px;
}
.card{
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border:1px solid rgba(255,255,255,.10);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  overflow:hidden;

  display:flex;
  flex-direction:column;
}

.card-body{padding:16px; flex:1 1 auto;}
.card-title{font-size:16px; font-weight:750; margin:0}
.card-text{color:var(--muted); line-height:1.4}

.card-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 16px;
  border-top:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.10);
}

/* Stars */
.stars{
  color:#fbbf24;
  letter-spacing:1px;
  margin-top:8px;
  display:inline-block !important;
  white-space:nowrap !important;
}

/* Sub-rating rows */
.substars{ margin-top:6px; }
.substars__row{
  display:flex;
  gap:10px;
  align-items:center;
  line-height:1.2;
}
.substars__label{
  width:44px;
  font-size:.9rem;
  opacity:.85;
}

/* Badges */
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  font-size:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(0,0,0,.20);
}
.badge.bs{background:rgba(180,83,9,.25); border-color:rgba(180,83,9,.45)}

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 14px;
  border-radius:12px;
  background:var(--accent);
  color:#05120a;
  font-weight:800;
  text-decoration:none;
  border:0;
  cursor:pointer;
}
.btn:hover{filter:brightness(1.05)}

/* Optional UI helpers */
.hh-badges{ display:flex; flex-wrap:wrap; gap:8px; margin:10px 0 0; }
.hh-badge{
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px; border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.04);
  font-size:.92rem;
}

.hh-accordion summary{ cursor:pointer; list-style:none; }
.hh-accordion summary::-webkit-details-marker{ display:none; }
.hh-accordion summary strong{ font-size:1.05rem; }
.hh-accordion[open] summary{ margin-bottom:6px; }

/* ===== Banner Slots ===== */

/* Header banner (wide + fixed height) */
.banner-slot-header a{
  display:block;
  width:100%;
  border-radius:14px;
  overflow:hidden;
}
.banner-slot-header img{
  display:block;
  width:100%;
  height:90px;
  object-fit:cover;
  margin:0;
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 18px 45px rgba(0,0,0,.35);
}

/* Banner slot containers */
.banner-slot-footer,
.banner-slot-hero,
.banner-slot-inline,
.banner-slot-after_post,
.banner-slot-sidebar{
  display:flex;
  justify-content:center;
}

/* Shared anchor styling */
.banner-slot-footer a,
.banner-slot-hero a,
.banner-slot-inline a,
.banner-slot-after_post a,
.banner-slot-sidebar a{
  display:block;
  width:100%;
  border-radius:14px;
  overflow:hidden;
}

/* Slot size caps */
.banner-slot-hero a{ max-width:468px; height:60px; }
.banner-slot-footer a{ max-width:468px; }
.banner-slot-sidebar a{ max-width:336px; }
.banner-slot-inline a,
.banner-slot-after_post a{ max-width:468px; }

/* ===== Social footer ===== */
.social-footer{ display:flex; justify-content:center; margin:28px 0 12px; }
.social-footer .social-list{ display:flex; gap:18px; list-style:none; padding:0; margin:0; }

.social-btn{
  --accent: #6b8cff;
  width:52px; height:52px; border-radius:999px;
  display:grid; place-items:center;
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border:1px solid rgba(255,255,255,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 10px 30px rgba(0,0,0,.28);
  backdrop-filter: blur(6px);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  position:relative;
}
.social-btn::after{
  content:"";
  position:absolute; inset:-2px;
  border-radius:inherit;
  pointer-events:none;
  background:
    radial-gradient(60% 60% at 50% 50%, rgba(255,255,255,.14), transparent 60%),
    conic-gradient(from 180deg at 50% 50%, rgba(255,255,255,.12), transparent 60%);
  opacity:.35; transition:opacity .2s ease;
}
.social-btn svg{ width:22px; height:22px; fill:#e8eef9; transition: transform .2s ease, fill .2s ease; }

/* Hover/focus glow */
.social-btn[data-accent]:hover,
.social-btn[data-accent]:focus-visible{
  transform:translateY(-2px) scale(1.03);
  box-shadow:
    0 12px 30px rgba(0,0,0,.35),
    0 0 18px color-mix(in srgb, var(--accent), transparent 60%);
  border-color: color-mix(in srgb, var(--accent), #ffffff 75%);
}
.social-btn[data-accent]:hover svg,
.social-btn[data-accent]:focus-visible svg{ fill:#ffffff; }

/* Disabled */
.social-btn[aria-disabled="true"]{
  cursor: default;
  opacity:.55;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 8px 20px rgba(0,0,0,.18);
}
.social-btn[aria-disabled="true"]:hover{ transform:none; }

/* Tooltip bubble */
.social-btn .tip{
  position:absolute; bottom:58px; left:50%; transform:translateX(-50%) translateY(8px);
  background:rgba(20,28,44,.98); color:#eaf0ff; font-size:12px; line-height:1;
  padding:8px 10px; border-radius:9px; white-space:nowrap; opacity:0; pointer-events:none;
  border:1px solid rgba(255,255,255,.12); box-shadow:0 10px 25px rgba(0,0,0,.35);
  transition:opacity .18s ease, transform .18s ease;
}
.social-btn .tip::after{
  content:""; position:absolute; bottom:-6px; left:50%;
  width:10px; height:10px; background:inherit;
  border-left:1px solid rgba(255,255,255,.12);
  border-bottom:1px solid rgba(255,255,255,.12);
  transform: translateX(-50%) rotate(45deg);
}
.social-btn:hover .tip,
.social-btn:focus-visible .tip{ opacity:1; transform:translateX(-50%) translateY(0); }

/* Screen-reader helper */
.sr-only{
  position:absolute !important;
  width:1px; height:1px;
  padding:0; margin:-1px;
  overflow:hidden;
  clip-path: inset(50%);
  white-space:nowrap;
  border:0;
}

/* ===== Modal overlay ===== */
.hh-modal{
  position: fixed !important;
  inset: 0 !important;
  display: none !important;
  z-index: 99999 !important;
}
.hh-modal[aria-hidden="false"]{ display:block !important; }
.hh-modal__overlay{
  position:absolute !important;
  inset:0 !important;
  background: rgba(0,0,0,.55) !important;
}
.hh-modal__panel{
  position: relative !important;
  width: min(920px, calc(100vw - 32px)) !important;
  max-height: calc(100vh - 32px) !important;
  overflow:auto !important;
  margin:16px auto !important;
  border-radius:16px !important;
  background: var(--panel, #0f172a) !important;
  box-shadow:0 18px 50px rgba(0,0,0,.45) !important;
  padding:18px 18px 20px !important;
}
.hh-modal__close{
  position:absolute !important;
  top:10px !important;
  right:12px !important;
  width:38px !important;
  height:38px !important;
  border-radius:12px !important;
  border:1px solid rgba(255,255,255,.10) !important;
  background: rgba(255,255,255,.06) !important;
  color:#fff !important;
  cursor:pointer !important;
  font-size:22px !important;
  line-height:1 !important;
}
.hh-modal__body{ margin-top:12px !important; }
.hh-modal__body img{
  max-width:100% !important;
  height:auto !important;
  border-radius:12px !important;
}

/* =========================================================
   Responsive
   - Desktop keeps sidebar fixed + app scroll
   - Mobile converts sidebar nav into horizontal chips (no hidden nav)
   ========================================================= */

@media (max-width: 980px){
  .card-grid{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px){
  html,body{height:auto}

  body{
    display:block;
    height:auto;
    overflow:auto;
    overflow-x:hidden;
  }

  .app{
    height:auto;
    overflow:visible;
  }

  /* Compact header */
  :root{ --topbar-h: 72px; }

  .topbar{
    padding:10px 12px;
    flex-wrap:wrap;
    align-items:flex-start;
    gap:10px;
  }

  .topbar-left{
    width:100%;
    justify-content:flex-start;
  }
  .topbar-left .brand{ font-size:14px; }
  .topbar-left .tagline{
    font-size:12px;
    white-space:normal;
    overflow:visible;
    text-overflow:unset;
  }

  .topbar-center{ width:auto; }
  .datetime{ font-size:12px; }

  .topbar-right{
    width:100%;
    justify-content:space-between;
    flex-wrap:wrap;
    gap:8px;
  }

  /* Sidebar becomes horizontal chip-nav */
  .sidebar{
    width:100%;
    min-width:0;
    height:auto;
    padding:10px 12px;
    border-right:0;
    border-bottom:1px solid rgba(255,255,255,.10);
  }

  .nav-brand{
    font-size:14px;
    margin:0 0 8px;
    opacity:.9;
  }

  .nav-links{
    flex-direction:row;
    gap:10px;
    padding:10px;
    overflow-x:auto;
    overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
    border-radius:16px;
  }

  .nav-links a{
    flex:0 0 auto;
    white-space:nowrap;
    padding:10px 12px;
    border-radius:999px;
    font-size:13px;
  }

  .page-content{ padding:14px 12px; }

  /* Hero sizing */
  .hero{ padding:14px 14px; }
  .hero h1{ font-size:28px; line-height:1.05; }
  .hero p{ font-size:13.5px; line-height:1.45; }

  /* Cards single-column */
  .card-grid{ grid-template-columns:1fr; }

  /* Header banner cap */
  .banner-slot-header img{ height:72px; }
}
