﻿/* Shared design rules for every site. No colour values here: everything comes from
   skin/sites/<site>/theme.css (var(--pr-*)). */

/* Legacy names still used by existing markup */
:root {
    --theme-primary: var(--pr-primary);
    --theme-primary-rgb: var(--pr-primary-rgb);
    --theme-global-font: var(--pr-font);
    --theme-hover-bg: rgba(var(--pr-primary-rgb), 0.05);
    --theme-active-bg: rgba(var(--pr-primary-rgb), 0.10);

    /* Bootstrap 5.3 tokens follow the site theme */
    --bs-primary: var(--pr-primary);
    --bs-primary-rgb: var(--pr-primary-rgb);
    --bs-link-color: var(--pr-primary);
    --bs-link-color-rgb: var(--pr-primary-rgb);
    --bs-link-hover-color: var(--pr-link-hover);
    --bs-body-font-family: var(--pr-font);
    --bs-body-color: var(--pr-text-body);
    --bs-border-color: var(--pr-border-default);
    --bs-success: var(--pr-success);
    --bs-danger: var(--pr-danger);
}

body, .nordic-menu-container, .menu-item-link {
    font-family: var(--pr-font) !important;
}

/* Admin inline-edit zones */
.border-hover-edit-zone {
    border: 2px dashed var(--pr-edit-border) !important;
    transition: background-color 0.2s ease, border-color 0.2s ease !important;
}

    .border-hover-edit-zone:hover {
        border-color: var(--pr-edit-hover) !important;
        background-color: rgba(var(--pr-edit-border-rgb), 0.08) !important;
        cursor: pointer !important;
    }

*.hide {
    display: none !important;
}

/* Side menu: active row */
.active > .menu-track-wrapper {
    background-color: var(--theme-active-bg) !important;
    border-left: 4px solid var(--pr-primary);
}

.active .menu-item-link {
    color: var(--pr-primary) !important;
}

.accordion-box-btn:hover {
    border-color: var(--pr-primary) !important;
    background-color: var(--theme-hover-bg);
}

    .active .toggle-char,
    .accordion-box-btn:hover .toggle-char {
        color: var(--pr-primary);
    }

/* Purchase buttons */
.context-add-btn {
    background-color: var(--pr-primary) !important;
    border-color: var(--pr-primary) !important;
    color: var(--pr-on-primary) !important;
}

/* Primary colour for every primary button */
.btn-primary {
    background-color: var(--pr-primary) !important;
    border: none !important;
    color: var(--pr-on-primary) !important;
}

/* Product-card buy button only: half of the quantity/buy row. (Used to apply to every .btn-primary,
   which stretched e.g. the header search button to half the search field.) */
.btn-grid-purchase-submit {
    width: 50% !important;
    max-width: 50% !important;
    flex: 1 1 50% !important;
    height: 38px !important;
}

/* Full-width variant (cards, cart drawer) */
.btn-primary.btn-block-full {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
}

