/* ============================================================
   AFRIYAH WOOCOMMERCE CUSTOM STYLES
   ============================================================ */

/* Savings Badge */
.af-badge-savings {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #FFD700;
    color: #1a1a1a;
    font-weight: 800;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 14px;
    z-index: 5;
}

/* AI Product Optimization Button (Admin/Meta Box) */
.af-ai-optimize-wrapper {
    margin-bottom: 20px;
    padding: 12px;
    background: linear-gradient(135deg, #006400 0%, #009900 100%);
    border-radius: 8px;
    text-align: center;
}

#af-ai-optimize-btn {
    width: 100%;
    padding: 12px;
    background: #fff;
    color: #006400;
    border: none;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#af-ai-optimize-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
}

.af-ai-optimize-desc {
    margin: 8px 0 0;
    color: #fff;
    font-size: 11px;
    opacity: 0.9;
}

#af-ai-optimize-status {
    margin-top: 8px;
    display: none;
    color: #fff;
    font-size: 12px;
}

/* Trust Badges */
.af-trust-badges {
    margin: 16px 0;
    /* Reduced from 24px */
    padding: 12px 16px;
    background: #f7faf7;
    border-radius: 12px;
    border: 1px solid #e0e0e0;
}

.af-trust-badges-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
}

.af-trust-label {
    font-weight: 600;
    color: #333;
    margin-right: 8px;
}

.af-payment-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    background: #fff;
    border-radius: 6px;
    padding: 6px 12px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.af-payment-icon.paystack {
    min-width: 90px;
}

.af-payment-icon.flutterwave {
    min-width: 110px;
}

.af-payment-icon.mpesa {
    min-width: 85px;
}

.af-payment-icon.opay {
    min-width: 80px;
}

.af-payment-icon.mastercard,
.af-payment-icon.visa {
    /* Auto width to fit content */
    width: auto;
    max-width: 80px;
    overflow: hidden;
    flex-shrink: 0;
    padding: 6px 10px;
}

.af-payment-icon.visa {
    padding: 6px 12px;
}

.af-payment-text {
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.af-payment-text.paystack {
    color: #00AFF0;
}

.af-payment-text.flutterwave {
    color: #F5A623;
}

.af-payment-text.mpesa {
    color: #00A94E;
}

.af-payment-text.opay {
    color: #1bbd5b;
}

.af-payment-text.opay:before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #1bbd5b;
    border-radius: 50%;
    margin-right: 4px;
}

.af-payment-img {
    height: 14px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.af-payment-icon.visa .af-payment-img {
    height: 16px;
}

.af-trust-badges-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap !important;
    /* Allow wrapping */
    color: #555;
    font-size: 14px;
    justify-content: flex-start;
    align-items: center;
}

.af-trust-badges-row span {
    white-space: nowrap;
    flex-shrink: 0;
}

.af-trust-badges-row i {
    color: #006400;
}

@media (max-width:768px) {
    .af-trust-badges-row {
        flex-wrap: nowrap !important;
        gap: 12px !important;
        font-size: 12px !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .af-trust-badges-row span {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }
}

@media (max-width:480px) {
    .af-trust-badges-row {
        gap: 8px !important;
        font-size: 11px !important;
    }
}

/* Delivery Estimate */
.af-delivery-estimate {
    margin: 16px 0;
    padding: 16px;
    background: linear-gradient(135deg, #f7faf7 0%, #ffffff 100%);
    border-radius: 12px;
    border-left: 4px solid #006400;
}

.af-delivery-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.af-delivery-header i {
    color: #006400;
    font-size: 18px;
}

.af-delivery-header strong {
    color: #333;
    font-size: 16px;
}

.af-delivery-msg {
    color: #555;
    font-size: 14px;
    line-height: 1.6;
}

/* QA Badge */
.af-qa-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #1a1a1a;
    border-radius: 20px;
    font-weight: 700;
    font-size: 13px;
    margin: 12px 0;
}

.af-qa-badge i {
    font-size: 16px;
}

/* FOMO Bar */
.af-fomo-single {
    margin: 16px 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff4757 100%);
    color: #fff;
    border-radius: 12px;
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    animation: pulse 2s infinite;
}

