/* === HEADER === */
.header-wrapper {
  transform-origin: top center;
  transition: transform 0.3s ease;
}
.header {
  background: white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  width: 100%;
  transition: box-shadow 0.3s ease, backdrop-filter 0.3s ease;
}

.header.scrolled {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.95);
}
.header-container {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.content-wrapper {
  width: 90%;
  max-width: 1200px;
  margin: auto;
  display: flex;
  flex-direction: column;
}

/* === Övre blå del === */
.top-wrapper {
  background: linear-gradient(90deg, #f3f3f3, #f3f3f3);
  padding: 0 1rem;
  height: 100px;
  border-radius: 6px 6px 0 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
}

/* === Logotyp === */
.logo {
  margin-left: clamp(0rem, -10vw, -10rem);
}
.logo img {
  position: relative;
  top: -40px;
  width: clamp(200px, 28vw, 380px);
  height: auto;
  max-height: 220px;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.15);
  display: block;
  -webkit-mask-image: linear-gradient(to right, transparent 0.5%, black 5%, black 95%, transparent 99.5%);
  mask-image: linear-gradient(to right, transparent 0.5%, black 5%, black 95%, transparent 99.5%);
}
.logo-main {
  color: white;
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}
.logo-sub {
  color: #ffcc00;
  font-weight: 500;
  margin-left: 0.2rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 10;
  position: relative;
  transform: translateY(-50px);
}

.search-box input {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  width: 250px;
  transition: border-color 0.3s ease;
  background-color: white;
  color: #333;
  box-sizing: border-box;
}
.search-box input:focus {
  border: 1px solid #0055aa;
  outline: none;
}
.contact-button {
  padding: 0.5rem 1rem;
  background-color: white;
  color: #0055aa;
  text-decoration: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Segoe UI', sans-serif;
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
  white-space: nowrap;
  box-shadow: 0 0 0 rgba(0, 85, 170, 0);
}
.contact-button:hover {
  background-color: #cce0ff;
  box-shadow: 0 4px 12px rgba(0, 85, 170, 0.3);
}
.cart-button {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease;
}

.cart-button:hover {
  transform: scale(1.1);
}

/* === MODELLMENY === */
.models-nav {
  background-color: white;
  width: 100%;
  border-top: 1px solid #eee;
  padding: 1rem 0;
  position: relative;
  display: flex;
  justify-content: center;
  z-index: 1;
}
.models-wrapper {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  flex-direction: row;
  width: 100%;
  max-width: 1200px;
}
.dropdown {
  position: relative;
  display: inline-flex;
  flex-direction: column;
}
.dropbtn {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0.25rem 0;
  white-space: nowrap;
  transition: color 0.3s ease;
  position: relative;
  z-index: 1010;
}
.dropbtn::after {
  content: "▼";
  font-size: 0.6rem;
  margin-left: 0.3rem;
  transition: transform 0.3s ease;
  display: inline-block;
  color: #555;
}
.dropdown:hover > .dropbtn::after,
.dropdown.active > .dropbtn::after {
  transform: rotate(180deg);
  color: #0055aa;
}
.dropbtn:hover,
.dropdown:hover > .dropbtn {
  color: #0055aa;
}
.dropdown-content {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background-color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  min-width: 180px;
  margin-top: 0.2rem;
  z-index: 1000;
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
  animation-fill-mode: forwards;
}
@keyframes dropdownFadeSlideDown {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}
.dropdown:hover .dropdown-content,
.dropdown.active .dropdown-content {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  animation: dropdownFadeSlideDown 0.3s ease forwards;
}
.dropdown-content::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 10px;
  pointer-events: auto;
}
.dropdown-content a {
  color: #333;
  padding: 0.75rem 1.5rem;
  text-decoration: none;
  display: block;
  transition: background-color 0.3s ease;
  user-select: none;
}
.dropdown-content a:hover {
  background-color: #f0f4ff;
}
.models-toggle-btn {
  display: none;
}

