/* =========================================================
   Bivuakk - grunnleggende stil
   Fargene under er en midlertidig fargeprofil.
   Bytt ut verdiene i :root når dere har logo/fargeprofil klar.
   ========================================================= */

:root {
  /* Hentet fra Bivuakk-logoen */
  --color-primary: #232321;      /* mørk antrasitt (logo-bakgrunn) */
  --color-primary-dark: #191917;
  --color-accent: #fea500;       /* Bivuakk-oransje */
  --color-accent-dark: #d98c00;
  --color-bg: #f6f5f3;           /* lys, nøytral bakgrunn */
  --color-surface: #ffffff;
  --color-text: #201f1d;
  --color-text-muted: #6b6863;
  --color-border: #e5e2dc;
  --color-success-bg: #e5f3e6;
  --color-success-text: #2b5c30;
  --color-error-bg: #fbe6e2;
  --color-error-text: #9c3620;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(20, 20, 18, 0.08);
  --shadow-hover: 0 6px 20px rgba(20, 20, 18, 0.16);
  --max-width: 1140px;
  --font-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
  font-family: var(--font-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  line-height: 1.2;
  margin: 0 0 0.6em;
  font-weight: 700;
}

h1 { font-size: clamp(1.8rem, 3vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); }

p { margin: 0 0 1em; color: var(--color-text-muted); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container.narrow { max-width: 760px; }

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--color-primary);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1.25rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
}

.logo-img {
  height: 42px;
  width: auto;
  border-radius: 6px;
  display: block;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--color-accent);
  color: var(--color-primary-dark);
  font-weight: 800;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.6rem;
}

.main-nav a {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  padding: 0.4rem 0;
  border-bottom: 2px solid transparent;
}

.main-nav a:hover,
.main-nav a.active {
  color: #fff;
  border-bottom-color: var(--color-accent);
}

.main-nav a.btn-nav {
  border: none;
  background: var(--color-accent);
  color: var(--color-primary-dark);
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
}

.main-nav a.btn-nav:hover,
.main-nav a.btn-nav.active { background: var(--color-accent-dark); color: var(--color-primary-dark); border-bottom-color: transparent; }

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--color-primary-dark);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  margin-left: 0.3rem;
}

/* ---------- Handlekurv ---------- */
.cart-table { width: 100%; border-collapse: collapse; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.cart-table th, .cart-table td { text-align: left; padding: 0.9rem 1rem; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.cart-table tr:last-child td { border-bottom: none; }
.cart-product { display: flex; align-items: center; gap: 0.9rem; }
.cart-product img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--color-border); }
.cart-product-placeholder { width: 64px; height: 64px; border-radius: 8px; background: var(--color-border); flex-shrink: 0; }
.cart-qty-form { display: flex; align-items: center; gap: 0.4rem; margin: 0; }
.cart-qty-form input[type="number"] { width: 60px; padding: 0.4rem 0.5rem; border: 1px solid var(--color-border); border-radius: 6px; font-family: inherit; }
.cart-summary { display: flex; justify-content: flex-end; padding: 1.2rem 1rem; font-size: 1.15rem; font-weight: 800; }
.cart-summary span { color: var(--color-primary); margin-left: 0.5rem; }
.cart-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2.5rem; align-items: start; margin-top: 2rem; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.4rem;
}
.nav-toggle span {
  width: 24px;
  height: 2px;
  background: #fff;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  text-align: center;
}

.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-dark); color: #fff; }

.btn-outline { background: transparent; border-color: var(--color-primary); color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary); color: #fff; }

