/* assets/app.css */
/* “Grønn landsby” – livlig, flat-ish, moderne */

:root{
  --brand: #1f7a4f;
  --brand-2: #16a34a;
  --brand-3: #10b981;
  --brand-soft: #eafaf1;

  --sun: #f59e0b;
  --sky: #38bdf8;
  --rose: #fb7185;

  --ink: #0f172a;
  --muted: #64748b;

  --card: #ffffff;
  --border: rgba(15, 23, 42, .10);

  --shadow: 0 14px 34px rgba(2, 6, 23, .10);
  --shadow-soft: 0 10px 22px rgba(2, 6, 23, .08);

  --radius: 18px;
}

html, body{ color: var(--ink); }

body{
  background:
    radial-gradient(1200px 420px at 10% 0%, rgba(56,189,248,.10), transparent 55%),
    radial-gradient(900px 360px at 85% 10%, rgba(245,158,11,.08), transparent 55%),
    #f7faf8;
}

/* Typografi */
.h1, .h2, .h3, .h4, .h5, .h6,
h1, h2, h3, h4, h5, h6{
  letter-spacing: -0.02em;
}

/* Litt bedre “tap highlight” på mobil */
a, button{ -webkit-tap-highlight-color: transparent; }

/* Navbar */
.navbar{ backdrop-filter: saturate(140%) blur(8px); }
.navbar-brand{
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-dot{
  display:inline-block;
  width:.55rem; height:.55rem;
  background: var(--brand-2);
  border-radius: 999px;
  margin-left: .35rem;
  vertical-align: middle;
}

/* Links */
a{ color: inherit; }
a.link-brand{
  color: var(--brand-2);
  font-weight: 700;
}
a.link-brand:hover{
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Text muted override */
.text-muted{ color: var(--muted) !important; }

/* Buttons */
.btn-primary{
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 10px 20px rgba(2,6,23,.08);
}
.btn-primary:hover, .btn-primary:focus{
  background: var(--brand-2);
  border-color: var(--brand-2);
}
.btn-outline-primary{
  color: var(--brand);
  border-color: rgba(31,122,79,.35);
}
.btn-outline-primary:hover{
  background: var(--brand-soft);
  border-color: rgba(31,122,79,.55);
  color: var(--brand);
}
.btn-outline-secondary{
  border-color: rgba(15, 23, 42, .18);
}
.btn-outline-secondary:hover{
  background: rgba(15,23,42,.03);
}
.btn.btn-sm{ border-radius: 12px; }

/* Inputs */
.form-control, .form-select{
  border-radius: 12px;
  border-color: rgba(15,23,42,.14);
}
.form-control:focus, .form-select:focus{
  border-color: rgba(31,122,79,.55);
  box-shadow: 0 0 0 .2rem rgba(31,122,79,.14);
}

/* Cards (generic) */
.card{
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  background: var(--card);
}
.card .card-footer{ border-top: 1px solid var(--border); }

/* Filter chips */
.filter-chip{
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .40rem .60rem;
  border-radius: 999px;
  background: rgba(16,185,129,.10);
  border: 1px solid rgba(16,185,129,.22);
  color: #0f5132;
  text-decoration: none;
  font-size: .88rem;
  font-weight: 750;
}
.filter-chip:hover{ background: rgba(16,185,129,.14); }

/* Hero */
.page-hero{
  border-radius: var(--radius);
  background:
    radial-gradient(1200px 300px at 10% 0%, rgba(56,189,248,.18), transparent 55%),
    radial-gradient(900px 260px at 80% 10%, rgba(245,158,11,.16), transparent 55%),
    linear-gradient(135deg, #eafaf1 0%, #f7faf8 55%, #ffffff 100%);
  border: 1px solid rgba(31,122,79,.18);
  box-shadow: 0 14px 32px rgba(2,6,23,.06);
}
.page-hero h1{ font-weight: 900; }

/* Badges */
.badge-soft{
  background: rgba(16,185,129,.12);
  color: #0f5132;
  border: 1px solid rgba(16,185,129,.22);
  font-weight: 800;
}
.badge-muted{
  background: #ffffff;
  border: 1px dashed rgba(15,23,42,.18);
  color: #334155;
}

/* Pagination */
.pagination .page-link{
  border-radius: 12px;
  border-color: rgba(15,23,42,.12);
}
.pagination .page-item.active .page-link{
  background: var(--brand);
  border-color: var(--brand);
}

/* Offcanvas */
.offcanvas{ border-left: 1px solid rgba(15,23,42,.10); }

/* Litt snillere fokus-ring for keyboard */
:focus-visible{
  outline: 2px solid rgba(31,122,79,.45);
  outline-offset: 2px;
  border-radius: 10px;
}

/* =========================================================
   EVENT CARDS (VERTICAL + grid)
========================================================= */

.event-grid{
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 768px){
  .event-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
@media (min-width: 1200px){
  .event-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
}

.event-card{
  position: relative;
  overflow: hidden;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: var(--shadow-soft);
  transition: transform .18s ease, box-shadow .18s ease;
}
.event-grid .event-card{ margin: 0 !important; }
.event-card:hover{
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

/* Media */
.event-media{
  position: relative;
  display: block;
  text-decoration: none;
  background: #fff;
  overflow: hidden;
}
.event-img{
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  transition: transform .4s ease;
}
.event-card:hover .event-img{ transform: scale(1.04); }

.event-img--empty{
  background:
    radial-gradient(1000px 300px at 10% 0%, rgba(56,189,248,.16), transparent 60%),
    radial-gradient(700px 240px at 80% 20%, rgba(245,158,11,.14), transparent 60%),
    linear-gradient(135deg, #eafaf1 0%, #f7faf8 55%, #ffffff 100%);
}

/* vignette */
.event-media::after{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(180deg, rgba(2,6,23,.00) 62%, rgba(2,6,23,.14) 100%);
  pointer-events:none;
  z-index: 2;
}

.event-badge{
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  padding: .40rem .66rem;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  color: #0f5132;
  border: 1px solid rgba(16,185,129,.35);
  box-shadow: 0 10px 18px rgba(2,6,23,.14);
  backdrop-filter: blur(10px) saturate(140%);
  font-weight: 900;
  font-size: .86rem;
}

.event-body{ padding: 14px; }

.event-title{
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.event-title a{ display: inline-block; }

.event-meta{
  color: var(--muted);
  font-size: .92rem;
  margin-top: 8px;
}

.org-logo{
  width: 20px;
  height: 20px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid rgba(15,23,42,.12);
  background: #fff;
}

/* Actions */
.event-actions{
  display: grid;
  gap: 10px;
}

/* Share icon buttons */
.share-actions{
  display:flex;
  gap:10px;
  align-items:center;
}

.icon-btn{
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.14);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(8px) saturate(140%);
  box-shadow: 0 10px 18px rgba(2,6,23,.10);
  display:inline-grid;
  place-items:center;
  cursor:pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.icon-btn:hover{
  transform: translateY(-1px);
  border-color: rgba(31,122,79,.35);
  box-shadow: 0 14px 26px rgba(2,6,23,.12);
}
.icon-btn:active{ transform: translateY(0px); }

.icon-btn::before{
  font-size: 16px;
  line-height: 1;
  opacity: .9;
  content: "↗";
}
.icon-btn--copy::before{ content: "⧉"; }
.icon-btn--fb{ border-color: rgba(31,122,79,.18); }
.icon-btn--fb::before{
  content: "f";
  font-weight: 900;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  color: var(--brand);
}

/* Meta pills */
.meta-pill{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: .34rem .56rem;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(15,23,42,.12);
  color: var(--muted);
  font-size: .88rem;
  font-weight: 650;
  text-decoration: none;
  max-width: 100%;
}
.meta-pill::before{
  opacity: .85;
  font-size: 14px;
  line-height: 1;
}
.meta-pill--time::before{ content: "🕒"; }
.meta-pill--loc::before{ content: "📍"; }

.meta-dur{
  color: rgba(15,23,42,.65);
  font-weight: 750;
}

/* Klikkbar lokasjon + hint */
.meta-pill--loclink{ cursor: pointer; }
.meta-pill--loclink .nav-hint{
  margin-left: 6px;
  font-weight: 800;
  font-size: .82em;
  color: rgba(15,23,42,.55);
  white-space: nowrap;
}
.meta-pill--loclink:hover{
  border-color: rgba(31,122,79,.40);
  box-shadow: 0 10px 18px rgba(2,6,23,.08);
}
.meta-pill--loclink:hover .nav-hint{
  color: rgba(31,122,79,.85);
}

/* Kort: adresse + beskrivelse-snutt */
.event-addr{
  margin-top: 6px;
  font-size: .86rem;
  line-height: 1.25;
  opacity: .92;
}
.event-desc{
  margin-top: 9px;
  font-size: .92rem;
  color: rgba(15,23,42,.78);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* =========================================================
   ORG PAGE: Social buttons
========================================================= */

.org-social{
  display:flex;
  gap:10px;
  flex-wrap: wrap;
}
.social-btn{
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.14);
  background: rgba(255,255,255,.85);
  box-shadow: 0 10px 18px rgba(2,6,23,.10);
  display:inline-grid;
  place-items:center;
  text-decoration:none;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.social-btn:hover{
  transform: translateY(-1px);
  border-color: rgba(31,122,79,.35);
  box-shadow: 0 14px 26px rgba(2,6,23,.12);
}
.social-btn::before{
  font-size: 16px;
  line-height: 1;
  opacity: .95;
}
.social-btn--fb::before{ content:"f"; font-weight:900; color: var(--brand); }
.social-btn--ig::before{ content:"⌁"; font-weight:900; }
.social-btn--tt::before{ content:"♪"; }
.social-btn--sc::before{ content:"👻"; }

/* =========================================================
   ACTIVITY PAGE (bildet mindre og penere)
========================================================= */

.activity-layout{
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
@media (min-width: 768px){
  .activity-layout{
    grid-template-columns: 300px 1fr;
    align-items: start;
  }
}

.activity-media{ display: flex; justify-content: center; }

.activity-img{
  width: 100%;
  max-width: 520px;
  height: clamp(160px, 26vw, 220px);
  object-fit: cover;
}
@media (min-width: 768px){
  .activity-img{
    max-width: 300px;
    height: 220px;
  }
}

.activity-desc{
  font-size: 1.02rem;
  line-height: 1.55;
}

/* Om arrangør */
.org-panel{
  margin-top: 10px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.70);
}
.org-panel-title{
  font-weight: 900;
  font-size: .92rem;
  color: rgba(15,23,42,.65);
  margin-bottom: 10px;
}

/* Fix: org-panel overflow på mobil (lange URLer) */
.org-panel .flex-grow-1{ min-width: 0; }

.org-panel a,
.org-panel .text-muted{
  overflow-wrap: anywhere;
  word-break: break-word;
}

.org-panel a{
  display: inline-block;
  max-width: 100%;
}

.org-panel .d-flex{ flex-wrap: wrap; }

@media (max-width: 576px){
  .org-panel .text-end{
    width: 100%;
    text-align: left !important;
    margin-top: 10px;
  }
  .org-panel .text-end .btn{ width: 100%; }
}

/* =========================================================
   ADMIN TABLES: compact + sticky header + sticky actions
========================================================= */

.table-compact td, .table-compact th{ padding: .45rem .6rem; font-size: .92rem; }
.table-compact .text-muted.small{ font-size: .82rem !important; }

.table-sticky-wrap{ overflow:auto; max-width:100%; }
.table-sticky-wrap thead th{ position: sticky; top: 0; z-index: 3; }

.shadow-edge{ box-shadow: -10px 0 18px rgba(2,6,23,.06); }

/* Quick filter bar */
.quickbar{ display:flex; flex-wrap:wrap; gap:.5rem; }
.quickbtn{
  display:inline-flex;
  align-items:center;
  gap:.4rem;
  padding:.38rem .62rem;
  border-radius:999px;
  border:1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.72);
  text-decoration:none;
  font-weight:750;
  font-size:.88rem;
  color: rgba(15,23,42,.72);
}
.quickbtn:hover{ border-color: rgba(31,122,79,.35); box-shadow: 0 10px 18px rgba(2,6,23,.06); }
.quickbtn.is-active{ border-color: rgba(16,185,129,.35); background: rgba(16,185,129,.10); color:#0f5132; }
.quickbtn .dot{ width:.55rem; height:.55rem; border-radius:999px; background: rgba(16,185,129,.85); display:inline-block; }
.quickbtn .dot-warn{ background: rgba(245,158,11,.95); }
.quickbtn .dot-muted{ background: rgba(100,116,139,.9); }
.quickbtn .dot-red{ background: rgba(239,68,68,.95); }

/* (valgfritt) sørg for at knapper ikke “stjeler” z-index over menyen */
.btn-group, .dropdown{ position: relative; }

/* Sticky actions: lavere z-index som standard */
.th-actions, .td-actions{
  position: sticky;
  right: 0;
  z-index: 2;
  background: #fff;
  border-left: 1px solid rgba(15,23,42,.08);
}
.table-light .th-actions{ background: #f8fafc; }

/* Når en rad har åpen dropdown: løft sticky-cellen for den raden */
tr.dropdown-open{ position: relative; z-index: 10; }
tr.dropdown-open .td-actions{ z-index: 2147483646; }

/* Når en dropdown er åpen: senk ALLE sticky actions */
html.has-open-dd .th-actions,
html.has-open-dd .td-actions{
  z-index: 0 !important;
}

/* Løft kun raden som er åpen */
html.has-open-dd tr.dropdown-open{ z-index: 10; }
html.has-open-dd tr.dropdown-open .td-actions{ z-index: 2147483646 !important; }

/* Portal-meny: ALLTID over */
.dropdown-menu.portal-menu{
  position: fixed !important;
  transform: none !important;
  inset: auto !important;
  z-index: 2147483647 !important;
}

/* =========================================================
   ACTIONS MODAL (admin)
========================================================= */

#actionsModal .modal-header{
  border-bottom: 1px solid rgba(15,23,42,.10);
}
#actionsModal .modal-title{ font-weight: 900; }
#actionsModal .badge{ font-weight: 800; }
#actionsModal .modal-body{ padding-top: 14px; }

#actionsModal .list-group-item{ padding: .75rem .95rem; }
#actionsModal .list-group-item-action{ border-radius: 12px; }
#actionsModal .list-group-item-action:hover{ background: rgba(15,23,42,.03); }

/* =========================================================
   NAV ICONS
========================================================= */

.nav-link i{ opacity:.75; font-size: 1rem; }
.nav-link.active i{ opacity:1; }

/* =========================================================
   Passert aktivitet (tabellrader)
========================================================= */

tr.is-past td{ background: rgba(2, 6, 23, .02); }
tr.is-past{ opacity: .72; }
tr.is-past .fw-semibold{ color: rgba(15,23,42,.78); }
tr.is-past .subline{ color: rgba(100,116,139,.95); }
tr.is-past .td-actions{ background: rgba(255,255,255,.92); }

.badge-past{
  display:inline-flex;
  align-items:center;
  padding:.18rem .48rem;
  border-radius:999px;
  border:1px dashed rgba(100,116,139,.45);
  background: rgba(100,116,139,.10);
  color: rgba(100,116,139,.95);
  font-weight:750;
  font-size:.78rem;
}

/* =========================================================
   HELP / BRUKERGUIDE (layout + click-to-zoom + fallback lightbox)
========================================================= */

.help-toc-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}
@media (min-width: 992px){
  .help-toc-grid{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.help-toc-grid a{
  text-decoration:none;
  padding:.48rem .62rem;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(255,255,255,.70);
  font-weight: 800;
  color: rgba(15,23,42,.72);
}
.help-toc-grid a:hover{
  border-color: rgba(31,122,79,.35);
  box-shadow: 0 10px 18px rgba(2,6,23,.06);
}

.help-img{
  border-radius:14px;
  border:1px solid rgba(15,23,42,.10);
  box-shadow: var(--shadow-soft);
}

.help-caption{
  margin-top: 8px;
  color: var(--muted);
  font-size: .90rem;
}

.help-callout{
  background: rgba(255,255,255,.70);
  border:1px solid rgba(15,23,42,.08);
  border-radius: 14px;
  padding: 12px 14px;
}

/* Anti-overflow + mobil fix */
.help-page{ overflow-x: hidden; }
.help-page .row{
  margin-left: 0 !important;
  margin-right: 0 !important;
}
.help-page [class^="col-"],
.help-page [class*=" col-"]{
  min-width: 0 !important;
}
.help-page img,
.help-page .help-img{
  display:block;
  width:100% !important;
  max-width:100% !important;
  height:auto !important;
}
@media (max-width: 576px){
  .help-page .help-img{
    max-width: 420px !important;
    margin-inline: auto !important;
  }
}

/* Zoom hint */
.help-zoom{ cursor: zoom-in; }
.help-zoom:hover{
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  transition: transform .12s ease, box-shadow .12s ease;
}

/* Bootstrap modal-bilde */
.help-zoom-modal-img{
  width: 100%;
  height: auto;
  max-height: calc(100vh - 180px);
  object-fit: contain;
  display: block;
  margin: 0 auto;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.10);
  background: #fff;
}

/* Fallback lightbox (hvis du bruker den i JS) */
.help-lightbox{
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  background: rgba(2,6,23,.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.help-lightbox.is-open{ display:flex; }

.help-lightbox__panel{
  width: min(1100px, 100%);
  max-height: calc(100vh - 28px);
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(15,23,42,.12);
  box-shadow: 0 22px 60px rgba(2,6,23,.35);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.help-lightbox__header,
.help-lightbox__footer{
  padding: 10px 12px;
  display:flex;
  gap:10px;
  align-items:center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(15,23,42,.08);
}
.help-lightbox__footer{
  border-bottom: 0;
  border-top: 1px solid rgba(15,23,42,.08);
}

.help-lightbox__title{ font-weight: 800; }

.help-lightbox__close{
  border: 1px solid rgba(15,23,42,.18);
  background: rgba(15,23,42,.03);
  border-radius: 12px;
  padding: 6px 10px;
  font-weight: 700;
  cursor: pointer;
}

.help-lightbox__body{
  padding: 10px;
  overflow: auto;
}

.help-lightbox__img{
  width: 100%;
  height: auto;
  max-height: calc(100vh - 220px);
  object-fit: contain;
  display:block;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid rgba(15,23,42,.10);
  background:#fff;
}
