/**
 * El Buho Thirstie Shop - WordPress Plugin Styles
 * Integrates with El Buho WordPress theme
 */

/* =============================================
   THIRSTIE CSS VARIABLES
   ============================================= */

:root {
    /* Header/Cart icon color - this is the official Thirstie variable */
    --th-c-header-icon: #ffffff;
    --th-c-header-icon-count: #000000;
}

/* =============================================
   HIDE WORDPRESS THEME AGE GATE ON SHOP PAGES
   (Thirstie handles age verification)
   ============================================= */

/* Hide the theme's age verification popup on shop (17104) and checkout (17106) pages */
body.page-id-17104 > article.box.clearfix,
body.page-id-17104 > .overlay-verify,
body.page-id-17106 > article.box.clearfix,
body.page-id-17106 > .overlay-verify,
/* Also target by class in case page IDs change */
body:has(.elbuho-thirstie-shop) > article.box.clearfix,
body:has(.elbuho-thirstie-shop) > .overlay-verify,
body:has(.elbuho-thirstie-checkout) > article.box.clearfix,
body:has(.elbuho-thirstie-checkout) > .overlay-verify {
    display: none !important;
}

/* =============================================
   RESET THEME CONFLICTS
   ============================================= */

/* Remove theme's default page styling that adds extra space */
#page-content.page-text .wrapper .text.centered {
    padding: 0 !important;
    margin: 0 !important;
    text-align: left !important;
}

#page-content.page-text .wrapper {
    padding-top: 0 !important;
}

/* =============================================
   SHOP CONTAINER
   ============================================= */

.elbuho-thirstie-shop {
    /* max-width: 1200px; */
    margin: 0 auto;
    padding: 0;
    min-height: 600px;
}

.elbuho-shop-content {
    padding: 5rem 0;
}

/* =============================================
   AVAILABILITY WRAPPER FIXES
   ============================================= */

/* Fix the availability wrapper positioning */
.elbuho-thirstie-shop th-availability-wrapper {
    display: block !important;
    width: 100% !important;
}

/* Style the address input section nicely */
.elbuho-thirstie-shop th-availability-wrapper::part(form),
.elbuho-thirstie-shop th-availability-wrapper [class*="availability"],
.elbuho-thirstie-shop th-availability-wrapper [class*="address"],
.elbuho-thirstie-shop th-availability-wrapper [class*="check"] {
    background: #f8f8f8;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

/* =============================================
   PRODUCT CONTAINER
   ============================================= */

.elbuho-thirstie-shop th-product-container {
    display: block;
    width: 100%;
}

/* Back to products link - prevent full-width clickable area */
.elbuho-thirstie-shop [class*="back-to"],
.elbuho-thirstie-shop [class*="back_to"],
.elbuho-thirstie-shop [class*="backTo"],
.elbuho-thirstie-shop a[href*="shop"]:has(svg),
.elbuho-thirstie-shop .th-back-link,
.elbuho-thirstie-shop .back-link {
    display: inline-flex !important;
    width: auto !important;
    max-width: fit-content !important;
    padding: 0.5rem 1rem !important;
    margin-bottom: 1rem;
}

/* =============================================
   CHECKOUT CONTAINER
   ============================================= */

.elbuho-thirstie-checkout {
    padding: 4.75rem 1rem;
}

/* =============================================
   CART ICON IN MENU
   ============================================= */

.elbuho-cart-menu-item {
    display: flex;
    align-items: center;
}

.elbuho-cart-menu-item th-header-nav {
    display: inline-flex;
}

/* =============================================
   AGE GATE - HIDE THIRSTIE'S (WP theme has one)
   ============================================= */

/* Hide Thirstie age gate since WP theme has its own */
.elbuho-thirstie-shop th-agegate-modal {
    /* display: none !important; */
}

/* =============================================
   FLASH OF UNSTYLED CONTENT
   ============================================= */

.th-fouc-block {
    visibility: visible;
    opacity: 0;
    display: none;
}

/* =============================================
   BUTTON STYLING TO MATCH EL BUHO BRAND
   ============================================= */

body .elbuho-shop-content .wrapper,
body .elbuho-shop-content .content
 {
    padding:0;
}


body .elbuho-thirstie-shop button,
body .elbuho-thirstie-checkout button {
    color:#fff;
}

body .elbuho-thirstie-shop .elbuho-modal-close {
    color:#333;
}

.elbuho-thirstie-shop button,
.elbuho-thirstie-checkout button {
    color:#fff;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Primary buttons - black with gold hover */
.elbuho-thirstie-shop button[class*="primary"],
.elbuho-thirstie-checkout button[class*="primary"] {
    background-color: #000 !important;
    color: #fff !important;
    border: 2px solid #000 !important;
    transition: all 0.3s ease;
}

.elbuho-thirstie-shop button[class*="primary"]:hover,
.elbuho-thirstie-checkout button[class*="primary"]:hover {
    background-color: #ffbc2c !important;
    border-color: #ffbc2c !important;
    color: #000 !important;
}

/* =============================================
   WOOCOMMERCE "SHOP NOW" REPLACEMENT BUTTONS
   ============================================= */

/* Shop Now buttons replacing WooCommerce Add to Cart */
.elbuho-shop-now {
    display: inline-block;
    padding: 0.75rem 1.5rem !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    color: #fff !important;
    background-color: #000 !important;
    border: 2px solid #000 !important;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none !important;
    text-align: center;
}

.elbuho-shop-now:hover {
    background-color: #ffbc2c !important;
    border-color: #ffbc2c !important;
    color: #000 !important;
}

/* Single product page button wrapper */
.elbuho-single-product-button {
    margin: 1.5rem 0;
}

.elbuho-single-product-button .elbuho-shop-now {
    width: auto;
    min-width: 200px;
}

/* =============================================
   RESPONSIVE ADJUSTMENTS
   ============================================= */

@media (max-width: 768px) {
    .elbuho-thirstie-shop,
    .elbuho-thirstie-checkout {
        padding: 0.5rem;
    }

    .elbuho-thirstie-shop th-availability-wrapper [class*="availability"],
    .elbuho-thirstie-shop th-availability-wrapper [class*="address"] {
        padding: 1rem;
        margin-bottom: 1rem;
    }
}

/* =============================================
   ADDRESS CHECK MODAL
   ============================================= */

.elbuho-address-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999999;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
}

.elbuho-address-modal.visible {
    display: flex;
}

.elbuho-address-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
}

