/* ===================== Basispagina ===================== */
.product-page{
    padding: 40px 20px;
    background-color:#f4f7f6;
    font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color:#333;
}

/* ===================== Hoofdlayout (Grid) ===================== */
.product-header{
    display:grid;
    grid-template-columns:minmax(260px,420px) 1fr; /* links media, rechts content */
    gap:32px;
    align-items:start;
    max-width:1200px;
    margin:0 auto;
}

/* Linkerkolom */
.media-column{
    display:flex;
    flex-direction:column;
    gap:18px;
    min-width:0;
}

/* Beschrijving links */
.product-desc{
    background:#fff;
    border-radius:16px;
    box-shadow:0 8px 20px rgba(46,204,64,.10);
    border:1px solid #e0e4e8;
    padding:16px 16px 10px;
}
.desc-details{ position:relative; }
.desc-summary{
    list-style:none; cursor:pointer; margin:0 0 8px 0;
    font-weight:700; color:#27ae60; display:inline-flex; align-items:center; gap:6px; user-select:none;
}
.desc-summary::-webkit-details-marker{ display:none; }
.desc-summary::after{
    content:"▼"; font-size:.8rem; transform:translateY(1px); transition:transform .2s ease;
}
.desc-details[open] .desc-summary::after{ transform:rotate(180deg) translateY(-1px); }
.desc-summary span{ border-bottom:1px dashed rgba(39,174,96,.5); }
.desc-body{
    font-size:.95rem; line-height:1.55; color:#2c3e50; position:relative;
}
.desc-details:not([open]) .desc-body{
    display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:6; overflow:hidden;
}
.desc-details:not([open]) .desc-body::after{
    content:""; position:absolute; bottom:0; left:0; right:0; height:2.8rem;
    background:linear-gradient(to bottom, rgba(255,255,255,0), #fff 80%);
}

/* ===================== Rechterkolom ===================== */
.product-details{
    background:#fff;
    border-radius:16px;
    box-shadow:0 8px 30px rgba(46,204,64,.15);
    padding: 10px 30px 40px 30px;
    display:flex;
    flex-direction:column;
    min-width:0;
    position:relative;
}

/* Terugknop (niet sticky) */
.back-button{
    position:static;
    align-self:flex-start;
    display:inline-flex; align-items:center; gap:8px;
    margin-bottom:26px;
    color:#27ae60; text-decoration:none; font-weight:700; font-size:15px;
    padding:10px 14px; border-radius:10px; border:2px solid #27ae60; background:#fff;
    box-shadow:0 3px 12px rgba(39,174,96,.12);
    transition:background-color .2s, color .2s, box-shadow .2s, transform .06s;
    user-select:none;
}
.back-button:hover{ background:#27ae60; color:#fff; box-shadow:0 6px 20px rgba(39,174,96,.28); }
.back-button:active{ transform:translateY(1px); }

/* Titel & meta */
.product-details h1{
    font-size:2.4rem; margin-bottom:22px; color:#2c3e50; font-weight:700; line-height:1.15;
}
.product-meta{
    display:flex; flex-wrap:wrap; gap:10px; margin:-6px 0 18px;
}
.meta-item{
    display:inline-flex; align-items:center; gap:8px;
    background:#f6fbf7; border:1px solid #e0e4e8; border-radius:9999px; padding:6px 12px;
    box-shadow:0 4px 10px rgba(39,174,96,.10);
}
.meta-label{
    font-size:.85rem; font-weight:700; color:#27ae60; text-transform:uppercase; letter-spacing:.02em; user-select:none; white-space:nowrap;
}
.meta-value{
    font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono","Courier New", monospace;
    font-weight:700; color:#2c3e50; letter-spacing:.02em; white-space:nowrap;
}

/* ===================== Animaties & banners ===================== */
@keyframes fadeInUp{ 0%{opacity:0; transform:translateY(20px);} 100%{opacity:1; transform:translateY(0);} }
.animate-fade-in-up{ animation:fadeInUp .7s ease-out; }

.savings-banner{
    background-color:#e9fbe9; border-left:4px solid #2ecc40; color:#2c3e50; font-weight:600;
    padding:14px 18px; border-radius:10px; margin-bottom:25px; font-size:1rem;
    box-shadow:0 4px 10px rgba(46,204,64,.1);
    opacity:0; animation:fadeInUp .8s ease forwards; animation-delay:.2s;
}

.info-banner{
    background-color:#f6fbf7; border-left:4px solid #27ae60; color:#2c3e50; font-weight:600;
    padding:14px 18px; border-radius:10px; margin-bottom:20px;
    box-shadow:0 4px 10px rgba(39,174,96,.10); display:flex; align-items:flex-start; gap:10px;
}
.info-icon{ font-size:1.25rem; line-height:1; user-select:none; }
.info-text strong{ display:block; margin-bottom:2px; }

/* ===================== Prijskaarten ===================== */
.price-list{
    background:#fff; border:1px solid #e0e4e8; border-radius:12px;
    padding:25px 30px; margin-top:26px;
    box-shadow:0 4px 12px rgba(0,0,0,.05);
    transition:box-shadow .3s ease, transform .2s ease;
}
.price-list:hover{ transform:translateY(-1px); }

.price-list.cheapest{
    background:#e6f9e6; border-left:5px solid #27ae60;
    box-shadow:0 6px 20px rgba(39,174,96,.28);
    font-weight:700; position:relative;
}
.price-list.cheapest:hover{
    transform:translateY(-1px) scale(1.01);
    box-shadow:0 10px 30px rgba(39,174,96,.4);
}

/* Rij-inhoud (desktop/tablet) */
.price-row{
    display:flex; align-items:center; gap:16px;
    padding:14px 0; border-bottom:1px solid #f0f0f0; flex-wrap:wrap;
}
.price-row:last-child{ border-bottom:none; }

/* Winkelnamen */
.store-name{
    writing-mode:horizontal-tb;
    flex:2 1 260px; min-width:0; max-width:100%;
    line-height:1.25; font-weight:600; color:#34495e;
    display:flex; align-items:center; gap:8px; row-gap:6px; flex-wrap:wrap;
    font-size:1.05rem;
    white-space:normal; word-break:normal; overflow-wrap:break-word; hyphens:auto;
}
.store-name *{ white-space:inherit; min-width:0; }

/* Badges */
.badge-cheapest{
    background:#d4f5d4; color:#27ae60; font-weight:600; font-size:.9rem;
    padding:4px 8px; border-radius:12px; white-space:nowrap; user-select:none;
}
.discount-badge{
    background:#e74c3c; color:#fff; font-weight:700; font-size:.9rem;
    padding:5px 10px; border-radius:50px; white-space:nowrap;
    user-select:none; box-shadow:0 4px 12px rgba(231,76,60,.4);
}
@keyframes popIn{ 0%{transform:scale(.8); opacity:0;} 60%{transform:scale(1.15); opacity:1;} 100%{transform:scale(1);} }
.animate-pop{ animation:popIn .5s ease-out; }

/* Lage voorraad */
.stock-warning{
    background:#ffe8cc; color:#8a4b00; border:1px solid #ffc078;
    font-weight:700; font-size:.9rem; padding:4px 10px; border-radius:12px;
    box-shadow:0 4px 10px rgba(255,160,54,.25);
    display:inline-flex; align-items:center; gap:6px; line-height:1.2;
    white-space:normal;
    word-break:normal;
    overflow-wrap:break-word;
    max-width:100%;
}

/* Optioneel: subtiele oranje tint bij lage voorraad */
.price-list:has(.stock-warning):not(.out-of-stock):not(.cheapest){
    background:#fff7ea; border-left:5px solid #ffa94d; box-shadow:0 6px 20px rgba(255,170,77,.20);
}

/* Prijs */
.price-value{
    flex:1 1 140px; min-width:8.5rem;
    display:flex; justify-content:center; align-items:center;
    font-weight:800; font-size:1.3rem; color:#27ae60; text-align:center;
}
.price-discounted{ display:flex; flex-direction:column; gap:2px; align-items:flex-start; }
.old-price{ text-decoration:line-through; color:#999; font-size:.95rem; font-weight:500; }
.new-price{ color:#27ae60; font-weight:800; font-size:1.3rem; }

/* Knop (desktop compact) */
.buy-button{
    flex:0 0 auto;
    min-height:44px; padding:12px 20px;
    background-color:#27ae60; color:#fff; border:none; border-radius:8px;
    font-size:15px; font-weight:700; text-align:center; text-decoration:none; cursor:pointer;
    transition:background-color .2s, box-shadow .2s, transform .06s;
    box-shadow:0 6px 20px rgba(39,174,96,.4); user-select:none;
}
.buy-button:hover{ background:#219150; box-shadow:0 8px 28px rgba(33,145,80,.6); }
.buy-button:active{ transform:translateY(1px); }

.price-list.out-of-stock{
    background:#f5f5f5; color:#999; border:1px solid #ddd; opacity:.75;
}
.price-list.out-of-stock .buy-button{
    background:#ccc; color:#666; cursor:not-allowed; box-shadow:none;
}
.buy-button.disabled{
    display:inline-block; text-align:center; padding:12px 20px; border-radius:8px;
    background:#ccc; color:#666; font-size:15px; font-weight:600; cursor:not-allowed; box-shadow:none;
}

/* ===================== Breakpoints ===================== */
@media (max-width:1100px){
    .product-header{ grid-template-columns:minmax(220px,360px) 1fr; gap:28px; }
    .product-image img{ max-height:clamp(220px,40vh,460px); }
}
@media (max-width:900px){
    .product-header{ grid-template-columns:minmax(200px,320px) 1fr; gap:22px; }
    .product-image img{ max-height:clamp(200px,38vh,420px); }
    .product-details h1{ font-size:2rem; }
}

/* ===== Mobiel: stapelen + brede knop op eigen regel ===== */
@media (max-width:760px){
    .product-header{
        grid-template-columns:1fr; gap:20px; max-width:100%; padding:0 10px;
    }
    .product-details{ padding:25px 20px; box-shadow:none; }
    .product-details h1{ font-size:clamp(1.4rem,4.5vw,1.8rem); line-height:1.25; margin-bottom:18px; }
    .savings-banner{ font-size:.95rem; padding:12px 14px; }
    .back-button{ margin-bottom:16px; }
    .price-list{ padding:18px; margin-top:16px; }

    /* Winkel/prijs/knop onder elkaar — brede knop alleen op mobiel */
    .price-row{
        /* van: grid-template-columns: 1fr 140px; naar één kolom */
        grid-template-columns: 1fr !important;
        grid-template-areas:
      "store"
      "price"
      "button";
    }

    .store-name{
        grid-area:store;
        font-size:1rem; line-height:1.25; min-width:0;
        column-gap:8px; row-gap:6px; flex-wrap:wrap;
    }
    .store-name .badge-cheapest,
    .store-name .discount-badge,
    .store-name .stock-warning{
        flex:0 1 auto;
        max-width:100%;
        margin-top:2px;
    }

    .price-value{
        grid-area:price; justify-content:flex-start; text-align:left; font-size:1.15rem; min-width:0;
    }
    .buy-button{
        width: 100% !important;
        justify-self: stretch !important;
        display: block;
        min-height: 46px;
        padding: 12px;
    }

    .product-image img{ padding:8px; max-height:clamp(200px,36vh,380px); }
    .badge-cheapest{ font-size:.8rem; padding:3px 6px; }
    .product-meta{ margin:-6px 0 14px; }
    .meta-item{ padding:6px 10px; }
    .meta-label{ font-size:.8rem; }
    .meta-value{ font-size:.95rem; }
    .info-banner{ padding:12px 14px; font-size:.95rem; }
}

/* Zeer smal: knop onder de prijs in één kolom */
@media (max-width:380px){
    .price-row{
        grid-template-columns:1fr;
        grid-template-areas:
      "store"
      "price"
      "button";
    }
    .buy-button{ width:100%; }
}

/* === Desktop/Tablet: vaste breedte + uitlijnen (samengevoegd) === */
@media (min-width: 761px){
    .buy-button,
    .buy-button.disabled{
        box-sizing: border-box;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 180px !important;     /* kies 160–200px naar smaak */
        min-height: 46px;
        padding: 12px 16px;
        white-space: nowrap;         /* 'Uitverkocht' blijft op één regel */
        font-weight: 700;
        margin-left: auto;           /* duwt de knop naar de rechterkant van de (nieuwe) regel */
    }
}

/* === Mobiel: volle breedte (samengevoegd) === */
@media (max-width: 760px){
    .buy-button,
    .buy-button.disabled{
        box-sizing: border-box;
        display: block !important;
        width: 100% !important;
        min-height: 48px;
        padding: 12px;
        white-space: normal;         /* mag wrappen als het echt moet */
        font-weight: 700;
        margin-left: 0 !important;
    }
}

/* Back-button staat nu in .media-column, dus geen extra marge nodig */
.media-column .back-button { margin-bottom: 0; }

/* Hout ruimte vast en centreer inhoud; geen CLS (samengevoegd) */
.product-image{
    aspect-ratio: var(--img-ratio, 1 / 1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0,0,0,.08);
    margin:0;
}

/* Afbeelding vult de box (samengevoegd) */
.product-image img{
    width: 100%;
    height: 100% !important;    /* overrule oude height:auto */
    object-fit: contain;
    display: block;
    padding: 12px;
    border-radius: 0;
    max-height:clamp(240px,42vh,520px);
}

/* Verborgen tekst-element standaard uit */
.product-image .no-image-text{
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    text-align: center;
    font-weight: 700;
    color: #6b7280;
    background: #f8fafc;
}

/* Als de afbeelding faalt of ontbreekt: toon tekst, verberg img */
.product-image img.is-fallback{ display: none; }
.product-image img.is-fallback ~ .no-image-text{ display: flex; }

/* Grid met extra rij voor terugknop */
.product-header.with-back{
    display:grid;
    grid-template-columns: minmax(260px,420px) 1fr;
    grid-template-areas:
    "back   back"
    "media  details";
    gap: 16px 32px;
}

/* Koppel de cellen aan de areas */
.product-header.with-back .back-cell     { grid-area: back; }
.product-header.with-back .media-column  { grid-area: media; }
.product-header.with-back .product-details { grid-area: details; }

/* Zorg dat de knop netjes links staat en geen rare extra marges heeft */
.back-cell{
    display:flex;
    align-items:center;
}
.back-cell .back-button{ margin: 0; }

/* Mobiel stapelen: knop bovenaan, dan media, dan details */
@media (max-width: 760px){
    .product-header.with-back{
        grid-template-columns: 1fr;
        grid-template-areas:
      "back"
      "media"
      "details";
        gap: 12px;
    }
    .product-page {
        padding:23px 20px;
    }
}

/* ---- Fix: linker kolom moet mee krimpen ---- */
.product-header,
.product-header.with-back{
    /* Links: krimpt met viewport (max 420px), rechts: rest */
    grid-template-columns: minmax(0, min(42vw, 420px)) 1fr !important;
}

/* Tussenbreakpoints: laat nog iets verder meeschalen */
@media (max-width:1100px){
    .product-header,
    .product-header.with-back{
        grid-template-columns: minmax(0, min(45vw, 360px)) 1fr !important;
    }
}
@media (max-width:900px){
    .product-header,
    .product-header.with-back{
        grid-template-columns: minmax(0, min(48vw, 320px)) 1fr !important;
    }
}

/* Belangrijk: items in het grid moeten ook echt kunnen krimpen */
.product-header > *,
.product-header.with-back > *{ min-width: 0 !important; }

/* Extra zekerheid voor het mediablok */
.media-column,
.product-image{ min-width:0 !important; }

/* Mobiel: onder elkaar, volledige breedte (behoudt jouw gedrag) */
@media (max-width:760px){
    .product-header,
    .product-header.with-back{
        grid-template-columns: 1fr !important;
    }
}

.store-logo { vertical-align: middle; border-radius: 4px }
.mr-2 { margin-right: .5rem }
