/* Coastkey design tokens */
.coastkey-shortcode {
  --coastkey-blue: #21263C;
  --coastkey-orange: #F26531;
  --coastkey-white: #F7F5EE;
  font-family: 'DM Sans', sans-serif;
  display: flex;
  flex-direction: row;
  min-width: 100%;
  gap: 20px;
  color: #21263C;
}

.coastkey-main{
  flex: 0.75;
  display: flex;
  flex-direction: column;
}


.coastkey-item.product-cat-coastkey.btn {
  display: inline-block;
  padding: 1rem 2rem;
  border: 1px solid #ddd;
  cursor: pointer;
  border-radius: .5rem;
}
.coastkey-item.product-cat-coastkey.btn.highlight {
  outline: 2px solid var(--coastkey-orange);
}

.coastkey-item.product-cat-coastkey.btn p{
  margin: 0;
  font-weight: 600;
}

.coastkey-item.product-cat-coastkey.btn span{
  font-weight: 500;
  font-style: italic;
  white-space: nowrap;
}

.coastkey-item.product-cat-coastkey.btn.selected {
  border-color: var(--coastkey-orange);
  outline: 2px solid var(--coastkey-orange);
}

/* "fra"-pris på produkttype-knappene */
.coastkey-item.product-cat-coastkey.btn span.coastkey-item-price {
  display: block;
  font-style: normal;
  font-weight: 600;
  font-size: 13px;
  margin-top: 0.25rem;
  color: inherit;
}
.coastkey-item.product-cat-coastkey.btn span.coastkey-item-price .woocommerce-Price-amount {
  font-size: inherit;
}
.coastkey-filters select.highlight{
  outline: 2px solid var(--coastkey-orange);
}
.coastkey-filters select:valid{
  border-color: var(--coastkey-orange);
  outline: 2px solid var(--coastkey-orange);
}

.coastkey-item.product-cat-coastkey.btn:hover {
  background-color: #ededed;
}

