/**
 * King Baldwin Elementor - Popular Products Widget
 * Styles matching Peptide Sciences design
 */

/* Section Title */
.kbe-section-title {
    font-size: 42px;
    font-weight: 700;
    color: #212223;
    margin: 0 0 40px 0;
    padding: 0;
    line-height: 1.2;
}

/* Carousel Container */
.kbe-popular-products-wrapper {
    position: relative;
    width: 100%;
    padding: 60px 0;
}

.kbe-carousel-container {
    position: relative;
    padding: 0 60px;
}

.kbe-products-carousel {
    overflow: hidden;
    width: 100%;
}

/* Navigation Arrows - Override Swiper defaults */
.kbe-arrow::after {
    color: #212223;
    font-size: 40px;
}

.kbe-arrow:hover::after {
    color: #E84B19;
}

/* Pagination Progress Bar */
.swiper-pagination {
    position: relative;
    bottom: 0;
    height: 4px;
    background: #E5E7EB;
    margin-top: 30px;
    border-radius: 2px;
}

.swiper-pagination-progressbar {
    background: #E5E7EB;
}

.swiper-pagination-progressbar-fill {
    background: #E84B19;
    height: 4px;
    border-radius: 2px;
}

/* Product Card */
.kbe-product-card {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 25px 18px 18px;
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.kbe-product-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transform: translateY(-5px);
}

/* Badge */
.kbe-badge {
    position: absolute;
    top: 0;
    left: 0;
    background: #FFA500;
    color: #ffffff;
    padding: 5px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 8px 0 8px 0;
    z-index: 2;
}

/* Product Header */
.kbe-product-header {
    margin-bottom: 15px;
    margin-top: 30px;
}

