/* =========================================================
   FARGEPALETT — henta frå ICE Audio-logoen (isblå/vinter)
   Endre fargane HER; resten av CSS-en brukar variablane.
   ========================================================= */
:root {
    --primary: #2b5d8e;        /* stålblå — snø/is-tonen i logoen (meny, knappar) */
    --primary-dark: #14264a;   /* marineblå — bilen (toppmeny, hover) */
    --primary-light: #639dc4;  /* lys stålblå — aksentar på mørk flate */
    --accent: #3a63e8;         /* «In Car Entertainment»-blå — lenkjer */
    --ice: #daeefa;            /* is-lys tint */
    --hover-bg: #e8f1f9;       /* lys isblå hover på kvite flater */
    --bg: #f3f7fb;             /* sidebakgrunn — svakt blåkvit */
    --text: #1c2430;
    --price-net: #2a8a3a;      /* nettopris / «lagt i korga» (grønt = signalfarge) */
    --warning: #c94f4f;
    --sidebar-bg: #ffffff;
    --header-bg: #ffffff;
    --radius: 6px;
    --shadow: 0 2px 6px rgba(20, 38, 74, 0.10);
}

body {
    margin: 0;
    font-family: system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* Gult banner når admin ser sida som ein forhandlar (admin/vis_som.php) */
.admin-vis-som {
    background: #fff3cd;
    color: #5c4400;
    border-bottom: 2px solid #e0b400;
    padding: 6px 14px;
    font-size: 14px;
    text-align: center;
}
.admin-vis-som a {
    color: #14264a;
    font-weight: 600;
    margin-left: 10px;
}

/* Lenkjer: same blåtone overalt (utan denne fell dei tilbake på nettlesaren
   sine standardfargar — mørkeblå/lilla for besøkte). Klassane under
   (.top-nav a, .sidebar-menu a, .btn-primary osb.) overstyrer der dei skal. */
a {
    color: var(--primary);
    text-decoration: none;
}
a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.main_card {
    background: white;
    padding: 20px;
    margin: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* =========================================================
   HEADER — full breidde, komponert frå ICE Audio-logoen
   (vinterbakgrunn + bil med «ICE AUDIO» + handskriven tagline)
   ========================================================= */
.top-header {
    position: relative;
    height: 100px;
    background: #cfe2f1 url("../img/header-bg.jpg") center / cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

/* mørk marine-tone nedst så headeren glir over i toppmenyen */
.top-header::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 30px;
    background: linear-gradient(to bottom, rgba(20, 38, 74, 0), rgba(20, 38, 74, 0.35));
    pointer-events: none;
}

.header-car-link {
    display: block;
    line-height: 0;
    position: relative;
    z-index: 1;
}

.top-header .header-car {
    display: block;
    height: 96px;
    width: auto;
    max-width: none;
    filter: drop-shadow(0 4px 10px rgba(20, 38, 74, 0.35));
}

.header-tagline {
    position: relative;
    z-index: 1;
    display: block;
    height: 38px;          /* «In Car Entertainment» klipt frå logoen (2x) */
    width: auto;
    max-width: none;
    margin-right: 20px;
    filter: drop-shadow(0 2px 6px rgba(255,255,255,0.9));
}

/* Merkevare-strip under headeren */
.brand-strip {
    background: var(--primary-dark);
    color: #c9dcee;
    font-size: 11.5px;
    letter-spacing: 0.6px;
    text-align: center;
    padding: 5px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

/* Merke med leverandørlenkje (opnar i ny fane) — same farge som teksten, understreking ved hover */
.brand-strip a {
    color: inherit;
    text-decoration: none;
}
.brand-strip a:hover {
    color: white;
    text-decoration: underline;
}

.top-nav {
    text-decoration: none;
    color: white;
    display: flex;
    background-color: var(--primary-dark); /* marineblå som bilen i logoen */
    padding: 10px;
}

.top-nav a {
    margin-left: 20px;
    text-decoration: none;
    color: white;
    font-weight: 500;
}

.top-nav a {
    position: relative;
}

.top-nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 0;
    height: 2px;
    background: white;
    transition: width 0.2s ease;
}

.top-nav a:hover::after {
    width: 100%;
}

.top-nav a:last-child {
    margin-left: auto;
}

.push-right {
    margin-left: auto;
}

/* Lenkje-wrapper i toppmenyen (burgar-knappen styrer denne på mobil) */
.top-nav-links {
    display: flex;
    flex: 1;
    align-items: center;
}

/* Burgar-knapp og mobil-handlekorg — skjulte på desktop */
.top-nav .nav-toggle,
.top-nav .nav-cart-mobile {
    display: none;
}

/* LAYOUT */
.layout {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 20px;
    padding: 20px;
}

/* SIDEBAR */
.sidebar {
    background: var(--sidebar-bg);
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    white-space: nowrap;
    min-width: fit-content;
}

.sidebar-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: var(--primary);
}

.search-box {
    margin-bottom: 20px;
}

.search-box form {
    display: flex;
    gap: 5px;
}

.search-box input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.search-box button {
    padding: 8px 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.search-box button:hover {
    background: var(--primary-dark);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
}

.sidebar-menu li {
    margin-bottom: 8px;
}

.sidebar-menu a {
    text-decoration: none;
    color: var(--text);
}

.sidebar-menu a:hover {
    color: var(--primary);
}

/* CONTENT CARDS */
.layout > .card {
    min-width: 0; /* grid-element skal kunne krympe — elles sprengjer breie tabellar sida på mobil */
}

.card {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* PRODUCT GRID */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 22px;
}

.product-detail-gallery {
    display: grid;
    gap: 18px;
}

.product-detail {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 1.4fr;
    gap: 30px;
    align-items: start;
}

.product-detail-main-image {
    aspect-ratio: 1 / 1;
    width: 100%;
    overflow: hidden;
}

.product-detail-main-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

@media (max-width: 768px) {
    .product-detail {
        grid-template-columns: 1fr !important;
    }

    .product-detail-main-image {
        aspect-ratio: 1 / 1;
        width: 100%;
    }

    .product-detail-main-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }
}
.product-thumbnails {
    display: grid;
    grid-auto-flow: column;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.product-thumb {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.product-thumb img {
    width: 84px;
    height: 84px;
    max-width: 84px; /* overstyrer den globale img { max-width:100% }-regelen */
    /* contain (ikkje cover): vis heile biletet nedskalert i staden for å klippe det */
    object-fit: contain;
    background: #fff;
    padding: 3px;
    box-sizing: border-box;
    border-radius: var(--radius);
    border: 2px solid #f0f0f0;
    transition: border-color 0.2s ease;
}

.product-thumb:hover img {
    border-color: var(--hover-bg);
}

.product-thumb.active img {
    border-color: var(--primary);
}

.product-detail-info {
    display: grid;
    gap: 20px;
}

.product-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.product-title2 {
    margin: 6px 0 6px;
    font-size: 1rem;
    color: #666;
}

.product-sku {
    margin: 0 0 6px;
    font-size: 0.95rem;
    color: #666;
}

.product-price {
    color: var(--primary);
    font-size: 2.2rem;
    margin: 0;
}

.product-description {
    margin: 0;
    line-height: 1.8;
    color: #444;
}

.product-description ul {
    list-style: none;
    padding-left: 0;
}

.product-description li {
    margin-bottom: 8px;
    min-height: 8px;
}

.product-stock {
    margin: 0;
    font-weight: 600;
}

.product-specs {
    margin-bottom: 20px;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}
.spec-row:hover {
    /* background-color: #f9f9f9; */
    background-color: var(--hover-bg);

}

.spec-row:last-child {
    border-bottom: none;
}

.spec-label {
    font-weight: 600;
    color: #555;
}

.spec-value {
    text-align: right;
    color: #333;
}

.product-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: end;
}

.product-actions input[type="number"] {
    width: 90px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
}

.product-actions button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 22px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.product-actions button:hover {
    transform: translateY(-1px);
    background: var(--primary-dark);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.9rem;
    background: var(--primary);
    color: white;
}

.badge-warning {
    background: var(--warning);
}

.product-header h1 {
    margin: 0;
}

/* PDF and main-image link styles */
.product-detail-main-image a {
    display: inline-block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.product-detail-main-image a img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

.product-pdf-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    color: inherit;
}

.product-pdf-link svg {
    width: 96px;
    height: 96px;
}

.pdf-filename {
    font-size: 0.95rem;
    color: #333;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-thumbnails .product-thumb {
    padding: 4px;
    border-radius: var(--radius);
}

.product-thumbnails .product-thumb .pdf-thumb {
    width: 84px;
    height: 84px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    border: 2px solid transparent;
    background: #fff;
}

.product-thumbnails .product-thumb .pdf-thumb svg {
    width: 48px;
    height: 48px;
}

.product-thumb.active .pdf-thumb {
    border-color: var(--primary);
    box-shadow: var(--shadow);
}


/* Sortering + visningsval samla til høgre i produkt-headeren */
.list-tools {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.list-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
}

.list-controls select {
    padding: 7px 8px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    background: white;
    font-size: 14px;
}

.view-toggle {
    display: flex;
    gap: 8px;
}

.view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid #ddd;
    border-radius: var(--radius);
    background: white;
    transition: all 0.2s ease;
}

.view-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.view-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.view-btn span {
    font-size: 14px;
    font-weight: bold;
}

/* PRODUCT TABLE — .data-table er same utsjånad for andre tabellar
   (forhandlarliste m.m.) slik at alle tabellane på sida er einsarta */
.product-table-container,
.data-table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: white;
    border: 1px solid #e3e9f0;
}

