/* Hide default dropdown */
.adv-var-cards-active .variations{
    display:none!important;
}

/* ================================
   GRID WRAPPER
================================ */
.adv-var-wrapper{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:18px;
    align-items:stretch;
    margin-bottom:20px;
    background:#fbfbfb;
    padding:10px;
    border-radius:10px;
}

/* ================================
   CARD
================================ */
.adv-var-card{
    border:2px solid #636385;
    border-radius:14px;
    overflow:hidden;
    cursor:pointer;
    transition:.25s ease;
    display:flex;
    flex-direction:column;
    height:100%;
    background:#ffffff;
    position:relative;
}

/* ================================
   CONTENT SECTION
================================ */
.adv-var-content{
    display:flex;
    justify-content:space-between;
    padding:10px 10px 4px 10px;
    gap:10px;
    flex:1;
    min-width:0;
}

/* LEFT SIDE */
.adv-var-left{
    flex:1;
    display:flex;
    flex-direction:column;
    min-width:0;
}

/* ROW 1 */
/* --adv-name-size / --adv-name-color: global (wrapper) othoba
   per-variation (element) theke set hoy. Set na thakle niche-r
   fallback (responsive) value cholbe. */
.adv-var-name{
    font-weight:600;
    line-height:1.3;
    font-size:var(--adv-name-size, 15px);
    color:var(--adv-name-color, inherit);
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
    word-break:break-word;
    overflow-wrap:anywhere;
}