.coastkey-selects {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.coastkey-select-wrapper {
  position: relative;
}

/* Hide native select when custom dropdown is active (options list cannot be styled with font) */
.coastkey-select-wrapper.has-custom-dropdown select {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.coastkey-product-options{
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.coastkey-shortcode label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.coastkey-select-wrapper select {
  font-family: 'DM Sans', sans-serif;
  width: 100%;
  padding-left: 2rem;
  color: var(--coastkey-blue);
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: .5rem;
  box-shadow: none;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* Feather icon: chevron-down */
  background: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%2321263C" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3E%3Cpolyline points="6 9 12 15 18 9"%3E%3C/polyline%3E%3C/svg%3E') no-repeat right 20px center;
  background-size: 24px 24px;
}
.coastkey-select-wrapper select:hover {
  background-color: #ededed;
}

/* Custom dropdown (so option list uses DM Sans) */
.coastkey-custom-select {
  position: relative;
  width: 100%;
}
.coastkey-custom-select-trigger {
  font-family: 'DM Sans', sans-serif;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.6rem 2.75rem 0.6rem 1rem;
  font-size: 1rem;
  color: var(--coastkey-blue);
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: .5rem;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
}
.coastkey-custom-select-trigger:hover {
  background-color: #ededed;
}
.coastkey-select-wrapper.has-custom-dropdown .coastkey-custom-select-trigger.is-valid {
  border-color: var(--coastkey-orange);
  outline: 2px solid var(--coastkey-orange);
}
.coastkey-custom-select-trigger .coastkey-custom-select-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coastkey-custom-select-trigger svg {
  flex-shrink: 0;
  margin-left: 0.5rem;
  stroke: var(--coastkey-blue);
  transition: transform 0.2s ease;
}
.coastkey-custom-select.is-open .coastkey-custom-select-trigger svg {
  transform: rotate(180deg);
}
.coastkey-custom-select-list {
  font-family: 'DM Sans', sans-serif;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: .5rem;
  box-shadow: 0 4px 12px rgba(33, 38, 60, 0.15);
  max-height: 220px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}
.coastkey-custom-select.is-open .coastkey-custom-select-list {
  display: block;
}
.coastkey-custom-select-list li {
  padding: 0.6rem 1rem;
  font-size: 1rem;
  color: var(--coastkey-blue);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.coastkey-custom-select-list li:hover,
.coastkey-custom-select-list li[aria-selected="true"] {
  background-color: rgba(242, 101, 49, 0.1);
}
.coastkey-custom-select-list li:first-child {
  border-radius: .4rem .4rem 0 0;
}
.coastkey-custom-select-list li:last-child {
  border-radius: 0 0 .4rem .4rem;
}

.coastkey-select-wrapper.variant-hidden {
  display: none;
}

.coastkey-result {
  margin-top: 1rem;
  position: fixed;
  bottom: 0;
  background-color: var(--coastkey-orange);
  color: var(--coastkey-white);
  width: 100%;
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease-in-out;
  align-items: center;
}

.coastkey-result-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1;
  gap: 1rem;
  padding: 1rem 2rem 1.5rem;
  max-width: 1248px;
}

.coastkey-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center; 
  gap: 2rem;
}

.coastkey-result-row .item{
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  justify-content: space-between;
}

.coastkey-result-row .actions{
  display: flex;
  align-items: center;
  gap: 1rem;
}

.coastkey-result-row .actions a, .coastkey-result-row .actions button {
  border: 2px solid var(--coastkey-white);
  border-radius: .5rem;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  line-height: 1.5;
  text-decoration: none !important;
}
.coastkey-result-row .actions button, .coastkey-result-row .actions a.added_to_cart{
  background-color: var(--coastkey-white);
  color: var(--coastkey-orange);
}
.coastkey-result-row .actions button:hover, .coastkey-result-row .actions a.added_to_cart:hover{
  background-color: var(--coastkey-orange);
  color: var(--coastkey-white);
}
.coastkey-result-row .actions a{
  background-color: var(--coastkey-orange);
  color: var(--coastkey-white);
}
.coastkey-result-row .actions a:hover{
  background-color: var(--coastkey-white);
  color: var(--coastkey-orange);
}

.coastkey-result-row .actions a.added_to_cart{
  display: none;
}
.coastkey-result-row .actions p{
  border-radius: .5rem;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  line-height: 1.5;
  text-decoration: none !important;
  flex: 1;
  margin: 0;
  border: 0;
}

.coastkey-result-inner {
  display: flex;
  flex-direction: column;
}

/* Divider between rows */
.coastkey-divider {
  min-height: 1px;
  height: 1px;
  background-color: rgba(247, 245, 238, 0.3);
  width: 100%;
}

.coastkey-result-inner a.added_to_cart{
  margin-top: 0;
}


.coastkey-result-inner button:hover {
  background-color: #f0f0f0; /* Slight hover effect */
}

/* Adjust font sizes and styles for better readability */
.coastkey-result-inner p {
  margin: 0 !important;
  font-size: 14px;
  font-weight: bold;
}

.coastkey-result-inner span {
  margin: 0;
  font-size: 14px;
}

.coastkey-result-close {
  color: var(--coastkey-white);
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 1rem;
  border-bottom: 1px solid rgba(247, 245, 238, 0.3);
}
.coastkey-result-close:hover {
  background: rgba(247, 245, 238, 0.175);
}
.coastkey-result-close:hover svg {
  transform: rotate(180deg);
}
.coastkey-result-close[data-state="closed"] svg{
  transform: rotate(180deg);
}
.coastkey-result-close[data-state="closed"]:hover svg{
  transform: rotate(0deg);
}

.coastkey-result-empty {
  bottom: -100%;
}

.coastkey-filters {
  display: flex;
  flex-direction: column;
  flex:0.25;
  gap: 1rem;
}

.coastkey-images {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(3,1fr);
  background: var(--coastkey-white);
  align-items: center;
  padding: 1rem;
}
.coastkey-image-wrapper.variable{
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-height: 400px;
  overflow: hidden;
}

.coastkey-image-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.coastkey-image-wrapper label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

.coastkey-image {
  
  display: block;
  max-width: 100%;
  max-height: 400px;
}

.coastkey-image.hidden {
  display: none;
}

/* Live pris under motorbildene */
.coastkey-live-price {
  flex-shrink: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--coastkey-blue);
  text-align: center;
}
.coastkey-live-price.hidden {
  display: none;
}

.coastkey-information-panel{
  display: grid;
  grid-template-columns: repeat(3,1fr);
  background: var(--coastkey-white);
}
.coastkey-column-description{
  display: flex;
  justify-content: center;
  padding: 1rem;
  border-right: 2px solid white;
  border-top: 2px solid white;
}
.coastkey-column-description:last-child{
  border-right: 0;
}

.coastkey-text{
  flex-direction: column;
  margin: 2rem 0;
}
.coastkey-text.visible{
  display: flex;
}

/* Title under selector: H2 at 2rem */
.coastkey-content-title {
  font-size: 2rem;
  font-weight: 600;
  color: var(--coastkey-blue);
  margin: 0 0 0.5rem 0;
}

.search-btn-wrapper{
  display: flex;
  flex-direction: column;
  position: relative;
}
.search-msg{
  background-color: var(--coastkey-blue);
  border-radius: .5rem;
  padding: 1rem;
  position: absolute;
  width: 100%;
  text-align: center;
  color: var(--coastkey-white);
  opacity: 0;
  transition: all .2s ease-in-out;
  pointer-events: none;
}

.search-msg::after{
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border: 7px solid transparent;
  border-top-color: var(--coastkey-blue);
  bottom: 0;
  left: 50%;
  transform: translate(-5px, 100%);
}

/* Style for the Search button */
.coastkey-search-button {
  display: block;
  padding: 1rem;
  font-size: 16px;
  font-weight: 600;
  color: var(--coastkey-white);
  background-color: var(--coastkey-orange);
  border: none;
  border-radius: .5rem;
  cursor: pointer;
  outline: 2px solid var(--coastkey-orange);
}
.coastkey-search-button.disabled {
  opacity: .5;
}

.coastkey-search-button.disabled:hover ~ span{
  opacity: 1;
  transform: translateY(-115%);
}

.coastkey-search-button:hover {
  background-color: #e05a2b;
  outline: 2px solid #e05a2b;
}

/* Loading: Feather-style loader icon */
.coastkey-image-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-width: 120px;
  min-height: 120px;
  margin: 0 auto;
  color: var(--coastkey-orange);
}