.btn-outline-light { background: transparent; border-color: #fff; color: #fff; }
.btn-outline-light:hover { background: #fff; color: var(--color-primary); }

.btn-small { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-danger { background: var(--color-error-text); color: #fff; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  padding: 5rem 0;
}

.hero-inner { max-width: 700px; }
.hero h1 { color: #fff; }
.hero-tagline { color: rgba(255,255,255,0.88); font-size: 1.15rem; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* ---------- Sections ---------- */
.section { padding: 3.5rem 0; }
.section-alt { background: var(--color-surface); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.section-lead { font-size: 1.1rem; }

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.section-cta { background: var(--color-primary); color: #fff; }
.cta-inner { text-align: center; }
.section-cta h2 { color: #fff; }

.link-arrow { font-weight: 700; color: var(--color-primary); }
.link-back { display: inline-block; margin-bottom: 1.5rem; font-weight: 600; color: var(--color-primary); }

/* ---------- Cards / grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }

.card-image { position: relative; aspect-ratio: 4 / 3; background: var(--color-border); overflow: hidden; }
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.card-image-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  background: repeating-linear-gradient(45deg, #eee, #eee 10px, #f5f5f0 10px, #f5f5f0 20px);
}

.card-body { padding: 1rem 1.1rem 1.2rem; }
.card-body h3 { font-size: 1.05rem; margin-bottom: 0.3rem; }
.card-meta { font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 0.2rem; }
.card-price { font-weight: 800; color: var(--color-primary); margin: 0; }

.badge {
  position: absolute; top: 0.6rem; right: 0.6rem;
  padding: 0.25rem 0.6rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; color: #fff;
}
.badge-sold { background: var(--color-error-text); }

/* ---------- Filters ---------- */
.filter-bar { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1.8rem; }
.filter-chip {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-muted);
  background: var(--color-surface);
}
.filter-chip:hover { border-color: var(--color-primary); }
.filter-chip.active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.empty-state { color: var(--color-text-muted); padding: 2rem 0; text-align: center; }

/* ---------- Detail pages ---------- */
.detail-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.detail-main-image {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-border);
  aspect-ratio: 4 / 3;
}
.detail-main-image img { width: 100%; height: 100%; object-fit: cover; }

.detail-thumbs { display: flex; gap: 0.6rem; margin-top: 0.8rem; flex-wrap: wrap; }
.thumb-btn {
  width: 70px; height: 70px; border-radius: 6px; overflow: hidden;
  border: 2px solid var(--color-border); padding: 0; cursor: pointer; background: none;
}
.thumb-btn img { width: 100%; height: 100%; object-fit: cover; }

.detail-price { font-size: 1.6rem; font-weight: 800; color: var(--color-primary); }
.detail-description { white-space: pre-line; }

.contact-info { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.5rem; }

/* ---------- Forms ---------- */
.contact-form, .admin-form { max-width: 560px; }
.form-row { margin-bottom: 1.1rem; }
.form-row label { display: block; font-weight: 700; margin-bottom: 0.35rem; font-size: 0.92rem; }
.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="tel"],
.form-row input[type="password"],
.form-row input[type="number"],
.form-row input[type="date"],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
  background: var(--color-surface);
  color: var(--color-text);
}
.form-row textarea { resize: vertical; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}
.form-hint { font-size: 0.8rem; color: var(--color-text-muted); margin-top: 0.3rem; }
.hp-field { position: absolute; left: -9999px; top: -9999px; }
.form-actions { display: flex; gap: 0.8rem; margin-top: 1.5rem; }

/* ---------- Flash messages ---------- */
.flash { padding: 0.9rem 1.1rem; border-radius: var(--radius); margin-bottom: 1.2rem; }
.flash p { margin: 0; }
.flash-success { background: var(--color-success-bg); color: var(--color-success-text); }
.flash-error { background: var(--color-error-bg); color: var(--color-error-text); }

/* ---------- Footer ---------- */
.site-footer { background: var(--color-primary-dark); color: rgba(255,255,255,0.85); margin-top: 3rem; }
.footer-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  padding: 3rem 1.25rem;
}
.site-footer .logo { color: #fff; }
.site-footer h3 { color: #fff; font-size: 1rem; }
.site-footer a:hover { color: var(--color-accent); }
.site-footer p { color: rgba(255,255,255,0.75); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.15); padding: 1rem 0; text-align: center; font-size: 0.85rem; }

/* ---------- Page header ---------- */
.page-header { padding: 2.5rem 0 1rem; }

/* ---------- Admin ---------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: var(--color-primary-dark);
  color: #fff;
  padding: 1.5rem 1.2rem;
  display: flex;
  flex-direction: column;
}
.admin-logo { color: #fff; margin-bottom: 2rem; }
.admin-nav { display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.admin-nav a { padding: 0.6rem 0.7rem; border-radius: 6px; color: rgba(255,255,255,0.8); font-weight: 600; }
.admin-nav a:hover { background: rgba(255,255,255,0.08); }
.admin-nav a.active { background: var(--color-accent); color: #fff; }
.admin-sidebar-footer { border-top: 1px solid rgba(255,255,255,0.15); padding-top: 1rem; font-size: 0.85rem; }
.admin-sidebar-footer p { color: rgba(255,255,255,0.7); margin-bottom: 0.6rem; }
.admin-sidebar-footer a { display: block; margin-bottom: 0.8rem; color: rgba(255,255,255,0.85); }
.admin-sidebar-footer form { margin: 0; }

.admin-main { flex: 1; padding: 2rem 2.5rem; max-width: 1000px; }
.admin-topbar { margin-bottom: 1.2rem; }

.admin-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-dark);
  padding: 1.5rem;
}
.admin-login-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: 2.2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-hover);
}
.admin-login-card .logo { justify-content: center; margin-bottom: 1.5rem; color: var(--color-primary); }

.table-wrap { overflow-x: auto; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
table.admin-table { width: 100%; border-collapse: collapse; }
table.admin-table th, table.admin-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.92rem;
  vertical-align: middle;
}
table.admin-table th { color: var(--color-text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
table.admin-table tr:last-child td { border-bottom: none; }
table.admin-table img.thumb { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.row-actions { display: flex; gap: 0.6rem; }
.row-actions form { margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.2rem; margin-bottom: 2rem; }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.3rem; }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; color: var(--color-primary); }
.stat-card .stat-label { color: var(--color-text-muted); font-size: 0.9rem; }

.admin-image-grid { display: flex; gap: 0.8rem; flex-wrap: wrap; margin: 1rem 0 1.5rem; }
.admin-image-item { position: relative; width: 100px; }
.admin-image-item img { width: 100px; height: 100px; object-fit: cover; border-radius: 8px; border: 1px solid var(--color-border); }
.admin-image-item form { position: absolute; top: -8px; right: -8px; margin: 0; }
.admin-image-item button { width: 24px; height: 24px; border-radius: 50%; border: none; background: var(--color-error-text); color: #fff; cursor: pointer; font-size: 0.8rem; line-height: 1; }

.badge-status { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }
.badge-available { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-unread { background: var(--color-accent); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .detail-layout, .contact-form + .contact-info { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; }
  .admin-shell { flex-direction: column; }
  .admin-sidebar { width: 100%; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-sidebar-footer { display: none; }
  .admin-main { padding: 1.5rem; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .main-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--color-primary);
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    display: none;
    gap: 0.8rem;
  }
  .main-nav.open { display: flex; }
  .header-inner { position: relative; }
}
