/* =============================
   BALDER APOTEK – RESEPTER CSS
   ============================= */

/* Grunnstruktur */
.resept-portal {
  max-width: 960px;
  margin: 0 auto;
}

.resept-skjema {
  margin: 1rem 0 2rem;
}

.resept-skjema form p,
.resept-skjema form label {
  margin: 6px 0;
}

/* -----------------------------
   Historikk – ny layout
   ----------------------------- */

.br-orders {
  width: 100%;
  margin-top: 8px;
}

.br-order-row {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 14px 16px;
  background: #e3e3df;
  border-radius: 18px;
  margin-bottom: 12px;
}

.br-o-col {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Kolonne 1 – dato + detaljer */
.br-o-date {
  font-size: 0.95rem;
  color: #374151;
  font-weight: 500;
}

.br-o-toggle {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  margin-top: 6px;
  color: #0E2028;
  cursor: pointer;
  font-size: 0.9rem;
}

.br-o-caret {
  display: inline-block;
  width: 1em;
  text-align: center;
}

/* Kolonne 2 – navn */
.br-o-namecol .br-o-name {
  font-weight: 700;
  font-size: 1rem;
  color: #0E2028;
}

/* Kolonne 3 – knapp */
.br-o-actioncol button {
  border: 1px solid #c7e2cf;
  background: #fff;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s ease;
}

.br-o-actioncol button:hover {
  background: #f2faf4;
}

/* Skjulte detaljer */
.br-o-details {
  grid-column: 1 / -1;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 14px;
  padding: 12px;
  margin-top: 10px;
}

.br-o-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 4px 16px;
  font-size: 16px;
}

.br-o-grid .br-o-wide {
  grid-column: 1 / -1;
}

.br-details-more summary {
  cursor: pointer;
}

.br-o-details[hidden]{display:none !important;}
.br-o-details.is-open{display:block !important;}

/* -----------------------------
   Tidligere kort- og tabellstil
   (beholdes i tilfelle brukt andre steder)
   ----------------------------- */

.table-resept-historikk {
  width: 100%;
  border-collapse: collapse;
}

.table-resept-historikk th,
.table-resept-historikk td {
  padding: 0.6rem;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}

details summary {
  cursor: pointer;
}

/* Kort-basert historikk (legacy) */
.br-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.br-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
  overflow: hidden;
}

.br-card-hd {
  padding: 14px 16px 0 16px;
}

.br-date {
  font-size: .85rem;
  color: #6b7280;
  margin-bottom: 6px;
}

.br-title {
  font-size: 1.05rem;
  margin: 0 0 8px 0;
}

.br-body {
  padding: 0 16px 16px 16px;
}

.br-line {
  margin: .2rem 0;
}

.br-details {
  margin-top: 8px;
}

.br-details summary {
  cursor: pointer;
  outline: none;
}

.br-details-inner {
  margin-top: 6px;
  padding: 8px 10px;
  background: #fafafa;
  border: 1px solid #eee;
  border-radius: 10px;
}

/* -----------------------------
   Pagination (legacy)
   ----------------------------- */
.pagination-resept {
  margin-top: 1rem;
}

