/* ── Reset & Base ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --clr-primary: #1B365D;
  --clr-accent:  #E8453C;
  --clr-bg:      #F5F5F5;
  --clr-white:   #FFFFFF;
  --clr-text:    #333333;
  --clr-muted:   #777777;
  --clr-border:  #E0E0E0;
  --clr-sold:    #999999;
  --radius:      8px;
  --shadow:      0 2px 8px rgba(0,0,0,.08);
  --max-w:       1200px;
  --header-h:    70px;
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--clr-text);
  background: var(--clr-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 1rem; width: 100%; }

/* ── Header ───────────────────────────────────────── */
.site-header {
  background: var(--clr-white);
  border-bottom: 2px solid var(--clr-primary);
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  height: 100%;
}
.logo { display: flex; align-items: center; gap: .5rem; font-size: 1.5rem; font-weight: 800; color: var(--clr-primary); }
.logo span.accent { color: var(--clr-accent); }

.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a {
  font-weight: 500; color: var(--clr-text); padding: .25rem 0;
  border-bottom: 2px solid transparent; transition: border-color .2s;
}
.nav-links a:hover,
.nav-links a.active { border-color: var(--clr-accent); text-decoration: none; color: var(--clr-primary); }

.hamburger {
  display: none; background: none; border: none; cursor: pointer;
  flex-direction: column; gap: 5px; padding: .5rem;
}
.hamburger span { display: block; width: 24px; height: 2px; background: var(--clr-primary); transition: .3s; }

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .nav-links {
    display: none; flex-direction: column; position: absolute;
    top: var(--header-h); left: 0; right: 0; background: var(--clr-white);
    padding: 1rem; border-bottom: 2px solid var(--clr-primary);
    gap: .5rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .5rem 0; }
}

/* ── Hero ─────────────────────────────────────────── */
.hero {
  position: relative;
  color: var(--clr-white); text-align: center;
  padding: 6rem 1rem;
  background: url('/images/outside-road-view-of-dealership.JPG') center/cover no-repeat;
  min-height: 420px;
  display: flex; align-items: center; justify-content: center;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(27,54,93,.75) 0%, rgba(42,74,127,.65) 100%);
  z-index: 1;
}
.hero .container { position: relative; z-index: 2; }
.hero h1 { font-size: 2.75rem; margin-bottom: .75rem; text-shadow: 0 2px 8px rgba(0,0,0,.3); }
.hero p  { font-size: 1.2rem; opacity: .95; max-width: 600px; margin: 0 auto 1.5rem; text-shadow: 0 1px 4px rgba(0,0,0,.2); }