.af-fomo-single i {
    margin-right: 8px;
}

/* Buy Now Button */
.af-buy-now-btn,
.af-sticky-atc-buy {
    background: #FFD700 !important;
    color: #1a1a1a !important;
    border: none !important;
    border-radius: 50px !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    padding: 16px 32px !important;
    min-width: 160px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: 12px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.af-buy-now-btn:hover {
    background: #e0a800 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.single_add_to_cart_button.button.alt+.af-buy-now-btn {
    margin-left: 12px !important;
    flex: 1;
}

.woocommerce-variation-add-to-cart {
    display: flex !important;
    gap: 12px !important;
    flex-wrap: wrap !important;
    margin-left: 8px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
}

/* Fix Excess Top Spacing on Product Page */
.single-product .site-content {
    padding-top: 20px !important;
    /* Override default 60px+ */
}

.single-product .product {
    margin-top: 0 !important;
}

/* Best Seller Card Height Fix */
.af-product-card {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.af-product-info {
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

.af-product-actions {
    margin-top: auto !important;
}

/* WhatsApp & Quick Actions Fix */
.af-quick-actions {
    width: 36px !important;
    align-items: center !important;
}

.af-whatsapp-btn,
.af-quick-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 auto !important;
}

.af-whatsapp-btn i,
.af-quick-btn i {
    font-size: 14px !important;
    line-height: 1 !important;
    margin: 0 !important;
}

/* Top Rated CTA Fix */
.af-top-rated-cta {
    background-color: #006400 !important;
    color: #fff !important;
    border: 2px solid #006400 !important;
    border-radius: 50px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.af-top-rated-cta:hover {
    background-color: #004d00 !important;
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 100, 0, 0.2);
}

@media (max-width: 768px) {

    .af-buy-now-btn,
    .single_add_to_cart_button.button.alt {
        padding: 14px 28px !important;
        font-size: 15px !important;
        margin-left: 8px !important;
    }
}

/* WhatsApp Quick Button */
.af-whatsapp-btn {
    background: rgba(37, 211, 102, 0.95) !important;
    color: #fff !important;
}

/* Wishlist Styles */
.af-wishlist-empty {
    text-align: center;
    padding: 60px 20px;
}

.af-wishlist-empty p {
    color: #666;
    font-size: 16px;
    margin-bottom: 20px;
}

.af-wishlist-login-btn,
.af-wishlist-browse-btn {
    display: inline-block;
    padding: 12px 24px;
    background: #006400;
    color: #fff;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.af-wishlist-browse-btn:hover {
    background: #009900;
    transform: translateY(-2px);
}

.af-wishlist-empty-icon {
    font-size: 64px;
    color: #ccc;
    margin-bottom: 20px;
}

.af-wishlist-empty-title {
    color: #666;
    margin-bottom: 16px;
    font-size: 24px;
    font-weight: 600;
}

.af-wishlist-empty-desc {
    color: #999;
    margin-bottom: 24px;
    font-size: 16px;
}

.af-wishlist-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.af-wishlist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid #006400;
}

.af-wishlist-title {
    margin: 0;
    color: #333;
    font-size: 28px;
    font-weight: 700;
}

.af-wishlist-count {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.af-wishlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.af-wishlist-item {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.af-wishlist-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.af-wishlist-img-link {
    position: relative;
    padding-top: 100%;
    overflow: hidden;
    display: block;
    background: #f0f0f0;
}

.af-wishlist-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.af-wishlist-save-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #dc3545;
    color: #fff;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
}

.af-remove-wishlist {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    color: #dc3545;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.af-remove-wishlist:hover {
    background: #dc3545 !important;
    color: #fff !important;
    transform: scale(1.1);
}

.af-wishlist-content {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.af-wishlist-product-title {
    margin: 0 0 10px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 44px;
}

.af-wishlist-product-link {
    color: #333;
    text-decoration: none;
}

.af-wishlist-footer {
    margin-top: auto;
}

.af-wishlist-price {
    font-size: 20px;
    font-weight: 700;
    color: #006400;
    margin-bottom: 12px;
}

.af-wishlist-price-drop {
    font-size: 12px;
    color: #dc3545;
    margin-bottom: 8px;
}

.af-wishlist-actions {
    display: flex;
    gap: 8px;
}

.af-wishlist-action-btn {
    flex: 1;
    padding: 10px;
    background: #006400;
    color: #fff;
    border-radius: 50px;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s;
}

.af-wishlist-out-stock {
    flex: 1;
    padding: 10px;
    background: #ccc;
    color: #666;
    border-radius: 50px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    cursor: not-allowed;
}

@media (max-width: 768px) {
    .af-wishlist-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)) !important;
        gap: 16px !important;
    }
}