.product-table,
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    font-size: 14px;
}

.product-table th,
.product-table td,
.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid #eef2f6;
}

.product-table th,
.data-table th {
    background: var(--primary-dark);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 0.78em;
    white-space: nowrap;
}

.product-table tbody tr:last-child td,
.data-table tbody tr:last-child td {
    border-bottom: none;
}

.product-table tbody tr,
.data-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.product-table tbody tr:hover,
.data-table tbody tr:hover {
    background: var(--hover-bg);
}

.data-table th a {
    color: inherit;
    text-decoration: none;
}
.data-table th a::after {
    content: " \2195"; /* ↕ markerer sorterbar kolonne */
    opacity: 0.55;
}
.data-table th a:hover {
    text-decoration: underline;
}

/* Kolonnar */
.product-table .col-img {
    width: 72px;
    padding-right: 4px;
}

.product-table .col-enhet {
    width: 70px;
    color: #667;
    white-space: nowrap;
}

.product-table .col-num {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    width: 110px;
}

.product-table td.col-num {
    font-weight: 600;
    color: var(--primary-dark);
}

.product-table td.price-net-cell {
    color: var(--price-net);
}

.product-table .col-lager {
    width: 120px;
    white-space: nowrap;
}

.product-table .col-buy {
    width: 150px;
    text-align: right;
    white-space: nowrap;
}

