/* ================================================================
   Alosmania Frontend — Single Product Page
   ================================================================ */

/* The product section is full-bleed, but the inner container must keep the
   site-wide 1400px cap (from .container in main.css) so the whole page —
   header, gallery, add-to-cart, related products — stays centered and scales
   together on big monitors or when the browser is zoomed out. Do NOT force
   max-width:100% here; that was letting the product column spill across the
   entire viewport while the header stayed capped. */
.product-page-section{max-width:100%;overflow-x:hidden}
.product-page-container{overflow-x:hidden}
.product-layout{display:grid;grid-template-columns:1fr 1fr;gap:40px;align-items:start;min-width:0;max-width:100%}
.product-layout > *{min-width:0;max-width:100%}

/* Desktop / large screens: 50% image, 50% info — even split. */
@media(min-width:1025px){
    .product-layout{grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:48px}
}

/* ===== Gallery ===== */
.product-gallery{position:sticky;top:80px;width:100%;max-width:100%;min-width:0;overflow:hidden}
.product-main-image{position:relative;width:100%;max-width:100%;max-height:680px;border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;background:#f9fafb;margin-bottom:12px;cursor:zoom-in;aspect-ratio:1/1}
.product-main-image img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;transition:transform .3s;display:block}
.product-main-image:hover img{transform:scale(1.05)}
.product-thumbs-wrap{display:flex;align-items:center;gap:4px;width:100%;max-width:100%;min-width:0;overflow:hidden;box-sizing:border-box}
.product-thumbs{display:flex;flex-wrap:nowrap;gap:8px;overflow-x:auto;overflow-y:hidden;scroll-behavior:smooth;flex:1 1 auto;min-width:0;max-width:100%;-webkit-overflow-scrolling:touch;scrollbar-width:none;touch-action:pan-x;overscroll-behavior-x:contain}
.product-thumbs::-webkit-scrollbar{display:none}
.product-thumbs-nav{flex:0 0 30px;width:30px;height:30px;border:1px solid var(--border);border-radius:50%;background:#fff;color:var(--text);font-size:20px;line-height:1;cursor:pointer;display:none;align-items:center;justify-content:center;padding:0;transition:background .15s,border-color .15s,opacity .15s;z-index:2;box-shadow:0 1px 4px rgba(0,0,0,.08)}
.product-thumbs-wrap.is-scrollable .product-thumbs-nav,
.product-thumbs-wrap.has-many-thumbs .product-thumbs-nav{display:inline-flex}
.product-thumbs-nav:hover:not(:disabled){background:var(--bg-alt);border-color:var(--accent)}
.product-thumbs-nav:disabled{opacity:.35;cursor:default}
.product-thumb{width:72px;height:72px;min-width:72px;border:2px solid var(--border);border-radius:6px;overflow:hidden;cursor:pointer;flex:0 0 auto;transition:border-color .2s}
.product-thumb.active,.product-thumb:hover{border-color:var(--accent)}
.product-thumb img{width:100%;height:100%;object-fit:cover}

/* ===== Product Info ===== */
.product-info h1{font-size:24px;font-weight:700;color:var(--text);margin-bottom:10px;line-height:1.3}
.product-price-box{display:flex;align-items:baseline;gap:12px;margin-bottom:14px}
.product-price-current{font-size:28px;font-weight:800;color:var(--accent)}
.product-price-original{font-size:18px;color:var(--text2);text-decoration:line-through}
.product-price-save{font-size:13px;font-weight:600;color:var(--success);background:rgba(0,196,154,.1);padding:3px 10px;border-radius:20px}
.product-short-desc{font-size:14px;color:var(--text2);line-height:1.7;margin-bottom:16px}
.product-stock{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:600;margin-bottom:16px;padding:4px 12px;border-radius:20px}
.product-stock.in-stock{background:rgba(0,196,154,.1);color:var(--success)}
.product-stock.out-of-stock{background:rgba(255,77,109,.1);color:var(--error)}

/* Variation Selectors */
.product-variations{margin-bottom:16px}
.variation-group{margin-bottom:12px}
.variation-group label{display:block;font-size:13px;font-weight:600;color:var(--text);margin-bottom:6px}
.variation-group select{width:100%;padding:10px 14px;border:1.5px solid var(--border);border-radius:var(--radius);font-size:14px}

/* Quantity + Buttons */
.product-qty-row{display:flex;align-items:center;gap:12px;margin-bottom:16px}
.qty-selector{display:flex;align-items:center;border:1.5px solid var(--border);border-radius:var(--radius);overflow:hidden}
.qty-btn{width:40px;height:40px;border:none;background:var(--bg-alt);font-size:16px;font-weight:700;color:var(--text);cursor:pointer;transition:background .15s;display:flex;align-items:center;justify-content:center}
.qty-btn:hover{background:var(--border)}
.qty-input{width:50px;height:40px;border:none;text-align:center;font-size:15px;font-weight:600;color:var(--text);background:#fff;-moz-appearance:textfield;appearance:textfield}
.qty-input::-webkit-outer-spin-button,.qty-input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.product-buttons{display:flex;gap:10px;margin-bottom:16px}
.product-buttons .btn{flex:1;padding:14px 24px;font-size:15px}

/* Meta Info */
.product-meta-bar{display:flex;flex-direction:column;gap:8px;padding:14px 0;border-top:1px solid var(--border);border-bottom:1px solid var(--border);margin-bottom:16px}
.product-meta-item{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--text2)}
.product-meta-item svg{width:16px;height:16px;flex-shrink:0;color:var(--accent)}
.product-meta-item strong{color:var(--text)}
.product-watching{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--error);font-weight:600}

