/**
 * King Baldwin Elementor - Catalog Widget
 * Grid layout with category filters
 */

/* Catalog Wrapper */
.kbe-catalog-wrapper {
    width: 100%;
    padding: 40px 0;
}

/* Section Title & Subtitle */
.kbe-section-subtitle {
    font-size: 16px;
    line-height: 1.6;
    color: #666;
    margin: 10px 0 20px 0;
    text-align: center;
}

/* Catalog Controls (Category Filter + Sort By) */
.kbe-catalog-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    gap: 20px;
    flex-wrap: wrap;
}

/* Category Filter */
.kbe-category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 10px;
    flex: 1;
}

.kbe-category-btn {
    padding: 10px 24px;
    border: 2px solid #FF5722;
    border-radius: 50px;
    background: transparent;
    color: #FF5722;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.kbe-category-btn:hover,
.kbe-category-btn.active {
    background: #212223;
    border-color: #212223;
    color: #ffffff;
}

/* Sort By Dropdown */
.kbe-sort-by-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.kbe-sort-label {
    font-size: 14px;
    font-weight: 600;
    color: #212223;
    margin: 0;
}

.kbe-sort-select,
.kbe-catalog-wrapper .kbe-sort-select,
.kbe-catalog-wrapper select.kbe-sort-select {
    padding: 10px 40px 10px 16px !important;
    border: 2px solid #E5E7EB !important;
    border-radius: 4px !important;
    background-color: #ffffff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23212223' d='M1.41 0L6 4.58 10.59 0 12 1.41l-6 6-6-6z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 14px center !important;
    background-size: 12px !important;
    color: #212223 !important;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.kbe-sort-select:hover,
.kbe-sort-select:focus,
.kbe-sort-select:active,
.kbe-catalog-wrapper .kbe-sort-select:hover,
.kbe-catalog-wrapper .kbe-sort-select:focus,
.kbe-catalog-wrapper .kbe-sort-select:active,
.kbe-catalog-wrapper select.kbe-sort-select:hover,
.kbe-catalog-wrapper select.kbe-sort-select:focus,
.kbe-catalog-wrapper select.kbe-sort-select:active {
    border-color: #B76E79 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* Products Grid */
.kbe-catalog-wrapper .kbe-products-grid {
    display: grid;
    gap: 30px;
    margin-bottom: 40px;
    grid-template-columns: repeat(4, minmax(0, 1fr)); /* Desktop default */
}

/* Responsive grid columns - automatic fallbacks */
@media (max-width: 1024px) {
    .kbe-catalog-wrapper .kbe-products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 768px) {
    .kbe-catalog-wrapper .kbe-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 480px) {
    .kbe-catalog-wrapper .kbe-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

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

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

/* Badge */
.kbe-catalog-wrapper .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 Image */
.kbe-catalog-wrapper .kbe-product-image {
    text-align: center;
    margin: 0 0 16px 0;
    flex-shrink: 0;
    height: 207px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Product Info */
.kbe-catalog-wrapper .kbe-product-info {
    text-align: center;
    margin-bottom: 16px;
}

.kbe-catalog-wrapper .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;
}

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

.kbe-catalog-wrapper .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-catalog-wrapper .kbe-btn-cart .woocommerce-Price-amount,
.kbe-catalog-wrapper .kbe-btn-cart .amount,
.kbe-catalog-wrapper .kbe-btn-cart .price,
.kbe-catalog-wrapper .kbe-btn-cart ins,
.kbe-catalog-wrapper .kbe-btn-cart del {
    color: inherit !important;
    text-decoration: none !important;
    font-weight: inherit !important;
}

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

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

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

.kbe-catalog-wrapper .kbe-btn-learn:hover {
    background: #FF5722;
    color: #ffffff;
    border-color: #FF5722;
}

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

.kbe-catalog-wrapper .kbe-btn-cart:hover {
    background: #E64A19;
    border-color: #E64A19;
}

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

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

/* Pagination */
.kbe-pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 40px;
}

.kbe-pagination a,
.kbe-pagination span {
    padding: 8px 16px;
    border: 2px solid #E5E7EB;
    border-radius: 4px;
    color: #212223;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.kbe-pagination a:hover,
.kbe-pagination span.current {
    background: #212223;
    border-color: #212223;
    color: #ffffff;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .kbe-catalog-wrapper .kbe-product-image {
        height: 200px;
    }

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

@media (max-width: 768px) {
    .kbe-catalog-wrapper .kbe-catalog-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
        margin-bottom: 25px;
    }

    .kbe-catalog-wrapper .kbe-category-filter {
        justify-content: flex-start;
        gap: 8px;
        padding-bottom: 5px;
        margin-bottom: 0;
    }

    .kbe-catalog-wrapper .kbe-category-btn {
        padding: 6px 14px;
        font-size: 12px;
        border-width: 1.5px;
    }

    .kbe-catalog-wrapper .kbe-sort-by-wrapper {
        justify-content: flex-start;
        gap: 8px;
    }

    .kbe-catalog-wrapper .kbe-sort-label {
        font-size: 12px;
    }

    .kbe-catalog-wrapper .kbe-sort-select {
        padding: 6px 32px 6px 10px;
        font-size: 12px;
        min-width: 140px;
        border-width: 1.5px;
        background-position: right 10px center;
        background-size: 10px;
    }

    .kbe-catalog-wrapper .kbe-products-grid {
        gap: 15px;
    }

    .kbe-catalog-wrapper .kbe-product-card {
        padding: 15px 12px 12px;
    }

    .kbe-catalog-wrapper .kbe-product-image {
        height: 160px;
    }

    .kbe-catalog-wrapper .kbe-product-image img {
        max-width: 120px;
        max-height: 160px;
    }

    .kbe-catalog-wrapper .kbe-btn {
        padding: 8px 10px;
        font-size: 11px;
    }

    .kbe-catalog-wrapper .kbe-cart-text,
    .kbe-catalog-wrapper .kbe-cart-price {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .kbe-catalog-wrapper {
        padding: 15px 0;
    }

    .kbe-catalog-wrapper .kbe-catalog-controls {
        gap: 12px;
        margin-bottom: 20px;
    }

    .kbe-catalog-wrapper .kbe-category-filter {
        gap: 6px;
    }

    .kbe-catalog-wrapper .kbe-category-btn {
        padding: 5px 12px;
        font-size: 11px;
        border-radius: 30px;
    }

    .kbe-catalog-wrapper .kbe-sort-select {
        min-width: 120px;
        padding: 5px 28px 5px 8px;
        font-size: 11px;
        background-position: right 8px center;
        background-size: 9px;
    }

    .kbe-catalog-wrapper .kbe-sort-label {
        font-size: 11px;
    }

    .kbe-catalog-wrapper .kbe-products-grid {
        gap: 12px;
    }

    .kbe-catalog-wrapper .kbe-product-card {
        padding: 12px 10px 10px;
    }

    .kbe-catalog-wrapper .kbe-product-image {
        height: 140px;
        margin-bottom: 10px;
    }

    .kbe-catalog-wrapper .kbe-product-image img {
        max-width: 100px;
        max-height: 140px;
    }

    .kbe-catalog-wrapper .kbe-product-name {
        font-size: 12px;
        height: 30px;
        max-height: 30px;
    }

    .kbe-catalog-wrapper .kbe-product-info {
        margin-bottom: 10px;
    }

    .kbe-catalog-wrapper .kbe-product-actions {
        gap: 6px;
    }

    .kbe-catalog-wrapper .kbe-btn {
        padding: 7px 8px;
        font-size: 10px;
        border-width: 1.5px;
    }

    .kbe-catalog-wrapper .kbe-cart-text,
    .kbe-catalog-wrapper .kbe-cart-price {
        font-size: 10px;
    }

    .kbe-catalog-wrapper .kbe-btn-cart {
        gap: 4px;
    }
}

@media (max-width: 360px) {
    .kbe-catalog-wrapper .kbe-category-btn {
        padding: 4px 10px;
        font-size: 10px;
    }

    .kbe-catalog-wrapper .kbe-sort-select {
        min-width: 100px;
        font-size: 10px;
        padding: 4px 24px 4px 6px;
        background-position: right 6px center;
        background-size: 8px;
    }

    .kbe-catalog-wrapper .kbe-sort-label {
        font-size: 10px;
    }

    .kbe-catalog-wrapper .kbe-product-image {
        height: 120px;
    }

    .kbe-catalog-wrapper .kbe-product-image img {
        max-width: 85px;
        max-height: 120px;
    }

    .kbe-catalog-wrapper .kbe-product-name {
        font-size: 11px;
    }

    .kbe-catalog-wrapper .kbe-btn {
        padding: 6px 6px;
        font-size: 9px;
    }

    .kbe-catalog-wrapper .kbe-cart-text,
    .kbe-catalog-wrapper .kbe-cart-price {
        font-size: 9px;
    }
}

/* Filter Animation */
.kbe-catalog-wrapper .kbe-product-card {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Remove ALL focus/active outlines and shadows on buttons - NUCLEAR OPTION */
.kbe-catalog-wrapper .kbe-btn,
.kbe-catalog-wrapper .kbe-btn:link,
.kbe-catalog-wrapper .kbe-btn:visited,
.kbe-catalog-wrapper .kbe-btn:hover,
.kbe-catalog-wrapper .kbe-btn:focus,
.kbe-catalog-wrapper .kbe-btn:active,
.kbe-catalog-wrapper .kbe-btn:focus-visible,
.kbe-catalog-wrapper .kbe-btn:focus-within,
.kbe-catalog-wrapper .kbe-btn:-moz-focusring,
.kbe-catalog-wrapper .kbe-btn-learn,
.kbe-catalog-wrapper .kbe-btn-learn:link,
.kbe-catalog-wrapper .kbe-btn-learn:visited,
.kbe-catalog-wrapper .kbe-btn-learn:hover,
.kbe-catalog-wrapper .kbe-btn-learn:focus,
.kbe-catalog-wrapper .kbe-btn-learn:active,
.kbe-catalog-wrapper .kbe-btn-learn:focus-visible,
.kbe-catalog-wrapper .kbe-btn-learn:focus-within,
.kbe-catalog-wrapper .kbe-btn-learn:-moz-focusring,
.kbe-catalog-wrapper .kbe-btn-cart,
.kbe-catalog-wrapper .kbe-btn-cart:link,
.kbe-catalog-wrapper .kbe-btn-cart:visited,
.kbe-catalog-wrapper .kbe-btn-cart:hover,
.kbe-catalog-wrapper .kbe-btn-cart:focus,
.kbe-catalog-wrapper .kbe-btn-cart:active,
.kbe-catalog-wrapper .kbe-btn-cart:focus-visible,
.kbe-catalog-wrapper .kbe-btn-cart:focus-within,
.kbe-catalog-wrapper .kbe-btn-cart:-moz-focusring,
.kbe-catalog-wrapper .kbe-category-btn,
.kbe-catalog-wrapper .kbe-category-btn:link,
.kbe-catalog-wrapper .kbe-category-btn:visited,
.kbe-catalog-wrapper .kbe-category-btn:hover,
.kbe-catalog-wrapper .kbe-category-btn:focus,
.kbe-catalog-wrapper .kbe-category-btn:active,
.kbe-catalog-wrapper .kbe-category-btn:focus-visible,
.kbe-catalog-wrapper .kbe-category-btn:focus-within,
.kbe-catalog-wrapper .kbe-category-btn:-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;
    -webkit-tap-highlight-color: transparent !important;
    -webkit-focus-ring-color: transparent !important;
}

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

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