.coastkey-image-loading svg {
  width: 40px;
  height: 40px;
  animation: coastkey-spin 0.8s linear infinite;
}

.coastkey-image-loading .coastkey-loading-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--coastkey-blue);
  letter-spacing: 0.02em;
}

@keyframes coastkey-spin {
  to { transform: rotate(360deg); }
}


.coastkey-text.mobile, .coastkey-text.mobile.visible{
  display: none;
}

@media (max-width: 1024px) {
  .coastkey-shortcode {
    flex-direction: column;
  }
  .coastkey-text.mobile{
    display: flex;
  }
  .coastkey-text.mobile.visible{
    display: flex;
  }
  .coastkey-text.desktop.visible{
    display: none;
  }

  .coastkey-filters{
    padding: 0 1rem 3rem;
  }
  .coastkey-result-wrapper{
    max-height: 50vh;
    overflow: hidden;
    overflow-y: auto;
    padding: 1rem;
  }
  .coastkey-result-row{
    flex-direction: column;
    align-items: normal;
  }
  .coastkey-result-row .actions a, .coastkey-result-row .actions button {
    flex: 1;
  }

}

/* Kun mobil */
@media (max-width: 768px) {

  /* Knappestil */
  .coastkey-item.product-cat-coastkey.btn {
    display: flex;
    flex-direction: column;       /* p over span */
    align-items: flex-start;      /* venstrejustert tekst */
    justify-content: center;
    padding: 8px 12px 8px 3.25rem;   /* plass til radio-sirkel */
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.3;
    gap: .25rem;                     /* lite mellomrom mellom p og span */
    min-height: 48px;             /* lik høyde */
    position: relative;
  }
  /* Sticky bilde sksjon frem til en trykker søk */

  .coastkey-main.sticky-active {
    position: -webkit-sticky; /* Safari fix */
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff; /* unngå overlap */
  }

  /* p øverst */
  .coastkey-item.product-cat-coastkey.btn p {
    margin: 0;
    font-weight: 600;
  }

  /* span under */
  .coastkey-item.product-cat-coastkey.btn span {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
  }

  /* Radio-sirkel til venstre */
  .coastkey-item.product-cat-coastkey.btn::before {
    content: "";
    position: absolute;
    left: 1rem;
    top: 50%;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--coastkey-orange);
    transform: translateY(-50%);
    background: var(--coastkey-white);
    box-sizing: border-box;
  }

  /* Valgt tilstand */
  .coastkey-item.product-cat-coastkey.btn.selected::before {
    background: var(--coastkey-orange);
    box-shadow: inset 0 0 0 3px var(--coastkey-white);
  }
  .coastkey-item.product-cat-coastkey.btn.selected {
    background: var(--coastkey-orange);
    color: var(--coastkey-white);
    border-color: var(--coastkey-orange);
  }

  /* Hover */
  .coastkey-item.product-cat-coastkey.btn:hover {
    border-color: var(--coastkey-orange);
  }

  /* Strammere spacing i container */
  .coastkey-product-options {
    gap: 0.6rem;
  }
  /* Fjerner info panel på mobil */
  .coastkey-information-panel {
    display: none;
  }
  
  /* Gjør prisen større og mer tydelig */
  .coastkey-result-inner .woocommerce-Price-amount {
    font-size: 16px;
    white-space: nowrap;
    font-weight: 700;
    color: var(--coastkey-white);
    display: block;
    margin-top: 4px;
  }

  /* Krymper navnet */
  .coastkey-result-inner .name p {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 7px;
    line-height: 1.3;
  }

  /* Krymper artikkelnummeret */
  .coastkey-result-inner .article {
    font-size: 12px;
    color: var(--coastkey-white);
    line-height: 1.2;
  }

  .coastkey-result-inner .article span {
    display: inline;
  }
  .coastkey-result-row .item {
    flex-wrap: wrap;
  }

  .coastkey-result-inner .woocommerce-Price-amount {
    white-space: nowrap;
  }
   
}