/* Tabs */
.product-tabs{margin-top:48px}
.product-tabs-nav{display:flex;gap:0;border-bottom:2px solid var(--border);margin-bottom:24px}
.product-tab-btn{padding:12px 24px;font-size:14px;font-weight:600;color:var(--text2);cursor:pointer;border:none;background:none;border-bottom:2px solid transparent;margin-bottom:-2px;transition:all .15s}
.product-tab-btn:hover{color:var(--text)}
.product-tab-btn.active{color:var(--accent);border-bottom-color:var(--accent)}
.product-tab-content{display:none;font-size:14px;line-height:1.8;color:var(--text)}
.product-tab-content.active{display:block}
.product-tab-content h2,.product-tab-content h3{margin:16px 0 8px}
.product-tab-content ul,.product-tab-content ol{padding-left:20px;margin-bottom:12px}
.product-tab-content{overflow-wrap:break-word;word-break:break-word}
.product-tab-content table:not(.desc-spec-table){max-width:100%;display:block;overflow-x:auto}
#tab-description{max-width:720px}
#tab-description img{
    height:auto;
    border-radius:var(--radius);
    margin:12px 0;
    max-width:100%;
    display:inline-block;
    vertical-align:middle;
}
#tab-description img[style*="width"]{max-width:100%;box-sizing:border-box}

/* Spec boxes — same bordered table look as Additional Info tab */
.product-tab-content .desc-spec-box{margin:16px 0}
.product-tab-content .desc-spec-table{
    width:100%;
    border-collapse:collapse;
    display:table!important;
    max-width:100%;
    table-layout:fixed;
}
.product-tab-content .desc-spec-table td{
    padding:8px;
    border:1px solid var(--border);
    vertical-align:top;
    font-size:14px;
    line-height:1.5;
    word-break:break-word;
}
.product-tab-content .desc-spec-label{font-weight:600;width:30%}
.product-tab-content .desc-spec-cols-2 .desc-spec-label{width:18%}
.product-tab-content .desc-spec-cols-2 .desc-spec-value{width:auto}
@media(max-width:768px){
    .product-tab-content .desc-spec-cols-2 .desc-spec-table tr{display:table-row;width:100%}
    .product-tab-content .desc-spec-cols-2 .desc-spec-table td{display:table-cell;width:auto!important}
}