/* Sticky Add to Cart */
.af-sticky-atc {
    position: fixed;
    bottom: 70px;
    left: 0;
    right: 0;
    background: #fff;
    padding: 12px 16px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    z-index: 997;
    display: none;
    border-top: 1px solid #e0e0e0;
}

.af-sticky-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
}

.af-sticky-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.af-sticky-content {
    flex: 1;
    min-width: 0;
}

.af-sticky-title {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.af-sticky-price {
    font-size: 16px;
    font-weight: 700;
    color: #006400;
}

.af-sticky-buttons-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.af-sticky-btn {
    padding: 12px 24px;
    background: #006400;
    color: #fff;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    flex: 1;
    min-width: 120px;
    text-align: center;
}

@media (max-width: 768px) {
    .af-sticky-atc {
        display: block !important;
    }

    body {
        padding-bottom: 140px;
    }

    .woocommerce-product-gallery {
        margin-bottom: 80px;
    }
}

/* Mobile Filter Bar */
.af-mobile-filter-bar {
    display: none;
    margin-bottom: 20px;
    justify-content: space-between;
    align-items: center;
}

@media (max-width: 991px) {
    .af-mobile-filter-bar {
        display: flex !important;
    }
}

/* Select Options Popup Responsive */
#af-select-options-popup .af-popup-content {
    max-height: 85vh;
    overflow-y: auto;
    width: 90%;
    max-width: 600px;
    margin: 0 auto;
}

#af-select-options-popup .af-popup-body {
    padding: 20px !important;
}

@media (max-width: 768px) {
    #af-select-options-popup .af-popup-content {
        width: 95%;
    }
}

/* ============================================================
   8. SHOP PAGE LAYOUT & SIDEBAR (Moved from woocommerce.php)
   ============================================================ */

/* Ensure the main content area is always visible */
#wf-main {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Sidebar Visibility logic */
.post-type-archive-product #wf-sidebar,
.tax-product_cat #wf-sidebar,
.tax-product_tag #wf-sidebar,
body.woocommerce #wf-sidebar {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#wf-sidebar aside.shop-sidebar {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@media (min-width: 992px) {
    #wf-sidebar aside.shop-sidebar {
        position: sticky;
        top: 20px;
    }
}

/* Hide sidebar completely on mobile/tablet */
@media (max-width: 991px) {
    #wf-sidebar {
        display: none !important;
    }

    /* Ensure main content takes full width */
    #wf-main.wf-col-lg-8 {
        width: 100% !important;
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
}

/* Prevent any parent/legacy sidebars from showing on shop archives */
.post-type-archive-product aside.widget-area,
.tax-product_cat aside.widget-area,
.tax-product_tag aside.widget-area {
    display: none !important;
}