/* ---------- Product listing head (title, count, sort) and "Vis flere" ---------- */
.listing-head {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px;
    padding-bottom: 16px; margin-bottom: 24px; border-bottom: 1px solid var(--pr-border-light);
}
.listing-title { margin: 0; font-size: 1.5rem; font-weight: 700; color: var(--pr-text); flex: 1 1 auto; }
.listing-count { font-size: 0.9rem; color: var(--pr-text-subtle); }
.listing-sort { margin: 0; }
.listing-sort .form-select { min-width: 190px; height: 40px; border-color: var(--pr-border); }
.listing-more { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 32px; }
.listing-more-status { font-size: 0.9rem; color: var(--pr-text-subtle); }
.listing-more-btn { min-width: 240px; height: 48px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.listing-more .listing-more-btn { color: var(--pr-primary); background: var(--pr-surface); border: 2px solid var(--pr-primary); }
.listing-more .listing-more-btn:hover, .listing-more .listing-more-btn:focus-visible { color: var(--pr-on-primary) !important; background: var(--pr-primary); }

@media (max-width: 575.98px) {
    .listing-title { flex-basis: 100%; font-size: 1.25rem; }
    .listing-sort { margin-left: auto; }
    .listing-sort .form-select { min-width: 0; }
}

/* ---------- Checkout e-mail check (shop.js + EmailCheck.cs) ---------- */
.email-check-msg { min-height: 1.25em; margin-top: 4px; font-size: 0.85rem; color: var(--pr-danger); }
.email-check-msg:empty { min-height: 0; margin: 0; }
.email-suggest-btn {
    border: 0; background: none; padding: 4px 0; color: var(--pr-primary); font-weight: 600; text-decoration: underline; cursor: pointer;
}

/* ---------- Page frame: footer always at the bottom, even on short pages ---------- */
body { min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; }
body > footer { flex-shrink: 0; }

/* ---------- Footer legal links (PageFooter.razor): one centred row, same style ---------- */
.footer-legal { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 32px; text-align: center; }
.footer-legal a { color: var(--pr-footer-text); text-decoration: underline; text-underline-offset: 3px; padding: 6px 0; }
.footer-legal a:hover, .footer-legal a:focus-visible { color: var(--pr-footer-link); }

/* ---------- Checkout payment methods (Kasse.razor) ---------- */
.pay-methods { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pay-method {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer;
    border: 1px solid var(--pr-border); border-radius: 10px; background: var(--pr-surface);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pay-method:hover { border-color: var(--pr-primary); }
.pay-method.is-selected { border-color: var(--pr-primary); box-shadow: 0 0 0 2px rgba(var(--pr-primary-rgb), 0.18); }
.pay-method input { width: 20px; height: 20px; flex: 0 0 20px; accent-color: var(--pr-primary); }
/* Bootstrap's #dee2e6 border is invisible on white and checked state is Bootstrap blue: use theme colours, 3:1 contrast */
.form-check-input { flex-shrink: 0; border-color: var(--pr-text-muted); }
.form-check-input:checked { background-color: var(--pr-primary); border-color: var(--pr-primary); }
.form-check-input:focus { border-color: var(--pr-primary); box-shadow: 0 0 0 .25rem rgba(var(--pr-primary-rgb), .25); }
.pay-method:focus-within { outline: 2px solid var(--pr-link); outline-offset: 2px; }
.pay-method-text { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.pay-method-name { font-weight: 700; color: var(--pr-text); }
.pay-method-desc { font-size: 0.82rem; color: var(--pr-text-subtle); }
.pay-method-badge { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.04em; padding: 4px 8px; border-radius: 6px; background: var(--pr-surface-muted); color: var(--pr-text); }
.pay-method-badge-vipps { background: #ff5b24; color: #ffffff; }   /* Vipps brand colour, same on every site */

/* ---------- Order confirmation (OrderConfirmation.razor) ---------- */
.confirm-card {
    max-width: 560px; margin: 0 auto; padding: 40px 28px; text-align: center;
    background: var(--pr-surface); border: 1px solid var(--pr-border-light); border-radius: 16px;
}
.confirm-icon {
    width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 1.75rem; font-weight: 700;
    background: var(--pr-surface-muted); color: var(--pr-text);
}
.confirm-icon-ok { background: var(--pr-success); color: var(--pr-on-primary); }
.confirm-icon-warn { background: var(--pr-accent); color: var(--pr-on-accent); }
.confirm-title { font-size: 1.5rem; font-weight: 700; color: var(--pr-text); margin: 0 0 12px; }
.confirm-text { color: var(--pr-text-body); line-height: 1.6; margin: 0 0 20px; }
.confirm-summary { display: grid; gap: 8px; margin: 0 0 24px; padding: 16px; background: var(--pr-surface-subtle); border-radius: 10px; text-align: left; }
.confirm-summary div { display: flex; justify-content: space-between; gap: 12px; }
.confirm-summary dt { font-weight: 500; color: var(--pr-text-subtle); }
.confirm-summary dd { margin: 0; font-weight: 700; color: var(--pr-text); }
.confirm-btn { min-height: 48px; padding: 0 28px; display: inline-flex; align-items: center; }

/* ---------- Legal pages (LegalPage.razor): readable line length ---------- */
.legal-page {
    max-width: 760px; margin: 0 auto; padding: 32px 24px;
    background: var(--pr-surface); border: 1px solid var(--pr-border-light); border-radius: 12px;
}
.legal-title { font-size: 1.75rem; font-weight: 700; color: var(--pr-text); margin: 0 0 24px; }
.legal-body { color: var(--pr-text-body); line-height: 1.65; font-size: 1rem; overflow-wrap: anywhere; }
.legal-body h1, .legal-body h2, .legal-body h3, .legal-body strong { color: var(--pr-text); }
.legal-body img { max-width: 100%; height: auto; }
@media (max-width: 575.98px) { .legal-page { padding: 20px 16px; border-radius: 0; border-left: 0; border-right: 0; } }

/* ---------- My orders (OrderListing.razor) ---------- */
.orders-back { margin-bottom: 8px; font-size: 0.9rem; }
.orders-title { font-size: 1.6rem; font-weight: 700; color: var(--pr-text); margin: 0 0 24px; }
.orders-empty { padding: 32px; text-align: center; background: var(--pr-surface); border: 1px solid var(--pr-border-light); border-radius: 12px; }
.orders-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.order-card { background: var(--pr-surface); border: 1px solid var(--pr-border-light); border-radius: 12px; overflow: hidden; }
.order-card.is-open { border-color: var(--pr-primary); }
.order-summary {
    display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; padding: 16px 20px; position: relative;
    color: var(--pr-text) !important; text-decoration: none;
}
.order-summary:hover { background: var(--pr-surface-subtle); }
.order-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.order-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--pr-text-subtle); }
.order-value { font-weight: 600; }
.order-status { display: inline-block; width: fit-content; padding: 2px 10px; border-radius: 999px; background: var(--pr-surface-muted); font-size: 0.85rem; font-weight: 600; }
.order-chevron { position: absolute; top: 16px; right: 16px; color: var(--pr-text-subtle); }
.order-details { border-top: 1px solid var(--pr-border-light); padding: 16px 20px 20px; }
.order-lines { list-style: none; margin: 0 0 16px; padding: 0; }
.order-line { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--pr-border-light); font-size: 0.92rem; }
.order-line:last-child { border-bottom: 0; }
.order-line-qty { color: var(--pr-text-subtle); white-space: nowrap; }
.order-line-total { font-weight: 600; white-space: nowrap; }
.order-actions .btn { min-height: 44px; padding: 0 24px; }

@media (min-width: 768px) {
    .order-summary { grid-template-columns: 1fr 1fr 1fr 1fr 24px; align-items: center; }
    .order-chevron { position: static; }
    .order-cell-total { text-align: right; align-items: flex-end; }
}

/* ---------- Analytics consent banner (AnalyticsConsent.razor + shop.js) ---------- */
.consent-banner {
    position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 1090;
    max-width: 640px; margin: 0 auto; padding: 16px 20px;
    background: var(--pr-surface); color: var(--pr-text-body);
    border: 1px solid var(--pr-border-light); border-radius: 12px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25);
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
}
.consent-banner[hidden] { display: none; }
.consent-text { margin: 0; flex: 1 1 320px; font-size: 0.9rem; line-height: 1.45; }
.consent-actions { display: flex; gap: 12px; flex: 1 1 auto; justify-content: flex-end; }
.consent-btn { min-height: 44px; min-width: 130px; font-weight: 600; } /* equal-weight choices */

/* ---------- Search suggestions (shop.js) ---------- */
.search-suggest {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 1060;
    margin: 0; padding: 6px; list-style: none;
    background: var(--pr-surface); border: 1px solid var(--pr-border-light); border-radius: 10px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18); max-height: 70vh; overflow-y: auto;
}
.search-suggest a {
    display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px;
    color: var(--pr-text) !important; text-decoration: none; min-height: 48px;
}
.search-suggest [role=option][aria-selected=true] a, .search-suggest a:hover { background: var(--pr-surface-muted); }
.search-suggest img { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: var(--pr-surface-subtle); flex: 0 0 40px; }
.search-suggest-text { display: flex; flex-direction: column; min-width: 0; }
.search-suggest-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-suggest-price { font-size: 0.8rem; color: var(--pr-text-subtle); }
.search-suggest-empty { padding: 12px 10px; color: var(--pr-text-subtle); font-size: 0.9rem; }
.search-suggest-all { border-top: 1px solid var(--pr-border-light); margin-top: 4px; padding-top: 4px; }
.search-suggest-all a { color: var(--pr-primary) !important; font-weight: 600; font-size: 0.9rem; min-height: 40px; }