/* Related Products */
.related-products{margin-top:48px}

/* ===== Mobile ===== */
@media(max-width:768px){
    .product-layout{grid-template-columns:1fr;gap:20px;width:100%;overflow:hidden}
    .product-gallery{position:static;width:100%;max-width:100%;overflow:hidden}
    .product-info h1{font-size:20px}
    .product-price-current{font-size:24px}
    .product-buttons{flex-direction:column}
    .product-buttons .btn{width:100%}
    .product-thumbs-wrap{gap:2px;padding:0}
    .product-thumbs{gap:6px;padding:2px 0}
    .product-thumb{width:52px;height:52px;min-width:52px}
    .product-thumbs-nav{flex:0 0 26px;width:26px;height:26px;font-size:17px}
    .product-thumbs-wrap.has-many-thumbs .product-thumbs-nav{display:inline-flex!important}
    /* Sticky bottom bar on mobile */
    .product-sticky-bar{position:fixed;bottom:0;left:0;right:0;background:#fff;border-top:1px solid var(--border);padding:10px 16px;display:flex;gap:10px;z-index:998}
    .product-sticky-bar .btn{flex:1;padding:12px;font-size:14px}
}
@media(min-width:769px){
    .product-sticky-bar{display:none}
}

/* ===== Review Section ===== */
.rv-section-wrap{display:flex;gap:24px;flex-wrap:wrap;align-items:flex-start;}
.rv-summary-box{flex:0 0 160px;text-align:center;padding:20px 16px;background:var(--card-bg2,#f9f9f9);border-radius:12px;border:1px solid var(--border,#e5e7eb);}
.rv-form-box{flex:1;min-width:260px;max-width:480px;}
.rv-form-card{border:1px solid var(--border,#e5e7eb);border-radius:12px;padding:16px;}
@media(max-width:768px){
    .rv-section-wrap{flex-direction:column;gap:16px;}
    .rv-summary-box{flex:none;width:100%;}
    .rv-form-box{max-width:100%;min-width:0;width:100%;}
}

/* Variation swatch UI (WooCommerce-style)
   ================================================================ */

/* Attribute group (Color:, Size:, etc.) */
.variation-attr-group{margin-bottom:14px}
.variation-attr-label{display:block;font-size:13px;font-weight:600;color:var(--text);margin-bottom:8px}
.variation-attr-selected{color:var(--accent);font-weight:700}
.variation-swatches{display:flex;flex-wrap:wrap;gap:8px}
.variation-swatch{
    display:inline-flex;align-items:center;gap:6px;
    min-width:44px;min-height:36px;padding:6px 12px;
    border:1.5px solid var(--border);border-radius:8px;
    background:#fff;color:var(--text);
    font-size:13px;font-weight:600;cursor:pointer;
    transition:all .15s ease;
    text-transform:capitalize;
    line-height:1;font-family:inherit;
}
.variation-swatch:hover{border-color:var(--accent);color:var(--accent)}
.variation-swatch.active{
    background:var(--accent);color:#fff;
    border-color:var(--accent);
    box-shadow:0 2px 6px rgba(59,130,246,.25);
}
.variation-swatch.active .vs-icon{box-shadow:0 0 0 1.5px #fff,0 0 0 3px var(--accent)}
.variation-swatch.oos{opacity:.45;cursor:not-allowed;text-decoration:line-through}
.variation-swatch.oos:hover{border-color:var(--border);color:var(--text)}

/* Swatch icon (image thumbnail OR colored dot fallback) */
.vs-icon{
    width:22px;height:22px;border-radius:50%;
    overflow:hidden;display:inline-block;
    background:#f3f4f6;flex-shrink:0;
    box-shadow:inset 0 0 0 1px rgba(0,0,0,.06);
}
.vs-icon img{width:100%;height:100%;object-fit:cover;display:block}
.vs-icon-dot{
    width:100%;height:100%;border-radius:50%;
    display:inline-block;
}
.vs-label{font-size:13px}
.vs-stock-tag{display:block;font-size:10px;font-weight:600;color:var(--text2);margin-top:2px;line-height:1.2}
.variation-swatch.oos .vs-stock-tag{color:var(--error)}

/* Live stock notice — updates in-page as the user changes variation or qty */
.stock-notice{
    flex:1;font-size:13px;font-weight:600;line-height:1.4;
    padding:6px 12px;border-radius:6px;
    display:flex;align-items:center;gap:6px;
    min-height:32px;
    transition:background-color .2s, color .2s;
}
.stock-notice:empty{display:none}
.stock-notice.is-ok{background:rgba(0,196,154,.08);color:var(--success)}
.stock-notice.is-warn{background:rgba(245,158,11,.1);color:#b45309}
.stock-notice.is-bad{background:rgba(255,77,109,.1);color:var(--error)}

/* Qty +/− disabled state when at stock limit */
.qty-btn:disabled{opacity:.4;cursor:not-allowed;background:var(--bg-alt)}

/* Image Gallery Swatch Grid Layout (Gallery Photos Only) */
.swatches-image-grid{display:flex;flex-wrap:wrap;gap:10px}
.variation-swatch-img{
    width:58px;height:58px;min-width:58px;min-height:58px;
    padding:2px !important;border:1.5px solid var(--border) !important;
    border-radius:8px !important;background:#fff !important;
    cursor:pointer;position:relative;overflow:hidden;
    transition:all .2s ease;
    display:inline-flex !important;align-items:center;justify-content:center;
    box-sizing:border-box;
}
.variation-swatch-img:hover{
    border-color:var(--text) !important;
    transform:translateY(-2px);
    box-shadow:0 4px 12px rgba(0,0,0,.08);
}
.variation-swatch-img.active{
    border:2px solid var(--text) !important;
    background:#fff !important;
    color:var(--text) !important;
    box-shadow:0 0 0 1px var(--text),0 2px 8px rgba(0,0,0,.12) !important;
}
.variation-swatch-img img{
    width:100%;height:100%;object-fit:cover;
    border-radius:6px;display:block;
}
.variation-swatch-img .vs-color-square{
    width:100%;height:100%;border-radius:6px;display:block;
}
.variation-swatch-img.oos{
    opacity:.35 !important;cursor:not-allowed;filter:grayscale(80%);
}
.variation-swatch-img.oos::after{
    content:'';position:absolute;top:50%;left:-15%;
    width:130%;height:2px;background:#ef4444;transform:rotate(-45deg);
}

.variation-swatch-pill{
    min-width:42px;min-height:38px;padding:6px 14px;
    border:1.5px solid var(--border);border-radius:8px;
    background:#fff;color:var(--text);font-size:13px;font-weight:600;
    cursor:pointer;transition:all .15s ease;
    display:inline-flex;align-items:center;justify-content:center;
}
.variation-swatch-pill:hover{border-color:var(--accent);color:var(--accent)}
.variation-swatch-pill.active{
    border:2px solid var(--text) !important;
    background:var(--text) !important;
    color:#fff !important;
    box-shadow:0 2px 6px rgba(0,0,0,.15);
}
.variation-swatch-pill.oos{opacity:.35;cursor:not-allowed;text-decoration:line-through}

/* Required Variation Highlight on Validation */
@keyframes shakeAttr{
    0%,100%{transform:translateX(0)}
    20%,60%{transform:translateX(-5px)}
    40%,80%{transform:translateX(5px)}
}
.attr-error-highlight{animation:shakeAttr .4s ease}
.attr-error-highlight .variation-attr-label{color:#ef4444 !important;font-weight:700 !important}
.attr-error-highlight .variation-swatches{
    outline:2px dashed #ef4444;outline-offset:4px;border-radius:8px;padding:2px;
}