.pagination-resept ul {
  list-style: none;
  padding: 0;
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

.pagination-resept a,
.pagination-resept span {
  padding: .35rem .6rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-decoration: none;
}

.pagination-resept .current {
  background: #f0f0f0;
}

/* Endepunktet bruker .no-actions for å skjule actionkolonnen og reflowe grid */
.br-orders.no-actions .br-order-row{ grid-template-columns: 220px 1fr; }
.br-orders.no-actions .br-o-actioncol{ display:none; }

/* -----------------------------
   Mobil-tilpasning
   ----------------------------- */

@media (max-width: 640px) {
  .br-order-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .br-o-actioncol {
    justify-self: start;
  }
  .br-o-grid {
    grid-template-columns: 1fr;
  }
}
/* -----------------------------
   Reseptvarer: søk + valgte varer med antall
   ----------------------------- */
.rx-ac-box {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  z-index: 9999;
  display: none;
  max-height: 320px;
  overflow: auto;
  background: #fff;
  border: 1px solid #9bb7b4;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,.10);
}
.rx-ac-list { list-style: none; margin: 0; padding: 4px 0; }
.rx-ac-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; cursor: pointer; line-height: 1.3; }
.rx-ac-item:hover, .rx-ac-item.is-active { background: #eef3f2; }
.rx-ac-name { color: #1f2a29; font-weight: 600; }
.rx-ac-meta { color: #5a6866; font-size: 13px; }
.rx-ac-empty { padding: 10px 14px; color: #5a6866; }
#rx-search { width: 100%; }

.rx-rows {
  margin-top: 10px;
  border: 1px solid #9bb7b4;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.rx-row {
  display: grid;
  grid-template-columns: 1fr auto 40px;
  gap: 12px;
  align-items: center;
  padding: 10px 12px 10px 16px;
  border-top: 1px solid #e3ecea;
}
.rx-row:first-child { border-top: 0; }
.rx-row-head {
  grid-template-columns: 1fr auto 40px;
  padding-top: 8px; padding-bottom: 8px;
  background: #465f5c;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .3px;
}
.rx-row-head .rx-qty-head { grid-column: 2 / 4; text-align: left; }
.rx-row-label { color: #1f2a29; font-weight: 500; line-height: 1.35; }
.rx-row-head .rx-row-label { color: #fff; }

.rx-qty { display: inline-flex; align-items: center; border: 1px solid #9bb7b4; border-radius: 999px; overflow: hidden; }
.rx-qty-btn {
  width: 38px; height: 38px;
  border: 0; margin: 0; padding: 0;
  background: #eef3f2;
  color: #465f5c;
  font-size: 20px; font-weight: 700; line-height: 1;
  cursor: pointer;
}
.rx-qty-btn:hover:not(:disabled) { background: #dfe9e7; }
.rx-qty-btn:disabled { color: #aab8b6; cursor: not-allowed; }
.rx-qty-btn:focus-visible, .rx-row-remove:focus-visible, .rx-qty-input:focus-visible { outline: 2px solid #465f5c; outline-offset: 2px; }
.resept-skjema .rx-qty-input,
.rx-qty-input {
  width: 46px; height: 38px;
  margin: 0; padding: 0;
  border: 0; border-radius: 0;
  background: #fff;
  text-align: center;
  font-size: 16px; font-weight: 600; color: #1f2a29;
  -moz-appearance: textfield;
  box-shadow: none;
}
.rx-qty-input::-webkit-outer-spin-button,
.rx-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.rx-row-remove {
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: #5a6866;
  font-size: 22px; line-height: 1;
  cursor: pointer;
}
.rx-row-remove:hover { background: #fbe9e9; color: #a32020; }

.rx-qty-note { margin: 6px 2px 0; font-size: 13px; color: #5a6866; }
.rx-error {
  margin-top: 8px;
  padding: 10px 14px;
  border-left: 4px solid #a32020;
  background: #fbe9e9;
  color: #6e1414;
  border-radius: 6px;
  font-size: 15px;
}

@media (max-width: 520px) {
  .rx-row { grid-template-columns: 1fr auto; row-gap: 8px; padding-left: 12px; }
  .rx-row-head { display: none; }
  .rx-row-label { grid-column: 1 / -1; }
  .rx-qty { justify-self: start; }
}

/* Postnummer-hint */
.rm-pnr-hint { display: block; margin-top: 4px; font-size: 13px; color: #8a5a00; }
.rm-pnr-hint:empty { display: none; }

/* Melding når BankID ikke ble bekreftet */
.wpcf7 form .wpcf7-response-output.rm-client-msg { display: block !important; }
.wpcf7 form .wpcf7-response-output.rm-client-msg:not(.rm-bankid-notice) { border-color: #dc3232; }
.wpcf7 form .wpcf7-response-output.rm-bankid-notice { border: 1px solid #c79a3a; background: #fff8e6; color: #5c4200; padding: 10px 14px; border-radius: 6px; }

/* Kvittering øverst når bestillingen er sendt */
.rm-success {
  margin: 0 0 28px;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #9bb7b4;
  box-shadow: 0 10px 30px rgba(70, 95, 92, .14);
  scroll-margin-top: 120px; /* plass til fast meny på mobil */
  animation: rm-success-in .35s ease-out;
}
.rm-success:focus { outline: none; }
.rm-success-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 20px 22px;
  background: #465f5c;
  color: #fff;
  border-bottom: 4px solid #9bb7b4;
}
.rm-success-icon {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #fff;
  color: #465f5c;
}
.rm-success-title { margin: 0 !important; padding: 0; color: #fff !important; font-size: 22px; line-height: 1.25; }
.rm-success-sub { margin: 4px 0 0 !important; padding: 0 !important; color: #e3ecea; font-size: 15px; line-height: 1.45; }
.rm-success-body { padding: 18px 22px 20px; }
.rm-success-label { margin: 0 0 8px !important; padding: 0 !important; font-size: 13px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: #465f5c; }
.rm-success-items { list-style: none; margin: 0 0 14px !important; padding: 0 !important; border-left: 4px solid #465f5c; background: #eef3f2; border-radius: 0 8px 8px 0; }
.rm-success-items li { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 9px 14px; border-top: 1px solid #dfe9e7; color: #1f2a29; line-height: 1.35; }
.rm-success-items li:first-child { border-top: 0; }
.rm-success-qty { flex: 0 0 auto; font-weight: 700; color: #465f5c; }
.rm-success-text { margin: 0 0 8px !important; padding: 0 !important; color: #1f2a29; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.rm-success-contact { margin-bottom: 0 !important; color: #5a6866; font-size: 14px; }
.rm-success-contact a { color: #465f5c; text-decoration: underline; }
/* CF7 sin egen grønne boks under skjemaet er overflødig når kvitteringen vises */
.wpcf7 form.sent .wpcf7-response-output { display: none !important; }
@keyframes rm-success-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .rm-success { animation: none; } }
@media (max-width: 520px) {
  .rm-success-head { padding: 16px; }
  .rm-success-body { padding: 14px 16px 16px; }
  .rm-success-title { font-size: 19px; }
}

/* Ny bestilling i historikken (etter innsending) */
.br-order-row.rm-new-order { box-shadow: 0 0 0 2px #465f5c inset; animation: rm-new-order 2.4s ease-out; }
@keyframes rm-new-order { 0% { background: #cfe0dd; } 100% { background: #e3e3df; } }
@media (prefers-reduced-motion: reduce) { .br-order-row.rm-new-order { animation: none; } }