.elbuho-address-modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow: visible;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal close button */
.elbuho-modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 1.5rem;
    line-height: 1;
    color: #666;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.elbuho-modal-close:hover {
    color: #000;
    background: #f0f0f0;
}

.elbuho-address-modal-header {
    text-align: center;
    padding: 1.25rem 1.5rem 1rem;
    border-bottom: 1px solid #eee;
}

.elbuho-address-modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.elbuho-address-modal-body {
    padding: 1.5rem;
    min-height: 200px;
    overflow: visible;
}

/* Style the address check inside modal */
.elbuho-address-modal-body th-address-check {
    display: block;
    width: 100%;
}

/* Allow Google Places dropdown to overflow */
.elbuho-address-modal-body .pac-container,
.elbuho-address-modal-content .pac-container {
    z-index: 9999999 !important;
}

/* Modal footer with continue button */
.elbuho-address-modal-footer {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid #eee;
    text-align: center;
}

.elbuho-continue-btn {
    display: inline-block;
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #fff;
    background-color: #000;
    border: 2px solid #000;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.elbuho-continue-btn:hover:not(:disabled) {
    background-color: #ffbc2c;
    border-color: #ffbc2c;
    color: #000;
}

.elbuho-continue-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.elbuho-address-modal-hint {
    margin: 1rem 0 0;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

/* =============================================
   SHOP TOOLBAR (Address Display & Change Button)
   ============================================= */

.elbuho-shop-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: #f8f8f8;
    border-radius: 6px;
}

.elbuho-current-address-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #333;
}

.elbuho-current-address-display svg {
    color: #666;
    flex-shrink: 0;
}

.elbuho-current-address-display strong {
    font-weight: 600;
}

.elbuho-change-address-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: #000 !important;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.elbuho-change-address-btn:hover {
    background-color: #000;
    border-color: #000;
    color: #fff !important;
}

.elbuho-change-address-btn svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

/* Mobile adjustments for modal */
@media (max-width: 768px) {
    .elbuho-address-modal {
        padding-top: 5vh;
        align-items: flex-start;
    }
    
    html .thirstieshop .wrapper,
    html .thirstieshop .elbuho-thirstie-shop,
    html .thirstieshop .elbuho-thirstie-shop .content 
    {
        padding:0px !important;
    }
    
    html .thirstieshop .th-pdp-container {
        margin: 0px !important;
    }

    .elbuho-address-modal-content {
        width: 95%;
        margin: 0 auto;
        border-radius: 8px;
        max-height: 85vh;
    }

    .elbuho-address-modal-header {
        padding: 1rem;
    }

    .elbuho-address-modal-header h2 {
        font-size: 1.1rem;
    }

    .elbuho-address-modal-body {
        padding: 1rem;
    }

    .elbuho-address-modal-footer {
        padding: 1rem;
    }

    .elbuho-shop-toolbar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem 10px;
        align-items: stretch;
    }

    .elbuho-current-address-display {
        justify-content: center;
        font-size: 0.85rem;
    }

    .elbuho-change-address-btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
        justify-content: center;
    }
}