.product-table td.buy-cell .inline-buy {
    justify-content: flex-end;
}

/* Produktcella: tittel / undertittel / varenr */
.product-table .row-title {
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}

.product-table .row-sub {
    color: #667;
    font-size: 13px;
    margin-top: 2px;
}

.product-table .row-sku {
    color: #8a929c;
    font-size: 12px;
    margin-top: 2px;
}

.table-thumb {
    width: 56px;
    height: 56px;
    object-fit: contain;
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid #e6ebf0;
    display: block;
}

.table-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.table-link:hover {
    text-decoration: underline;
}

/* PRODUKTKORT (fliser) — venstrejustert, luftig, fast biletfelt, botnrad låst nedst */
.product-card {
    background: #fff;
    padding: 16px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    text-align: left;
    cursor: pointer;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.product-card:hover {
    box-shadow: 0 4px 14px rgba(20, 38, 74, 0.16);
    transform: translateY(-1px);
}

.product-card .card-img {
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

.product-card .card-img img {
    max-height: 130px;
    max-width: 100%;
    width: auto;
    border-radius: var(--radius);
}

/* gruppefliser (berre bilete) beheld sentrert bilete */
.product-card > img {
    display: block;
    margin: 0 auto;
    border-radius: var(--radius);
    max-width: 100%;
}

.product-card .card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.3;
    margin: 0;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .product-title2 {
    font-size: 13px;
    color: #667;
    margin: 0;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .product-sku {
    font-size: 12px;
    color: #8a929c;
    margin: 2px 0 0;
}

.product-card .card-prices {
    margin-top: auto;      /* skuv prisane (og botnrada) ned så korta får lik oppbygging */
    padding-top: 14px;
}

.price-main {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-dark);
    line-height: 1.1;
}

.price-main.price-net {
    color: var(--price-net);
}

.price-sub {
    font-size: 12px;
    color: #7a828c;
    margin-top: 3px;
}

.product-card .card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #edf1f5;
}

.product-card .inline-buy input[type="number"] {
    width: 50px;
    padding: 6px 4px;
}

.product-card .inline-buy button {
    padding: 7px 12px;
}

/* FOOTER */
.footer {
    margin-top: 5px;
    padding: 5px;
    text-align: center;
    color: #666;
}

.breadcrumbs {
    margin-bottom: 15px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.breadcrumbs a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.breadcrumbs svg {
    margin: 0 4px;
    color: var(--primary); /* pila brukar stroke="currentColor" */
}

/* Rader i ordre-/fakturakopi (erstattar inline onmouseover) */
.doc-row {
    background-color: #fff;
    transition: background-color 0.2s;
}
.doc-row:hover {
    background-color: var(--hover-bg);
}

.breadcrumbs .current {
    color: #333;
    font-weight: 600;
}


/* //------------------------------------
// Login Page
//------------------------------------ */

.login-container {
    max-width: 400px;
    margin: 60px auto;
    padding: 30px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 0 12px rgba(0,0,0,0.1);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-form label {
    font-weight: 600;
}

.login-form input {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.login-form button {
    background: var(--primary);
    color: white;
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
}

.login-form button:hover {
    background: var(--primary-dark);
}

.login-error {
    background: #ffdddd;
    border-left: 4px solid #c00;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
}
/* //------------------------------------*/

.sidebar-user {
    background: #fff;
    border: 1px solid #ddd;
    padding: 12px;
    margin-top: 20px; /* boksen ligg under produktmeny-treet */
    border-radius: 6px;
}

/* Topprad: ikon ved sida av namn/konto */
.sidebar-user-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Lenkjeliste i full breidde under toppraden */
.sidebar-user-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-user-links .sidebar-logout {
    display: block;
    margin-top: 0;
    padding: 4px 2px;
    border-radius: 4px;
}

.sidebar-user-links .sidebar-logout:hover {
    background: var(--hover-bg);
    text-decoration: none;
}

.sidebar-user-icon {
    width: 42px;
    height: 42px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2rem;
}

.sidebar-user-info {
    flex: 1;
}

.sidebar-user-name {
    font-weight: 600;
    color: #333;
}

.sidebar-user-id {
    font-size: 0.85rem;
    color: #666;
    margin-top: 2px;
}

.sidebar-logout {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--primary);
    text-decoration: none;
}

.sidebar-logout:hover {
    text-decoration: underline;
}



.order-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
    background: white;
    border: 1px solid #e3e9f0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    font-size: 14px;
}

.order-table th {
    background: var(--primary-dark);
    color: white;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 0.78em;
    white-space: nowrap;
}

.order-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f6;
    vertical-align: middle;
}
.order-table tr:hover {
    /* background-color: var(--hover-bg); */
    background-color: var(--hover-bg);
}

.order-table tr:last-child td {
    border-bottom: none;
}

.order-extra-form {
    max-width: 700px;
    margin: 0;
    padding: 25px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    background: #fafafa;
}

.order-extra-form h2 {
    margin-bottom: 20px;
    color: var(--primary);
    font-size: 24px;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 8px;
}

/* GRID */
.order-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 30px;
    width: 100%;
    box-sizing: border-box;

}

