/* ==========================================================================
   🍫 KAKAO GLOBAL CUSTOM LOGIC STYLES
   ========================================================================== */

:root {
    --choco-dark: #262d49;          /* Brand dark navy */
    --choco-brown: #a37254;         /* Brand bronze-brown */
    --choco-brown-hover: #8c5f43;   /* Brand bronze-brown hover */
    --choco-dark-brown: #47261a;    /* Brand deep chocolate */
    --choco-gold: #d0af9b;          /* Brand rose gold / beige */
    --choco-gold-light: #e4c46f;
    --choco-success: #dedf54;       /* Brand lime-yellow success */
    --choco-border: #ebdcd0;
}

/* --- 1. Global "Added to Cart" Modal Styles --- */
.kakao-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(38, 45, 73, 0.5); /* dark navy tinted backdrop */
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.kakao-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.kakao-modal-box {
    background: #ffffff;
    border-radius: 4px;
    border: none;
    max-width: 400px;
    width: 90%;
    padding: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.kakao-modal-overlay.active .kakao-modal-box {
    transform: scale(1);
}

.kakao-modal-header {
    background: #dedf54 !important;
    padding: 18px 20px;
    text-align: center;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.kakao-modal-header .modal-icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 2.5px solid #ffffff;
    border-radius: 50%;
    color: #ffffff;
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
    margin: 0;
}

.kakao-modal-body {
    padding: 24px 20px 16px;
    text-align: center;
}

.kakao-modal-body p {
    font-size: 15px;
    color: var(--choco-dark);
    line-height: 1.5;
    margin: 0 0 16px 0;
    font-weight: 600;
}

.kakao-modal-body .added-to-cart-link {
    color: var(--choco-dark) !important;
    font-weight: 700 !important;
    text-decoration: underline !important;
    font-size: 13px !important;
    letter-spacing: 0.2px;
}

.kakao-modal-footer {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 0 20px 24px;
}

.modal-btn {
    border: none;
    border-radius: 4px !important;
    padding: 10px 24px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn.btn-cancel {
    background: #f0f0f0;
    color: var(--choco-dark);
    border: 1px solid #dcdcdc;
}

.modal-btn.btn-cancel:hover {
    background: #e2e2e2;
}

.modal-btn.btn-confirm,
.modal-btn.btn-validation-close {
    background: var(--choco-success) !important; /* Brand yellow-green #dedf54 */
    color: var(--choco-dark) !important;
    font-weight: 700;
}

.modal-btn.btn-confirm:hover,
.modal-btn.btn-validation-close:hover {
    background: #cbd342 !important;
}

/* --- 2. WooCommerce Cart & Checkout Chocogram Grid --- */
.chocogram-cart-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
    margin-bottom: 8px;
    max-width: 100%;
}

.chocogram-cart-row {
    display: flex;
    gap: 4px;
}

.chocogram-cart-slot {
    width: 26px !important;
    height: 26px !important;
    border-radius: 2px !important;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    user-select: none;
}

/* Empty slots */
.chocogram-cart-slot-empty {
    background: #ebebeb !important;
    border: 1px solid #dcdcdc !important;
    box-shadow: inset 1px 1px 2px rgba(0,0,0,0.06) !important;
}

/* Chocolate letter blocks */
.chocogram-cart-slot-char {
    background: linear-gradient(135deg, #855338 0%, #56331f 100%) !important;
    border: 1px solid #946146 !important;
    border-bottom: 2px solid #3c2011 !important;
    border-right: 2px solid #3c2011 !important;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.3) !important;
    color: #f5eedc !important; /* Cream-colored embossed character */
    font-family: Georgia, serif !important;
    font-size: 13px !important;
    font-weight: bold !important;
    text-shadow: 1px 1px 0px rgba(0, 0, 0, 0.7) !important;
}

/* Characters that are rendered as real images */
.chocogram-cart-slot-char-img {
    background: #ffffff !important;
    border: 1px solid #dcdcdc !important;
}

.chocogram-cart-slot-char-img img {
    max-width: 90% !important;
    max-height: 90% !important;
    object-fit: contain !important;
    display: block;
}

/* Sweet/Decoration slots */
.chocogram-cart-slot-sweet {
    background: linear-gradient(135deg, #916147 0%, #683f29 100%) !important;
    border: 1px solid #a37257 !important;
    border-bottom: 2px solid #3d2112 !important;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.3) !important;
}

.chocogram-cart-slot-sweet img {
    max-width: 90% !important;
    max-height: 90% !important;
    object-fit: contain !important;
    display: block;
    filter: drop-shadow(0.5px 1px 1px rgba(0,0,0,0.4));
}

/* Overrides to scale down the grid inside narrow mini-cart / side-cart panels */
.widget_shopping_cart .chocogram-cart-slot,
.woocommerce-mini-cart .chocogram-cart-slot,
.cart-widget-side .chocogram-cart-slot,
.wd-cart-number .chocogram-cart-slot {
    width: 16px !important;
    height: 16px !important;
    font-size: 9px !important;
}

.widget_shopping_cart .chocogram-cart-row,
.woocommerce-mini-cart .chocogram-cart-row,
.cart-widget-side .chocogram-cart-row,
.wd-cart-number .chocogram-cart-row,
.widget_shopping_cart .chocogram-cart-grid,
.woocommerce-mini-cart .chocogram-cart-grid,
.cart-widget-side .chocogram-cart-grid,
.wd-cart-number .chocogram-cart-grid {
    gap: 2px !important;
}

/* --- 3. Unified Quantity Spinner Styles --- */
.quantity-input-box {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    border: 1px solid #ebdcb9 !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    height: 48px !important;
    background: #ffffff !important;
    width: 120px !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

.quantity-input-box .qty-btn {
    width: 35px !important;
    height: 100% !important;
    border: none !important;
    background: none !important;
    cursor: pointer !important;
    font-size: 16px !important;
    font-weight: bold !important;
    color: #666666 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
    float: none !important;
    box-shadow: none !important;
}

.quantity-input-box .qty-btn:hover {
    background: #f7f5f0 !important;
    color: #333333 !important;
}

.quantity-input-box .qty-input {
    width: 50px !important;
    height: 100% !important;
    text-align: center !important;
    border: none !important;
    border-left: 1px solid #ebdcb9 !important;
    border-right: 1px solid #ebdcb9 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    outline: none !important;
    background: transparent !important;
    color: #333333 !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    box-shadow: none !important;
    -moz-appearance: textfield !important;
}

.quantity-input-box .qty-input::-webkit-outer-spin-button,
.quantity-input-box .qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

/* --- 3. WooCommerce Blocks Checkout Custom Invoice Fields Styling --- */
#kakao-invoice-independent-section {
    margin-top: 24px !important;
    margin-bottom: 24px !important;
    padding: 20px !important;
    background: #fffcf8 !important;
    border: 1px solid #ebdccc !important;
    border-radius: 8px !important;
    clear: both !important;
}

#kakao-invoice-independent-section .wc-block-components-checkbox {
    margin-bottom: 12px !important;
}

/* Hide the '(optional)' and '(по избор)' badge on invoice fields */
#kakao-invoice-independent-section span[class*="optional"],
#kakao-invoice-independent-section span:contains("optional"),
#kakao-invoice-independent-section span:contains("по избор") {
    display: none !important;
}

/* --- 4. Delivery Datepicker Controls Styling --- */
/* Hide the 'Clear' button in the delivery datepicker */
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-close {
    display: none !important;
}

/* Hide the bottom buttonpane entirely if empty */
.ui-datepicker .ui-datepicker-buttonpane {
    display: none !important;
}

/* --- 5. Mobile Add-to-Cart Button: Icon Only (hide text on small screens) --- */
/**
 * On mobile the "ДОБАВЯНЕ В КОЛИЧКАТА" text inside the product loop
 * add-to-cart button overflows and gets cut with ellipsis ("ДОБАВЯНЕ В ...").
 * On screens ≤ 768px we hide the text span and show only the cart icon,
 * making the button square and centred.
 *
 * WoodMart selectors from DevTools:
 *   span.wd-action-icon  → the cart icon SVG wrapper
 *   span.wd-action-text  → the label text
 */
@media (max-width: 768px) {
    /* Hide the label text inside loop add-to-cart buttons */
    .add-to-cart-loop .wd-action-text,
    a.add_to_cart_button .wd-action-text,
    .wd-add-btn .wd-action-text,
    .product_type_simple.add_to_cart_button .wd-action-text {
        display: none !important;
    }

    /* Make sure the icon SVG / span is visible and centred */
    .add-to-cart-loop .wd-action-icon,
    a.add_to_cart_button .wd-action-icon,
    .wd-add-btn .wd-action-icon {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        margin: 0 !important;
    }
}

/* --- 6. Product Category Navigation – Desktop (8 items per row) --- */
@media (min-width: 1200px) {
    .page-title .wd-nav-product-cat {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        width: 100% !important;
        gap: 16px !important;
    }

    .page-title .wd-nav-product-cat > li {
        flex: 1 1 0 !important;
        width: 12.5% !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        text-align: center !important;
    }

    .page-title .wd-nav-product-cat > li > a {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
    }

    /* Thumbnail image */
    .page-title .wd-nav-product-cat .wd-nav-img {
        width: 130px !important;
        height: 130px !important;
        max-width: 130px !important;
        max-height: 130px !important;
        object-fit: contain !important;
        margin: 0 auto 12px !important;
        flex-shrink: 0 !important;
    }

    /* Category title with uniform height */
    .page-title .wd-nav-product-cat .nav-link-text {
        display: flex !important;
        align-items: flex-start !important;
        justify-content: center !important;
        height: 56px !important;
        line-height: 1.25 !important;
        text-align: center !important;
    }

    /* Category product count */
    .page-title .wd-nav-product-cat .category-products-count {
        display: block !important;
        margin-top: 4px !important;
        text-align: center !important;
    }
}