/* ROW 2 */
.adv-var-meta{
    font-size:var(--adv-meta-size, 10px);
    line-height:1.3;
    margin-top:4px;
    color:var(--adv-meta-color, #ff0000);
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
    word-break:break-word;
    overflow-wrap:anywhere;
}

/* ================================
   IMAGE
================================ */
.adv-var-image{
    width:18%;
    flex-shrink:0;
    display:flex;
    align-items:center;
    justify-content:center;
    margin:var(--adv-img-margin, 0);
    padding:var(--adv-img-padding, 10px 0 0 0);
    background:none !important;
}

.adv-var-image img{
    display:block;
    width:100%;
    height:auto;
    object-fit:contain;
    background:none !important;
    background-color:transparent !important;
    box-shadow:none !important;
    border:none !important;
}

.adv-var-card img{
    background:none !important;
}

/* ================================
   PRICE STRIP
================================ */
.adv-var-price{
    padding:5px 10px 5px 10px;
    border-top:1px solid #e70808;
    background:#f3f3f3;
    display:flex;
    align-items:center;
    gap:8px;
    margin-top:auto;
    font-size:var(--adv-price-size, 15px);
    font-weight:var(--adv-price-weight, 600);
    color:var(--adv-price-color, #4402eb);
}

/* price amount + usd stacked vertically */
.adv-var-price-box{
    display:flex;
    flex-direction:column;
    line-height:1.2;
    min-width:0;
}

/* USD approx line (display only) */
.adv-var-usd{
    font-size:var(--adv-usd-size, 11px);
    font-weight:600;
    color:var(--adv-usd-color, #eb0034);
    margin-top:1px;
}

.adv-var-price ins{
    order:1;
    text-decoration:none;
    font-size:var(--adv-sale-size, inherit);
    font-weight:var(--adv-sale-weight, 700);
    color:var(--adv-sale-color, inherit);
}
.adv-var-price del{
    order:2;
    opacity:.6;
    font-size:var(--adv-reg-size, inherit);
    font-weight:var(--adv-reg-weight, inherit);
    color:var(--adv-reg-color, inherit);
}

/* ================================
   STOCK QUANTITY BADGE (RIGHT CORNER)
================================ */
.adv-var-price-amount{
    display:flex;
    align-items:center;
    gap:6px;
}

.adv-var-stock{
    margin-left:auto;
    font-size:11px;
    font-weight:600;
    color:#1a8f3c;
    background:#e6f7ea;
    padding:2px 8px;
    border-radius:20px;
    white-space:nowrap;
    flex-shrink:0;
}

.adv-var-stock.in-stock{
    color:#1a8f3c;
    background:#e6f7ea;
}

.adv-var-card.active .adv-var-stock{
    background:#ffffff;
    color:#2f6df6;
}

/* ACTIVE */
.adv-var-card.active{
    border-color:#2f6df6;
    box-shadow:0 4px 14px rgba(47,109,246,.35);
    position:relative;
}

.adv-var-card.active .adv-var-price{
    background:#2f6df6;
}
.adv-var-card.active .woocommerce-Price-amount{
    color:#fff!important;
}
/* active hole USD line holud */
.adv-var-card.active .adv-var-usd{
    color:#f9ff0c !important;
}

/* SELECTED CHECK MARK */
.adv-var-card.active::after{
    content:"✔";
    position:absolute;
    top:2px;
    right:2px;
    width:20px;
    height:20px;
    background:#2f6df6;
    color:#ffffff;
    font-size:12px;
    font-weight:700;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    box-shadow:0 4px 10px rgba(0,0,0,.25);
    z-index:10;
}

/* OUT OF STOCK */
.adv-var-card.out-of-stock{
    opacity:.2;
    pointer-events:none;
}

/* ================================
   INFO (i) BUTTON
   Sits in the same top-right corner as the selected tick.
   Only rendered on cards that have a description.
   Hidden automatically when the card is selected (tick shows).
================================ */
.adv-var-info-btn{
    position:absolute;
    top:2px;
    right:2px;
    width:20px;
    height:20px;
    padding:0;
    border:1.5px solid #2f6df6;
    border-radius:50%;
    background:#ffffff;
    color:#2f6df6;
    font-family:Georgia,'Times New Roman',serif;
    font-style:italic;
    font-weight:700;
    font-size:13px;
    line-height:1;
    display:flex;
    align-items:center;
    justify-content:center;
    cursor:pointer;
    box-shadow:0 2px 8px rgba(0,0,0,.22);
    z-index:11;
}
.adv-var-info-btn:hover{
    background:#2f6df6;
    color:#ffffff;
}
.adv-var-card.active .adv-var-info-btn{
    display:none;
}

/* ================================
   INFO MODAL
================================ */
.adv-var-modal-overlay{
    position:fixed;
    inset:0;
    background:rgba(20,20,40,.55);
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px;
    z-index:99999;
}
.adv-var-modal{
    position:relative;
    background:#ffffff;
    width:100%;
    max-width:420px;
    max-height:85vh;
    overflow-y:auto;
    border-radius:18px;
    padding:22px 22px 18px;
    box-shadow:0 20px 60px rgba(0,0,0,.35);
    -webkit-overflow-scrolling:touch;
}
.adv-var-modal-x{
    position:absolute;
    top:14px;
    right:14px;
    width:30px;
    height:30px;
    padding:0;
    border:none;
    border-radius:50%;
    background:#f0f0f4;
    color:#555555;
    font-size:18px;
    line-height:1;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
}
.adv-var-modal-x:hover{
    background:#e2e2ea;
}
.adv-var-modal-head{
    display:flex;
    align-items:center;
    gap:10px;
    padding-right:34px;
    padding-bottom:14px;
    margin-bottom:14px;
    border-bottom:1px solid #e6e6ee;
}
.adv-var-modal-img{
    flex-shrink:0;
}
.adv-var-modal-img img{
    width:34px;
    height:34px;
    object-fit:contain;
    border-radius:8px;
    display:block;
}
.adv-var-modal-title{
    font-size:18px;
    font-weight:700;
    color:#1a1a2e;
    line-height:1.25;
    word-break:break-word;
}
.adv-var-modal-body{
    font-size:14px;
    line-height:1.6;
    color:#333333;
    word-break:break-word;
}
.adv-var-modal-body p{
    margin:0 0 8px;
}
.adv-var-modal-body p:last-child{
    margin-bottom:0;
}
.adv-var-modal-body ul,
.adv-var-modal-body ol{
    margin:0 0 8px;
    padding-left:20px;
}
.adv-var-modal-body ul{
    list-style:disc;
}
.adv-var-modal-body ol{
    list-style:decimal;
}
.adv-var-modal-body li{
    margin:0 0 4px;
}
.adv-var-modal-close{
    display:block;
    width:100%;
    margin-top:16px;
    padding:12px;
    border:none;
    border-radius:12px;
    background:#eef0f6;
    color:#2f6df6;
    font-size:15px;
    font-weight:700;
    cursor:pointer;
}
.adv-var-modal-close:hover{
    background:#e2e6f2;
}
body.adv-var-modal-open{
    overflow:hidden;
}

/* ================================
   DESKTOP
================================ */
@media(min-width:1025px){

    .adv-var-wrapper{
        column-gap:8px;
    }

    .adv-var-name{ 
        font-size:var(--adv-name-size, 18px); 
    }

    .adv-var-price{ 
        font-size:var(--adv-price-size, 16px);
        font-weight:var(--adv-price-weight, 600);
        border-top:1px solid #e70808;
    }

    .adv-var-image{
        width:22%;
    }

    .adv-var-image img{
        width:70px;
        height:70px;
    }
}

/* ================================
   TABLET
================================ */
@media(max-width:1024px){
    .adv-var-wrapper{
        grid-template-columns:repeat(2,minmax(0,1fr));
        margin:0px -10px 20px -10px;
    }
    
    .adv-var-name{ 
        font-size:var(--adv-name-size, 16px); 
    }
}

/* ================================
   MOBILE (UPDATED IMAGE SIZE ONLY)
================================ */
@media(max-width:768px){
    .adv-var-wrapper{
        grid-template-columns:repeat(2,minmax(0,1fr));
        margin:0px -20px 20px -20px;
    }
    .adv-var-card{
        margin-left:-4px;
        margin-right:-4px;
    }
    .adv-var-name{
        font-size:var(--adv-name-size, 13px);
    }

    .adv-var-price{
        font-size:var(--adv-price-size, 15px);
        padding:5px 10px;
        font-weight:var(--adv-price-weight, 600);
        border-top:1px solid #e70808;
    }

    /* 🔥 IMAGE SIZE INCREASED FOR MOBILE */
    .adv-var-image{
        width:28%;
    }

    .adv-var-image img{
        width:45px;
        height:45px;
        margin-right: -8px;
    }

    .adv-var-card.active::after{
        width:20px;
        height:20px;
        font-size:10px;
        top:2px;
        right:2px;
    }

    .adv-var-stock{
        font-size:10px;
        padding:2px 6px;
    }
}

/* =========================================
   QUANTITY ROW (native WooCommerce input,
   repositioned + restyled via script.js)
========================================= */

.adv-var-qty-row{
    display:none;
    align-items:center;
    justify-content:center;
    gap:14px;
    margin:7px 0 20px 0;
    width:100%;
    align-self:stretch;
    box-sizing:border-box;
}

.adv-var-qty-row.adv-visible{
    display:flex;
}

/* "Sold Individually" on thakle quantity box kokhono e show hobe na
   (max shob shomoy 1, tai box dekhanor dorkar nai) */
.adv-var-wrapper.adv-sold-individually .adv-var-qty-row,
.adv-var-wrapper.adv-sold-individually .adv-var-qty-row.adv-visible{
    display:none !important;
}

.adv-var-qty-row .quantity{
    display:flex;
    align-items:center;
    gap:0;
    margin:0 !important;
    float:none !important;
}

.adv-var-qty-row .quantity .qty{
    width:56px;
    height:40px;
    text-align:center;
    border:2px solid #636385;
    border-left:none;
    border-right:none;
    border-radius:0;
    font-size:16px;
    font-weight:600;
    color:#000;
    background:#ffffff;
    -moz-appearance:textfield;
}

.adv-var-qty-row .quantity .qty::-webkit-outer-spin-button,
.adv-var-qty-row .quantity .qty::-webkit-inner-spin-button{
    -webkit-appearance:none;
    margin:0;
}

.adv-var-qty-row .quantity .qty.adv-qty-locked{
    caret-color:transparent;
    user-select:none;
    cursor:default;
}

.adv-qty-btn{
    width:40px;
    height:40px;
    border:2px solid #636385;
    background:#f3f3f3;
    color:#4402eb;
    font-size:18px;
    font-weight:700;
    line-height:1;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
    transition:.2s ease;
    padding:0;
}

.adv-qty-btn.adv-qty-minus{
    border-radius:8px 0 0 8px;
    border-right:none;
}

.adv-qty-btn.adv-qty-plus{
    border-radius:0 8px 8px 0;
    border-left:none;
}

.adv-qty-btn:hover{
    background:#2f6df6;
    color:#ffffff;
    border-color:#2f6df6;
}

@media(max-width:768px){
    .adv-var-qty-row{
        margin:5px 0 16px 0;
        gap:10px;
    }

    .adv-qty-btn,
    .adv-var-qty-row .quantity .qty{
        width:38px;
        height:38px;
        font-size:15px;
    }
}

/* =========================================
   VARIATION ATTRIBUTE TITLE BOX
========================================= */

.adv-var-attribute-title{
    display:flex;
    align-items:center;
    background:#eeeeee;
    padding:14px 18px;
    border-radius:10px;
    font-weight:600;
    position:relative;
    font-size:18px;
    color:#000;
}

.adv-var-attribute-title::before{
    content:"";
    width:28px;
    height:28px;
    background-color:#4c4cff;
    background-image:url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolygon points='12 2 2 7 12 12 22 7 12 2'/%3E%3Cpolyline points='2 17 12 22 22 17'/%3E%3Cpolyline points='2 12 12 17 22 12'/%3E%3C/svg%3E");
    background-repeat:no-repeat;
    background-position:center;
    background-size:16px 16px;
    border-radius:50%;
    display:flex;
    align-items:center;
    justify-content:center;
    margin-right:12px;
    flex-shrink:0;
}

@media(max-width:767px){
    .adv-var-attribute-title{
        font-size:16px;
        padding:12px 14px;
        margin: 0px -10px 10px -10px;
    }

    .adv-var-attribute-title::before{
        width:24px;
        height:24px;
        background-size:14px 14px;
    }
}

/* =========================================
   ADMIN: PER-VARIATION TITLE STYLE FIELDS
========================================= */

.adv-var-style-block{
    background:#fafafc;
    border:1px solid #e4e4ec;
    border-radius:10px;
    padding:12px 14px !important;
    margin-top:6px;
}

.adv-var-style-block > label{
    display:block;
    margin-bottom:10px;
}
.adv-var-style-block > label em{
    font-style:normal;
    color:#8a8a97;
    font-weight:400;
    font-size:12px;
}

.adv-var-style-fields{
    display:flex;
    flex-wrap:wrap;
    gap:18px;
    align-items:flex-end;
    margin:0;
}

.adv-var-style-field{
    display:flex !important;
    flex-direction:column;
    gap:5px;
    margin:0 !important;
    padding:0 !important;
}

.adv-var-style-field > span{
    font-size:12px;
    font-weight:600;
    color:#555;
}

.adv-var-style-input-px{
    display:inline-flex;
    align-items:center;
    gap:5px;
}
.adv-var-style-input-px input[type="number"]{
    width:78px;
}
.adv-var-style-input-px em{
    font-style:normal;
    color:#8a8a97;
    font-size:12px;
    font-weight:600;
}

.adv-var-style-note{
    display:block;
    margin-top:10px;
    font-size:12px;
    color:#787885;
    line-height:1.5;
}
.adv-var-style-note strong{
    color:#2f6df6;
}

/* mobile / narrow variation panel */
@media(max-width:782px){
    .adv-var-style-fields{
        gap:14px;
    }
    .adv-var-style-field{
        flex:1 1 100%;
    }
    .adv-var-style-field .wp-picker-container,
    .adv-var-style-input-px{
        width:100%;
    }
    .adv-var-style-input-px input[type="number"]{
        flex:1;
        width:auto;
    }
}

/* =========================================
   TOTAL PRICE (price × quantity)
   default single variation price hide kore
   ekta-i Total Price dekhai (quantity-aware)
========================================= */

form.variations_form .woocommerce-variation-price{
    display:none !important;
}

.adv-var-total-price{
    display:flex;
    justify-content:center;
    align-items:baseline;
    gap:6px;
    width:100%;
    align-self:stretch;
    box-sizing:border-box;
    text-align:center;
    margin:8px 0 6px;
}

.adv-var-total-label{
    font-size:18px;
    font-weight:600;
    color:#555;
}

.adv-var-total-amount{
    font-size:18px;
    font-weight:800;
    color:#111;
}

@media(max-width:768px){
    .adv-var-total-label,
    .adv-var-total-amount{ font-size:16px; }
}