/* Full width row */
.order-full {
    grid-column: 1 / 3;
}

/* Inputs */
.order-extra-form label {
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
    color: var(--primary);
}

.order-extra-form input[type="text"],
.order-extra-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 15px;
    background: white;
    box-sizing: border-box;
}

/* Double-size textarea */
.order-extra-form textarea {
    height: 180px;
    resize: vertical;
}

/* Button */
.checkout-btn {
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 20px;
}

.checkout-btn:hover {
    background: var(--primary-dark);
}

.center {
    margin: 10px;
    display: flex;
    place-self: center;
}

/* Container */
.cart-wrapper {
    max-width: 1200px;
    margin: 0;
}

/* Table */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 25px;
    background: white;
    border: 1px solid #e3e9f0;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    font-size: 14px;
}

.cart-table th {
    background: var(--primary-dark);
    color: white;
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    font-size: 0.78em;
    white-space: nowrap;
}

.cart-table td {
    padding: 12px 14px;
    border-bottom: 1px solid #eef2f6;
    vertical-align: middle;
}

.cart-table tr:last-child td {
    border-bottom: none;
}

/* Thumbnail */
.cart-thumb {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
}

/* Quantity input */
.qty-input {
    width: 70px;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 6px;
}

/* Remove link */
.remove-link {
    /* er ein <button> (POST + CSRF), men skal sjå ut som ei lenkje */
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
    color: var(--warning);
    font-weight: 600;
    text-decoration: none;
}