/* ── Image row (Forside Om section) ───────────────── */
.image-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem;
  margin-bottom: 2rem;
}
.image-row figure { margin: 0; }
.image-row img {
  width: 100%; height: 220px; object-fit: cover;
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.image-row figcaption {
  text-align: center; font-size: .85rem; color: var(--clr-muted);
  margin-top: .5rem; font-style: italic;
}
@media (max-width: 600px) {
  .image-row { grid-template-columns: 1fr; }
  .image-row img { height: 200px; }
}

/* ── Photo grid (Om os) ──────────────────────────────── */
.masonry-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
.masonry-gallery figure {
  margin: 0;
}
.masonry-gallery img {
  width: 100%; height: 220px; object-fit: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow); display: block;
}
.masonry-gallery figcaption {
  text-align: center; font-size: .8rem; color: var(--clr-muted);
  margin-top: .35rem; font-style: italic;
}
@media (max-width: 900px) { .masonry-gallery { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .masonry-gallery { grid-template-columns: 1fr; } }

/* ── Buttons ──────────────────────────────────────── */
.btn {
  display: inline-block; padding: .75rem 1.75rem; border-radius: var(--radius);
  font-weight: 600; font-size: 1rem; cursor: pointer; border: none;
  transition: background .2s, transform .1s; text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary  { background: var(--clr-accent); color: var(--clr-white); }
.btn-primary:hover { background: #d03a32; }
.btn-outline  { background: transparent; color: var(--clr-white); border: 2px solid var(--clr-white); }
.btn-outline:hover { background: rgba(255,255,255,.15); }
.btn-secondary { background: var(--clr-primary); color: var(--clr-white); }
.btn-secondary:hover { background: #152b4d; }
.btn-small { padding: .4rem 1rem; font-size: .85rem; }
.btn-danger { background: #dc3545; color: var(--clr-white); }
.btn-danger:hover { background: #b02a37; }

/* ── Section headings ─────────────────────────────── */
.section { padding: 3rem 0; }
.section-title {
  font-size: 1.75rem; text-align: center; margin-bottom: 2rem;
  color: var(--clr-primary); position: relative;
}
.section-title::after {
  content: ''; display: block; width: 60px; height: 3px;
  background: var(--clr-accent); margin: .5rem auto 0;
}

/* ── Car grid ─────────────────────────────────────── */
.car-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.5rem;
}

.car-card {
  background: var(--clr-white); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.car-card:hover { transform: translateY(-4px); box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.car-card a { color: inherit; text-decoration: none; }

.car-card-img {
  width: 100%; height: 200px; object-fit: cover;
  background: var(--clr-border);
}

.car-card-body { padding: 1rem; }
.car-card-title { font-size: 1.1rem; font-weight: 700; margin-bottom: .25rem; color: var(--clr-primary); }
.car-card-subtitle { font-size: .85rem; color: var(--clr-muted); margin-bottom: .75rem; }

.car-card-specs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.car-card-specs .spec {
  font-size: .75rem; background: var(--clr-bg); padding: .2rem .5rem;
  border-radius: 4px; color: var(--clr-muted);
}

.car-card-price { font-size: 1.25rem; font-weight: 800; color: var(--clr-accent); }
.car-card-price small { font-size: .75rem; font-weight: 400; color: var(--clr-muted); }

/* ── CTA banner ───────────────────────────────────── */
.cta-center { text-align: center; padding: 2rem 0; }

/* ── Car detail ───────────────────────────────────── */
.detail-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 2rem;
  padding: 2rem 0; align-items: start;
}
@media (max-width: 768px) {
  .detail-layout { grid-template-columns: 1fr; }
}

.detail-gallery {}
.detail-main-img {
  width: 100%; height: 350px; object-fit: cover;
  border-radius: var(--radius); background: var(--clr-border);
}
.detail-thumbs {
  display: flex; gap: .5rem; margin-top: .5rem; overflow-x: auto;
}
.detail-thumbs img {
  width: 80px; height: 60px; object-fit: cover; border-radius: 4px;
  cursor: pointer; border: 2px solid transparent; transition: border-color .2s;
  flex-shrink: 0;
}
.detail-thumbs img.active,
.detail-thumbs img:hover { border-color: var(--clr-accent); }

.detail-info {}
.detail-info h1 { font-size: 1.75rem; color: var(--clr-primary); margin-bottom: .5rem; }
.detail-price { font-size: 1.5rem; font-weight: 800; color: var(--clr-accent); margin-bottom: 1.5rem; }

.specs-table { width: 100%; border-collapse: collapse; margin-bottom: 1.5rem; }
.specs-table tr { border-bottom: 1px solid var(--clr-border); }
.specs-table td { padding: .6rem .5rem; }
.specs-table td:first-child { font-weight: 600; color: var(--clr-primary); width: 40%; }

.detail-description { margin-bottom: 1.5rem; line-height: 1.7; }

/* ── About section (Forside) ─────────────────────── */
.about-preview {
  background: var(--clr-white); border-radius: var(--radius);
  padding: 2rem; box-shadow: var(--shadow); max-width: 800px; margin: 0 auto;
  text-align: center;
}
.about-preview p { margin-bottom: 1rem; color: var(--clr-muted); }

/* ── Text pages (Om os, etc.) ─────────────────────── */
.text-page { background: var(--clr-white); border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); margin: 2rem auto; max-width: 800px; }
.text-page h1 { font-size: 1.75rem; color: var(--clr-primary); margin-bottom: 1rem; }
.text-page h2 { font-size: 1.25rem; color: var(--clr-primary); margin-top: 1.5rem; margin-bottom: .5rem; }
.text-page p  { margin-bottom: 1rem; }
.text-page ul { list-style: disc; margin-left: 1.5rem; margin-bottom: 1rem; }
.text-page li { margin-bottom: .25rem; }
.text-page a { color: var(--clr-accent); }

/* ── Contact ──────────────────────────────────────── */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
@media (max-width: 600px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-block h3 { color: var(--clr-primary); margin-bottom: .5rem; }
.contact-block p { margin-bottom: .5rem; }

/* ── Footer ───────────────────────────────────────── */
.site-footer {
  background: var(--clr-primary); color: rgba(255,255,255,.8);
  padding: 2rem 0; margin-top: auto; font-size: .9rem;
}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; }
.footer-col h4 { color: var(--clr-white); margin-bottom: .5rem; font-size: 1rem; }
.footer-col a { color: rgba(255,255,255,.7); display: block; margin-bottom: .25rem; }
.footer-col a:hover { color: var(--clr-white); }
.footer-bottom { text-align: center; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.15); font-size: .8rem; }

/* ── Admin ────────────────────────────────────────── */
.admin-bar { background: var(--clr-primary); color: var(--clr-white); padding: .5rem 1rem; text-align: right; font-size: .85rem; }
.admin-bar a { color: rgba(255,255,255,.8); margin-left: 1rem; }
.admin-bar a:hover { color: var(--clr-white); }

.login-card {
  background: var(--clr-white); max-width: 400px; margin: 4rem auto;
  padding: 2rem; border-radius: var(--radius); box-shadow: var(--shadow);
}
.login-card h1 { text-align: center; color: var(--clr-primary); margin-bottom: 1.5rem; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: .25rem; font-size: .9rem; }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--clr-border);
  border-radius: var(--radius); font-size: .95rem; font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--clr-primary); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.alert-error { background: #fde8e8; color: #c53030; border: 1px solid #feb2b2; }
.alert-success { background: #e6ffed; color: #22543d; border: 1px solid #9ae6b4; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--clr-white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.admin-table th { background: var(--clr-primary); color: var(--clr-white); padding: .75rem; text-align: left; font-size: .85rem; }
.admin-table td { padding: .75rem; border-bottom: 1px solid var(--clr-border); font-size: .9rem; }
.admin-table tr:hover { background: var(--clr-bg); }
.admin-table img { width: 60px; height: 45px; object-fit: cover; border-radius: 4px; }

.admin-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.admin-header h1 { font-size: 1.5rem; color: var(--clr-primary); }

.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--clr-white); border-radius: var(--radius); padding: 2rem;
  max-width: 700px; width: 95%; max-height: 90vh; overflow-y: auto;
}
.modal h2 { color: var(--clr-primary); margin-bottom: 1rem; }
.modal-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ── Loading & Empty states ───────────────────────── */
.loading { text-align: center; padding: 3rem; color: var(--clr-muted); }
.empty   { text-align: center; padding: 3rem; color: var(--clr-muted); }

/* ── Utility ──────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
