/**
 * PDP Mobile Sticky Drawer ATC Styles
 * 
 * Scope: #ppw-mobile-sticky-atc
 * @version 1.0.0
 */

/* ===========================================
   STICKY DRAWER - BASE
   =========================================== */
#ppw-mobile-sticky-atc {
    display: none;
}

@media only screen and (max-width: 768px) {
    #ppw-mobile-sticky-atc {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 99999;
        background: #fff;
        border-top: 1px solid #e8e8e8;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
        overflow: visible;
    }
}

/* ===========================================
   PULL HANDLE
   =========================================== */
.ppw-sd-handle {
    display: flex;
    justify-content: center;
    padding: 6px 0 2px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ppw-sd-handle span {
    width: 32px;
    height: 4px;
    background: #ddd;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.ppw-sd-handle:active span {
    background: #bbb;
}

/* ===========================================
   COLLAPSED BAR
   =========================================== */
.ppw-sd-bar {
    display: flex;
    align-items: center;
/*    padding: 4px 15px 10px;*/
    gap: 10px;
}

/* Price column */
.ppw-sd-price-col {
    flex: 1;
    min-width: 0;
}

.ppw-sd-as-low {
    font-size: 10px;
    color: #999;
    font-weight: 500;
    display: block;
    line-height: 1.2;
}

.ppw-sd-price-line {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.ppw-sd-price {
    font-size: 1.7em;
    font-weight: 700;
    color: #222;
}

.ppw-sd-meta {
    font-size: 11px;
    color: #888;
}

.ppw-sd-uom-stock {
    font-size: 11px;
    color: #888;
    margin-top: 1px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ppw-sd-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ===========================================
   SAVINGS BADGE
   =========================================== */
.ppw-sd-savings {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f3f0ff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #4a34d7;
    border: 1px solid #dcd6ff;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s ease;
}

.ppw-sd-savings:active {
    background: #ebe6ff;
}

.ppw-sd-savings-icon {
    width: 14px;
    height: 14px;
    border: 1px solid #4a34d7;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
}

/* ===========================================
   ADD TO CART BUTTON
   =========================================== */
.ppw-sd-atc-btn {
    height: 44px;
    padding: 0 18px;
    background: #ffc400;
    color: #000;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s ease;
    font-family: inherit;
}

.ppw-sd-atc-btn:active {
    background: #e0ad00;
}

.ppw-sd-atc-btn.ppw-sd-added {
    background: #4CAF50;
    color: #fff;
}

.ppw-sd-atc-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===========================================
   EXPANDED PANEL
   =========================================== */
.ppw-sd-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    border-top: 0 solid transparent;
}

#ppw-mobile-sticky-atc.ppw-sd-open .ppw-sd-panel {
    max-height: 200px;
    border-top: 1px solid #f0f0f0;
}

.ppw-sd-panel-inner {
    padding: 10px 0px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Detail rows */
.ppw-sd-detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
}

.ppw-sd-label {
    color: #999;
}

.ppw-sd-value {
    font-weight: 600;
    color: #333;
}

.ppw-sd-value.is-ok {
    color: #17A34A;
}

.ppw-sd-value.is-low {
    color: #F59E0B;
}

.ppw-sd-value.is-oos {
    color: #c62828;
}

/* Quantity row */
.ppw-sd-qty-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.ppw-sd-qty-label {
    font-size: 12px;
    color: #999;
}

.ppw-sd-qty-input {
    width: 48px;
    height: 38px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.ppw-sd-qty-input:focus {
    outline: none;
    border-color: #493493;
}

/* ===========================================
   TIER PRICING POPUP
   =========================================== */
.ppw-sd-tier-popup {
    position: absolute;
    bottom: 100%;
    left: 15px;
    right: 15px;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.12);
    z-index: 10;
    display: none;
}

.ppw-sd-tier-popup.ppw-sd-tier-visible {
    display: block;
    padding: 12px 14px;
}

.ppw-sd-tier-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    column-gap: 8px;
    font-size: 13px;
    font-weight: 700;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
    margin-bottom: 6px;
}

.ppw-sd-tier-lines {
    display: flex;
    flex-direction: column;
}

.ppw-sd-tier-line {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    padding: 8px 4px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 6px;
    align-items: center;
}

.ppw-sd-tier-line:active {
    background: #f8f3ff;
}

.ppw-sd-tier-disc {
    color: #1f9146;
    font-weight: 700;
    text-align: right;
}

/* ===========================================
   BODY PADDING
   =========================================== */
@media only screen and (max-width: 768px) {
    body.ex-product .catalog-single.mobile {
        padding-bottom: 80px;
    }
}

/* ===========================================
   HIDE DESKTOP STICKY ON MOBILE
   =========================================== */
@media (max-width: 767px) {
    #ppw-sticky-atc {
        display: none !important;
    }
}

/* ===========================================
   HIDE DESKTOP TIER CARD IN MOBILE CONTEXT
   =========================================== */
#ppw-mobile-sticky-atc .ppw-tier-card {
    display: none !important;
}

/* ===========================================
   QTY FLASH ANIMATION
   =========================================== */
@keyframes ppw-qty-flash {
    0%   { background-color: #fffbe6; }
    50%  { background-color: #ffe58f; }
    100% { background-color: #ffffff; }
}

.ppw-sd-qty-input.ppw-qty-flash {
    animation: ppw-qty-flash 0.4s ease-out;
}