/* CHECKOUT FIXES - UTENFOR PLUGIN */

/* Skjuler avada-user-info i toppen av checkout */
.woocommerce-checkout .post-content .woocommerce > .avada-myaccount-user{
  display: none !important;
}
/* Skjuler avada-checkout-coupon i toppen av checkout */
.woocommerce-checkout .post-content .woocommerce > .checkout_coupon{
  display: none !important;
}
/* =========================================================
   Global type-beskrivelse på single-produkt ([coastkey_type_text])
   Henter cat_text fra coastkey-produkttype-termen. Diskret stil
   som matcher Avada-innholdet (arver typografi fra .fusion-content-tb).
========================================================= */
.coastkey-type-text {
  margin-top: 1.25rem;
  font-family: "DM Sans", Arial, Helvetica, sans-serif;
  line-height: 1.6;
  color: #21263C;
}
.coastkey-type-text > :first-child {
  margin-top: 0;
}
.coastkey-type-text > :last-child {
  margin-bottom: 0;
}
.coastkey-type-text p {
  margin: 0 0 1rem;
}
.coastkey-type-text ul {
  margin: 0 0 1rem 1.25rem;
}

/* =========================================================
   Butikk-kort (Avada Post Cards på /alle-produkter/): lik høyde
   per rad + «Les mer og kjøp» justert til bunnen.
   Griden er ul.fusion-grid (flex) med align-items:flex-start →
   kortene fikk ulik høyde. :has() scoper KUN til butikk-grider.
========================================================= */
ul.fusion-grid:has(li.butikk-kort) {
  align-items: stretch;
}
li.butikk-kort > .fusion-column-wrapper {
  height: 100%;
}
/* Wrapperen er allerede flex-column – skyv siste element (knappen) ned */
li.butikk-kort > .fusion-column-wrapper > div:last-child {
  margin-top: auto;
}