.remove-link:hover {
    text-decoration: underline;
}

/* Summary box */
.cart-summary {
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
    max-width: 350px;
    margin-left: auto;
    margin-bottom: 25px;
}

.cart-summary h3 {
    margin-top: 0;
    color: var(--primary);
}

.cart-summary .line {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 16px;
}

.cart-summary .total {
    font-weight: bold;
    font-size: 18px;
    margin-top: 10px;
}

/* Buttons */
.btn-secondary,
.btn-primary,
.checkout-btn {
    display: inline-flex;          /* same utsjånad for <a> og <button> */
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    height: 30px;
    text-decoration: none;
    box-sizing: border-box;
}

/* Knappar som er <a> må halde på kvit tekst ved hover — elles vinn den globale
   a:hover-fargen (--primary-dark) og teksten blir usynleg mot same bakgrunn. */
.btn-secondary:hover,
.btn-primary:hover,
.checkout-btn:hover {
    background: var(--primary-dark);
    color: white;
    text-decoration: none;
}

.cart-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 4px;
}
.cart-link {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.cart-icon-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* Flytt badge til å vere sentrert over ikonet */
.cart-count {
    position: absolute;
    top: -11px;
    left: 60%;
    transform: translateX(-50%);
    background: black;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 2px;
    border-radius: 7px;
    line-height: 1;
    min-width: 10px;
    text-align: center;
    transition: transform 0.2s ease;
}
/* Puls-effekt */
.cart-count.pulse {
    animation: cartPulse 0.45s ease-out;
}

@keyframes cartPulse {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* LAGERSTATUS (berre innlogga) */
.stock {
    display: inline-block;
    font-size: 0.9em;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
}
.stock.in-stock {
    color: var(--price-net);
    background: #e8f5ea;
}
.stock.out-of-stock {
    color: var(--warning);
    background: #fbeaea;
}
.product-stock-line {
    margin: 6px 0 8px;
}

/* KJØP DIREKTE FRÅ LISTE/FLIS (berre innlogga) */
.inline-buy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}
.inline-buy input[type="number"] {
    width: 58px;
    padding: 7px 6px;
    border: 1px solid #ccc;
    border-radius: var(--radius);
    font-size: 14px;
    text-align: center;
}
.inline-buy button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    white-space: nowrap;
}
.inline-buy button:hover {
    background: var(--primary-dark);
}
/* PAGINATION */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.pagination .page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    background: white;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
}

.pagination a.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .page-btn.disabled {
    opacity: 0.4;
}

.pagination .page-info {
    padding: 0 10px;
    color: #666;
    font-size: 0.95em;
}

/* =========================================================
   RESPONSIVT / MOBIL
   (berre media queries og hjelpeklassar — desktop er uendra)
   ========================================================= */

/* Bilete skal aldri sprenge containeren sin */
img {
    max-width: 100%;
    height: auto;
}