/* ---------- Product page buy row: quantity + button, same height ---------- */
.buy-row { display: flex; align-items: stretch; gap: 12px; width: 100%; max-width: 440px; }
.buy-row-qty {
    width: 72px; height: 48px; flex: 0 0 72px;
    border: 1px solid var(--pr-border); border-radius: 8px;
    text-align: center; font-weight: 700; font-size: 1rem; color: var(--pr-text); background: var(--pr-surface);
}
.buy-row-qty:focus { outline: 2px solid var(--pr-primary); outline-offset: 1px; }
.buy-row-btn {
    flex: 1 1 auto; height: 48px; border: 0; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    background: var(--pr-primary); color: var(--pr-on-primary); font-weight: 700; font-size: 1rem;
    box-shadow: 0 2px 6px rgba(var(--pr-primary-rgb), 0.25); transition: filter 0.15s ease;
}
.buy-row-btn:hover { filter: brightness(1.1); }
.buy-row-btn:focus-visible { outline: 3px solid var(--pr-link); outline-offset: 2px; }
.buy-row-btn-quote { background: var(--pr-accent); color: var(--pr-on-accent); }

/* ---------- Cart drawer (CartDrawer.razor) — mobile first ---------- */
.cart-backdrop {
    position: fixed; inset: 0; z-index: 1040;
    background: rgba(15, 23, 42, 0.5);
    animation: cart-fade-in 0.2s ease;
}