/* === MOBILANPASSNING === */
@media (max-width: 768px) {
  /* Make header static (non-sticky) in mobile */
  .header {
    position: static;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  }
  
  .top-wrapper {
    height: auto;
    padding: 0.5rem 1rem 0.3rem 1rem;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
  }
  .top-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    width: 100%;
  }
  .logo {
    margin-left: 0;
    margin-bottom: 0;
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .logo img {
    top: 0;
    width: 200px;
    max-height: none;
  }
  .top-actions {
    transform: translateY(0);
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
  }
  
  /* Search gets its own full-width row */
  .search-box {
    order: 1;
    flex-basis: 100%;
    width: 100%;
  }
  .search-box input {
    width: 100%;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
  }
  
  /* Language toggle gets centered above search */
  .language-toggle {
    order: 0;
    flex-basis: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 0.2rem;
  }
  
  /* Contact button, and cart share the row below search */
  .contact-button {
    order: 2;
    flex: 1;
    text-align: center;
    padding: 0.5rem 0.8rem;
    font-size: 0.9rem;
    white-space: nowrap;
  }
  .cart-button {
    order: 3;
    flex: 0 0 auto;
    font-size: 1.2rem;
  }
  .models-toggle-btn {
    display: block;
    background: linear-gradient(135deg, #003366, #0055aa);
    color: white;
    border: none;
    padding: 0.6rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    margin: 0.3rem 1rem 0.5rem 1rem; /* Match top-wrapper padding exactly */
    width: calc(100% - 2rem); /* Account for 1rem margins on both sides */
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 51, 102, 0.2);
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
  }
  
  .models-toggle-btn:hover {
    background: linear-gradient(135deg, #0055aa, #0077cc);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 51, 102, 0.3);
  }
  
  .models-toggle-btn:active {
    transform: translateY(0);
  }
  .models-nav {
    display: none;
    overflow-x: auto;
    white-space: nowrap;
    border-top: 1px solid #eee;
    padding: 0.5rem 1rem; /* Match side padding with top section */
  }
  .models-nav.active {
    display: flex;
  }
  .models-wrapper {
    flex-wrap: nowrap;
    gap: 1rem;
    justify-content: flex-start;
  }
  .dropdown {
    display: inline-flex;
    flex-direction: column;
    min-width: 140px;
  }
  .dropdown-content {
    display: none;
    position: static !important;
    box-shadow: none;
    min-width: 0;
    max-width: 100vw;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: visible;
    padding: 0.5rem 1rem;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    border-radius: 0;
    margin-top: 0;
    touch-action: pan-y;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
  .dropdown.active > .dropdown-content {
    display: block;
  }
}


/* === MELLANLÄGE: Visa dropdown som i mobilläge === */
@media (min-width: 769px) and (max-width: 1200px) {
  .models-nav {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    border-top: 1px solid #eee;
    padding: 0.5rem 0;
    padding-left: 0;  /* Viktigt att ta bort vänster-padding */
    margin-left: 0;   /* Ta bort eventuell margin */
    scroll-padding-left: 0; /* Säkerställ scrollstart */
    justify-content: flex-start; /* Se till att innehållet börjar från vänster */
  }

  .models-wrapper {
    display: flex;
    flex-wrap: nowrap;
    gap: 1rem;
    justify-content: flex-start;
    width: auto;
    padding-left: 0;
    margin-left: 0;
  }

  .dropdown {
    display: inline-flex;
    flex-direction: column;
    min-width: 140px;
    flex-shrink: 0;
    position: relative;
  }

  .dropdown-content {
    display: none;
    position: static !important;
    box-shadow: none;
    background-color: white;
    padding: 0.5rem 1rem;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
    border-radius: 0;
    margin-top: 0;
    max-width: 100vw;
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: visible;
  }

  .dropdown.active > .dropdown-content {
    display: block;
  }
}

.models-wrapper::-webkit-scrollbar {
  height: 6px;
}
.models-wrapper::-webkit-scrollbar-thumb {
  background-color: #0055aa;
  border-radius: 3px;
}

/* === FLEXFIX FÖR .top-actions i mellanläge === */
@media (min-width: 769px) and (max-width: 1200px) {
  .top-row {
    flex-wrap: nowrap;
  }
  .top-actions {
    flex-wrap: nowrap;
    gap: 1rem;
    width: auto;
    max-width: 100%;
    overflow: visible;
  }
  .cart-button {
    flex: 0 0 auto;
  }
  .search-box {
    flex: 1 1 180px;
    min-width: 80px;
    max-width: 400px;
    display: flex;
  }
  .search-box input {
    flex: 1 1 180px;
    min-width: 80px;
    max-width: 400px;
    width: 100%;
  }
  .contact-button {
    flex: 0 0 auto;
    min-width: 100px;
    max-width: 220px;
    width: auto;
    white-space: nowrap;
  }
}