/* Hjelpeklasse: legg breie tabellar i <div class="table-scroll">
   så dei kan rullast sidelengs på små skjermar i staden for å
   sprenge sida. */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.table-scroll > table {
    min-width: 560px; /* tabellen held lesbar breidde — resten blir rull */
}

/* Knapp for å opne/lukke sidemenyen — synleg berre på mobil */
.sidebar-toggle {
    display: none;
}

@media (max-width: 900px) {

    /* ---- Header ---- */
    .top-header {
        height: 84px;
        padding: 0 14px;
    }
    .top-header .header-car {
        height: 78px;
    }
    .header-tagline {
        height: 28px;
        margin-right: 6px;
    }
    .brand-strip {
        font-size: 10px;
        letter-spacing: 0.3px;
    }

    /* ---- Toppmeny: burgar-meny på mobil ---- */
    .top-nav {
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
    }

    .top-nav .nav-toggle {
        display: inline-flex;
        align-items: center;
        background: none;
        border: 1px solid rgba(255, 255, 255, 0.45);
        color: white;
        padding: 8px 14px;
        border-radius: var(--radius);
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
    }

    /* Handlekorga er alltid synleg ved sida av burgaren */
    .top-nav .nav-cart-mobile {
        display: inline-flex;
        margin-left: auto;
        padding: 6px 10px;
    }

    /* Lenkene er skjulte til burgaren blir opna */
    .top-nav-links {
        display: none;
        flex: 0 0 100%; /* full breidde → legg seg på eiga rad under knappen */
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding-top: 6px;
    }
    .top-nav.open .top-nav-links {
        display: flex;
    }

    .top-nav-links a {
        margin-left: 0;
        padding: 11px 8px;
        border-radius: 4px;
    }
    .top-nav-links a:last-child,
    .top-nav-links .push-right {
        margin-left: 0;
    }
    .top-nav-links a:hover {
        background: rgba(255, 255, 255, 0.12);
    }
    /* Slå av understrek-animasjonen i vertikal liste */
    .top-nav-links a::after {
        display: none;
    }

    /* ---- Layout: sidemeny over innhaldet ---- */
    .layout {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 10px;
    }

    .sidebar {
        white-space: normal;
        min-width: 0;
        padding: 12px;
    }

    /* Sidemenyen kollapsar bak ein knapp på mobil */
    .sidebar-toggle {
        display: block;
        width: 100%;
        background: var(--primary);
        color: white;
        border: none;
        padding: 11px 14px;
        border-radius: var(--radius);
        font-size: 15px;
        font-weight: 600;
        text-align: left;
        cursor: pointer;
    }
    .sidebar-inner {
        display: none;
        margin-top: 12px;
    }
    .sidebar.open .sidebar-inner {
        display: block;
    }

    /* ---- Kort og skjema ---- */
    .main_card {
        margin: 10px;
        padding: 12px;
    }

    .cart-summary {
        max-width: 100%;
        margin-left: 0;
    }

    .order-grid {
        grid-template-columns: 1fr;
    }
    .order-full {
        grid-column: auto;
    }
    .order-extra-form {
        padding: 15px;
    }
    .order-extra-form textarea {
        height: 120px;
    }

    .login-container {
        margin: 24px 12px;
        padding: 20px;
    }
}

@media (max-width: 600px) {

    .top-header {
        height: 68px;
        padding: 0 8px;
        justify-content: space-between;
        gap: 4px;
    }
    .top-header .header-car {
        height: 60px;
    }
    .header-tagline {
        height: 16px;
        margin-right: 4px;
        flex-shrink: 0;
    }
    .brand-strip {
        display: none;
    }

    .layout {
        padding: 8px;
        gap: 8px;
    }
    .main_card {
        margin: 8px;
        padding: 10px;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    /* Mobil: ingen tabellvisning — skjul valet (products.php byter automatisk til fliser) */
    .view-toggle {
        display: none;
    }
    .product-card {
        padding: 10px;
    }

    /* Kjøpsknappen får full breidde på små skjermar */
    .product-buy-form {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        width: 100%;
    }
    .product-buy-form button {
        flex: 1 1 100%;
    }
}