.cart-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 1050;
    width: 100%; max-width: 420px;
    display: flex; flex-direction: column;
    background: var(--pr-surface);
    color: var(--pr-text-body);
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.18);
    animation: cart-slide-in 0.25s ease;
}

.cart-drawer-header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--pr-border-light);
}

.cart-drawer-title { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--pr-text); display: flex; align-items: baseline; gap: 8px; }
.cart-drawer-count { font-size: 0.85rem; font-weight: 500; color: var(--pr-text-subtle); }

.cart-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 50%;
    color: var(--pr-text-body) !important; text-decoration: none;
}
.cart-icon-btn:hover, .cart-icon-btn:focus-visible { background: var(--pr-surface-muted); }

.cart-empty {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 16px; padding: 32px 24px; text-align: center; color: var(--pr-text-subtle);
}
.cart-empty-text { margin: 0; font-size: 1rem; color: var(--pr-text-body); }
.cart-empty .btn { max-width: 260px !important; }

.cart-lines { list-style: none; margin: 0; padding: 8px 20px; flex: 1; overflow-y: auto; }

.cart-line {
    display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: start;
    padding: 16px 0; border-bottom: 1px solid var(--pr-border-light);
}
.cart-line:last-child { border-bottom: 0; }

.cart-line-image {
    width: 72px; height: 72px; border-radius: 8px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: var(--pr-surface-subtle); border: 1px solid var(--pr-border-light);
}
.cart-line-image img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }

.cart-line-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cart-line-name {
    color: var(--pr-text) !important; font-weight: 600; font-size: 0.92rem; line-height: 1.3; text-decoration: none;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cart-line-name:hover { text-decoration: underline; }
.cart-line-meta { font-size: 0.8rem; color: var(--pr-text-subtle); }
.cart-line-total { font-weight: 700; font-size: 0.92rem; color: var(--pr-text); white-space: nowrap; }

.cart-line-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }

.cart-stepper {
    display: inline-flex; align-items: center;
    border: 1px solid var(--pr-border); border-radius: 999px; overflow: hidden; background: var(--pr-surface);
}
.cart-stepper-btn {
    width: 36px; height: 36px; border: 0; background: transparent;
    font-size: 1.1rem; font-weight: 600; line-height: 1; color: var(--pr-text);
}
.cart-stepper-btn:hover:not(:disabled), .cart-stepper-btn:focus-visible { background: var(--pr-surface-muted); }
.cart-stepper-btn:disabled { color: var(--pr-border); cursor: not-allowed; }
.cart-stepper-input {
    width: 40px; height: 36px; border: 0; text-align: center; font-weight: 600;
    color: var(--pr-text); background: transparent; -moz-appearance: textfield;
}
.cart-stepper-input:focus { outline: 2px solid var(--pr-primary); outline-offset: -2px; }