.kbe-product-code {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.kbe-code {
    display: inline-block;
    background: #F3F4F6;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #6B6B6B;
}

.kbe-size-label {
    display: inline-block;
    background: #E84B19;
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.kbe-product-info {
    text-align: center;
    margin-bottom: 16px;
}

.kbe-product-name {
    font-size: 14px;
    font-weight: 700;
    color: #212223;
    margin: 0;
    padding: 0;
    line-height: 1.2;
    height: 34px;
    max-height: 34px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-align: center;
    word-break: break-word;
    text-overflow: ellipsis;
}

.kbe-product-dosage {
    font-size: 13px;
    color: #6B6B6B;
    margin: 0;
}

/* Product Image */
.kbe-product-image {
    text-align: center;
    margin: 0 0 16px 0;
    flex-shrink: 0;
    height: 207px; /* Default height for 150:207 aspect ratio */
    display: flex;
    align-items: center;
    justify-content: center;
}

.kbe-product-image img {
    max-width: 150px; /* Default width */
    max-height: 207px; /* Default height */
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Product Formula */
.kbe-product-formula {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    padding: 12px;
    border-radius: 6px;
    font-size: 11px;
    color: #6B6B6B;
    line-height: 1.6;
    margin: 15px 0;
    font-family: monospace;
}

/* Purity Badge */
.kbe-product-purity {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
}

.kbe-purity-badge {
    background: #10B981;
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.kbe-purity-value {
    font-size: 13px;
    font-weight: 600;
    color: #212223;
}

/* Research Use Label */
.kbe-research-use {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #FEF3C7;
    border: 1px solid #FDE68A;
    padding: 10px;
    border-radius: 6px;
    font-size: 11px;
    color: #92400E;
    margin: 12px 0;
}

.kbe-research-badge {
    background: #F59E0B;
    color: #ffffff;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* Product Footer */
.kbe-product-footer {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #E5E7EB;
}

.kbe-product-description {
    font-size: 14px;
    font-weight: 600;
    color: #212223;
    margin: 0 0 15px 0;
    line-height: 1.5;
}

/* Product Actions */
.kbe-product-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.kbe-btn {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 2px solid;
    line-height: 1.2;
    letter-spacing: 0px;
}

/* Override WooCommerce price styling */
.kbe-btn-cart .woocommerce-Price-amount,
.kbe-btn-cart .amount,
.kbe-btn-cart .price,
.kbe-btn-cart ins,
.kbe-btn-cart del {
    color: inherit !important;
    text-decoration: none !important;
    font-weight: inherit !important;
}

.kbe-btn-cart ins {
    text-decoration: none !important;
}

.kbe-btn-cart del {
    opacity: 0.7;
}

.kbe-btn-learn {
    background: transparent;
    color: #FF5722;
    border-color: #FF5722;
    font-weight: 700;
}

/* Hover styles controlled by Elementor - do not override */
.kbe-btn-learn:hover {
    /* background-color, color, and border-color controlled by Elementor */
}

.kbe-btn-cart {
    background: #FF5722;
    color: #ffffff;
    border-color: #FF5722;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

/* Hover styles controlled by Elementor - do not override */
.kbe-btn-cart:hover {
    /* background-color, color, and border-color controlled by Elementor */
}

.kbe-cart-text {
    flex: 0 0 auto;
    font-size: 13px;
    white-space: nowrap;
}

.kbe-cart-price {
    flex: 0 0 auto;
    font-size: 13px;
    white-space: nowrap;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .kbe-section-title {
        font-size: 36px;
    }

    .kbe-carousel-container {
        padding: 0 50px;
    }

    .kbe-arrow {
        width: 40px;
        height: 40px;
    }

    .kbe-arrow svg {
        width: 30px;
        height: 30px;
    }

    .kbe-product-card {
        padding: 20px 15px 15px;
    }

    /* 145px width × 1.38 = ~200px height */
    .kbe-product-image {
        height: 200px;
    }

    .kbe-product-image img {
        max-width: 145px;
        max-height: 200px;
    }

    .kbe-product-name {
        font-size: 14px;
        height: 34px;
        max-height: 34px;
    }
}

@media (max-width: 768px) {
    .kbe-section-title {
        font-size: 28px;
        margin-bottom: 30px;
    }

    .kbe-popular-products-wrapper {
        padding: 30px 0;
    }

    .kbe-carousel-container {
        padding: 0 35px;
    }

    .kbe-product-card {
        padding: 20px 15px 15px;
        max-width: 100% !important;
    }

    /* 130px width × 1.38 = ~180px height */
    .kbe-product-image {
        height: 180px;
    }

    .kbe-product-image img {
        max-width: 130px;
        max-height: 180px;
    }

    .kbe-product-name {
        font-size: 14px;
        height: 34px;
        max-height: 34px;
    }

    .kbe-product-info {
        margin-bottom: 15px;
    }

    .kbe-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .kbe-product-actions {
        gap: 10px;
    }

    /* Adjust navigation arrows */
    .swiper-button-next,
    .swiper-button-prev {
        width: 35px;
        height: 35px;
    }

    .swiper-button-next:after,
    .swiper-button-prev:after {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .kbe-section-title {
        font-size: 24px;
        margin-bottom: 20px;
    }

    .kbe-popular-products-wrapper {
        padding: 20px 0;
    }

    .kbe-carousel-container {
        padding: 0 30px;
    }

    .kbe-arrow {
        width: 30px;
        height: 30px;
    }

    .kbe-arrow svg {
        width: 20px;
        height: 20px;
    }

    .kbe-product-card {
        padding: 15px 10px 10px;
    }

    /* 109px width × 1.38 = ~150px height */
    .kbe-product-image {
        height: 150px;
        margin-bottom: 15px;
    }

    .kbe-product-image img {
        max-width: 109px;
        max-height: 150px;
    }

    .kbe-product-name {
        font-size: 11px;
        height: 26px;
        max-height: 26px;
        line-height: 1.2;
    }

    .kbe-product-info {
        margin-bottom: 12px;
    }

    .kbe-btn {
        padding: 11px 14px;
        font-size: 13px;
    }

    .kbe-product-actions {
        gap: 8px;
    }

    .kbe-badge {
        font-size: 10px;
        padding: 5px 12px;
    }

    /* Adjust navigation arrows */
    .swiper-button-next,
    .swiper-button-prev {
        width: 30px;
        height: 30px;
        display: none; /* Hide on very small screens */
    }

    /* Show pagination dots on mobile */
    .swiper-pagination {
        display: block !important;
        margin-top: 20px;
    }

    .kbe-product-code {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    .kbe-section-title {
        font-size: 20px;
    }

    .kbe-carousel-container {
        padding: 0 20px;
    }

    .kbe-product-card {
        padding: 12px 8px 8px;
    }

    /* 94px width × 1.38 = ~130px height */
    .kbe-product-image {
        height: 130px;
    }

    .kbe-product-image img {
        max-width: 94px;
        max-height: 130px;
    }

    .kbe-product-name {
        font-size: 14px;
        height: 34px;
        max-height: 34px;
    }

    .kbe-btn {
        padding: 10px 12px;
        font-size: 12px;
    }
}

/* Loading State */
.kbe-products-carousel.swiper-initialized {
    opacity: 1;
}

.kbe-products-carousel:not(.swiper-initialized) {
    opacity: 1;
}

/* Remove ALL focus/active outlines and shadows on buttons - NUCLEAR OPTION */
.kbe-btn,
.kbe-btn:link,
.kbe-btn:visited,
.kbe-btn:hover,
.kbe-btn:focus,
.kbe-btn:active,
.kbe-btn:focus-visible,
.kbe-btn:focus-within,
.kbe-btn:-moz-focusring,
.kbe-btn-learn,
.kbe-btn-learn:link,
.kbe-btn-learn:visited,
.kbe-btn-learn:hover,
.kbe-btn-learn:focus,
.kbe-btn-learn:active,
.kbe-btn-learn:focus-visible,
.kbe-btn-learn:focus-within,
.kbe-btn-learn:-moz-focusring,
.kbe-btn-cart,
.kbe-btn-cart:link,
.kbe-btn-cart:visited,
.kbe-btn-cart:hover,
.kbe-btn-cart:focus,
.kbe-btn-cart:active,
.kbe-btn-cart:focus-visible,
.kbe-btn-cart:focus-within,
.kbe-btn-cart:-moz-focusring {
    --btn-accented-box-shadow: none !important;
    --btn-accented-box-shadow-hover: none !important;
    --btn-accented-box-shadow-active: none !important;
    outline: 0 !important;
    outline: none !important;
    outline-width: 0 !important;
    outline-style: none !important;
    outline-color: transparent !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    -moz-box-shadow: none !important;
    -webkit-appearance: none !important;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-tap-highlight-color: rgba(0,0,0,0) !important;
    -webkit-focus-ring-color: transparent !important;
    -moz-appearance: none !important;
}

.kbe-btn::before,
.kbe-btn::after,
.kbe-btn-learn::before,
.kbe-btn-learn::after,
.kbe-btn-cart::before,
.kbe-btn-cart::after {
    display: none !important;
    content: none !important;
}

.kbe-btn *,
.kbe-btn-learn *,
.kbe-btn-cart * {
    outline: none !important;
    box-shadow: none !important;
}

/* Print Styles */
@media print {
    .kbe-arrow,
    .swiper-pagination {
        display: none;
    }

    .kbe-product-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