.cart-remove-btn {
    border: 0; background: none; padding: 8px 4px; font-size: 0.85rem;
    color: var(--pr-text-subtle); text-decoration: underline;
}
.cart-remove-btn:hover, .cart-remove-btn:focus-visible { color: var(--pr-danger); }

.cart-drawer-footer {
    padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--pr-border-light);
    background: var(--pr-surface);
    display: flex; flex-direction: column; gap: 8px;
}
.cart-subtotal { display: flex; justify-content: space-between; align-items: baseline; font-weight: 600; color: var(--pr-text); }
.cart-subtotal-amount { font-size: 1.25rem; font-weight: 700; }
.cart-footnote { margin: 0; font-size: 0.8rem; color: var(--pr-text-subtle); }
.cart-checkout-btn { height: 48px !important; display: flex !important; align-items: center; justify-content: center; font-weight: 700; font-size: 1rem; margin-top: 4px; }
.cart-continue-link { text-align: center; font-size: 0.9rem; padding: 6px; }

/* Very small phones: stack the line total under the text */
@media (max-width: 359.98px) {
    .cart-line { grid-template-columns: 56px 1fr; }
    .cart-line-image { width: 56px; height: 56px; }
    .cart-line-total { grid-column: 2; }
}

@keyframes cart-slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes cart-fade-in { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .cart-drawer, .cart-backdrop { animation: none; }
}

/* "Lagt i handlekurven" confirmation under the header; fades out by itself (no JS) */
.cart-added-notice {
    position: fixed;
    top: 84px;
    right: 16px;
    z-index: 1080;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--pr-notice-bg);
    color: var(--pr-notice-text);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    font-weight: 600;
    animation: cart-added-fade 5s ease forwards;
}

.cart-added-notice .cart-added-notice-link {
    color: var(--pr-notice-text) !important;
    text-decoration: underline;
    font-weight: 500;
}

@keyframes cart-added-fade {
    0%, 85% { opacity: 1; visibility: visible; }
    100% { opacity: 0; visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
    .cart-added-notice { animation: none; }
}

@media (max-width: 575.98px) {
    .cart-added-notice { left: 16px; right: 16px; }
}

/* Wishlist heart when the product is on the list */
.wishlist-on {
    color: var(--pr-wishlist) !important;
}

/* Links */
* a {
    color: var(--pr-primary) !important;
}

    /* filled link-buttons get light text; outline/light/link buttons keep dark text on their light background */
    * a.btn:not([class*="btn-outline"]):not(.btn-light):not(.btn-link) {
        color: var(--pr-on-primary) !important;
    }
    * a.btn[class*="btn-outline"]:not(:hover):not(:focus-visible) {
        color: var(--pr-primary) !important;
    }
    * a.btn[class*="btn-outline"]:hover, * a.btn[class*="btn-outline"]:focus-visible {
        color: var(--pr-on-primary) !important;
    }

.bg-fjord-dark a {
    color: var(--pr-on-primary) !important;
}

/* ---------- Product detail spec rows: .row without a container bleeds 12px left; keep them on the content edge ---------- */
.specs-table-container > .row,
.product-detailed-specs-block > .row { margin-left: 0; margin-right: 0; }
.specs-table-container > .row > [class*="col"]:first-child,
.product-detailed-specs-block > .row > [class*="col"]:first-child { padding-left: 0; }

/* ---------- Stock status (StockStatus.razor): same row on cards and detail page; colour by level ---------- */
.stock-status { display: flex; align-items: center; gap: 8px; min-height: 24px; margin: 0 0 12px; font-size: 0.875rem; font-weight: 600; }
.stock-status-label { color: var(--pr-text-subtle); font-weight: 500; }
.stock-status-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 8px; }
.stock-status-icon { flex: 0 0 22px; }
.stock-normal { color: var(--pr-stock-ok, #047857); }   /* per-site override in theme.css; defaults are 4.5:1 on white */
.stock-low { color: var(--pr-stock-low, #b45309); }
.stock-none { color: var(--pr-stock-none, #b42318); }
