/* Freak Engineer - Global Custom Styles */

:root {
    --brand-blue: #000098;
    --brand-blue-hover: #0a0aa8;
    --success-green: #28a745;
    --danger-red: #dc3545;
    --border-light: #e8e8e8;
    --bg-light: #f9f9f9;
}

/* ===== HERO GRID & SLIDER (from index.php) ===== */
.hero-grid {
    display: flex;
    gap: 20px;
    margin: 0;
    padding: 0;
    width: 100%;
}

.hero-slider-col {
    flex: 0 0 70%;
    max-width: 70%;
}

.hero-service-col {
    flex: 0 0 calc(30% - 20px);
    max-width: calc(30% - 20px);
    background: linear-gradient(145deg, rgba(0, 0, 152, 0.6), rgba(0, 0, 77, 0.7)), url('/assets/images/3d_printing.webp');
    background-size: cover;
    background-position: center;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 30px;
    color: #fff;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.service-badge {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    backdrop-filter: blur(5px);
}

.service-title {
    font-size: 32px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 15px;
    background: linear-gradient(to bottom, #ffffff, #cccccc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.service-desc {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 30px;
    color: rgba(255, 255, 255, 0.85);
    max-width: 280px;
}

.service-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #25d366;
    color: #fff !important;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none !important;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(37, 211, 102, 0.3);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.hero-slide-wrapper {
    position: relative;
    display: block;
    width: 100%;
    height: min(65vh, 580px);
    min-height: 240px;
    overflow: hidden;
    background-color: #f0f0f0;
}

.hero-slide-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== ICON BOX GRID (from index.php) ===== */
.icon-box-grid .icon-box-icon,
.icon-box-grid .icon-box-icon i {
    color: var(--brand-blue) !important;
}

@media (max-width: 576px) {
    .icon-box-grid .row {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 6px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .icon-box-grid .icon-box {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 6px 4px !important;
        min-width: 0 !important;
    }

    .icon-box-grid .icon-box.icon-box-side {
        flex-direction: column !important;
    }

    .icon-box-grid .icon-box-icon {
        margin: 0 0 4px 0 !important;
        width: auto !important;
        height: auto !important;
    }

    .icon-box-grid .icon-box-icon i {
        font-size: 18px !important;
    }

    .icon-box-grid .icon-box-title {
        font-size: 11px !important;
        line-height: 1.2 !important;
    }

    .icon-box-grid .icon-box-content p {
        display: none !important;
    }
}

/* ===== UNIVERSAL PRODUCT CARD SYSTEM ===== */
.product-card-container {
    position: relative;
    padding: 0 10px;
    max-width: 1440px !important;
    margin: 0 auto !important;
}

.product-card-container .swiper-slide {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
}

/* Universal Product Card - Base */
.product {
    border: 1px solid #e8e8e8 !important;
    border-radius: 12px !important;
    transition: all 0.3s ease !important;
    background: #fff !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    padding-bottom: 0 !important; /* Managed by card-actions padding */
    overflow: hidden !important;
    position: relative !important;
}


/* Product Media / Image Container */
.product-media {
    position: relative !important;
    border-radius: 11px 11px 0 0 !important;
    overflow: hidden !important;
    aspect-ratio: 1/1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #ffffff !important;
    width: 100% !important;
}

.product-media a {
    background: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 100% !important;
}


.product-media img {
    max-width: 90% !important;
    max-height: 90% !important;
    object-fit: contain !important;
    transition: transform 0.5s ease !important;
    margin: auto !important;
}




/* Secondary Image Hover Swap */
.product-media .product-img-secondary {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    opacity: 0 !important;
    transition: opacity 0.4s ease, transform 0.5s ease !important;
}

.product:hover .product-media.has-secondary .product-img-primary {
    opacity: 0 !important;
}

.product:hover .product-media.has-secondary .product-img-secondary {
    opacity: 1 !important;
}

/* Badges */
.product-badge {
    position: absolute !important;
    top: 15px !important;
    left: 15px !important;
    background: var(--danger-red) !important;
    color: #fff !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    z-index: 5 !important;
}

.product-badge.out-of-stock {
    background: var(--danger-red) !important;
    box-shadow: 0 4px 10px rgba(220, 53, 69, 0.3) !important;
}

/* Out of Stock Styling */
.product.is-out-of-stock {
    opacity: 0.8 !important;
}

.product.is-out-of-stock .btn-buy-now {
    background: #e0e0e0 !important;
    color: #999 !important;
    cursor: not-allowed !important;
}

.product-details {
    padding: 10px 12px 10px !important; /* Adjusted padding */
    display: flex !important;
    flex-direction: column !important;
    flex-grow: 1 !important;
    text-align: left !important;
    justify-content: flex-start !important;
    gap: 0px !important;
}

.product-discount-label {
    color: #03a685 !important; /* Vibrant green like competitor mockup */
    font-size: 13px !important;
    font-weight: 800 !important;
    margin-top: 8px !important;
    text-transform: uppercase !important;
}

.product-cat {
    font-size: 11px !important;
    text-transform: uppercase !important;
    color: #999 !important;
    margin-bottom: 5px !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
}

.product-name {
    font-size: 14px !important;
    color: #111 !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    margin: 0 !important; /* Force zero margin */
    padding: 0 !important;
    min-height: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

.product-price {
    font-size: 18px !important;
    font-weight: 800 !important;
    color: #111 !important; /* Bold black like competitor mockup */
    margin-top: 2px !important; /* Spacing from discount label */
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
}

.old-price {
    font-size: 14px !important;
    color: #bbb !important;
    text-decoration: line-through !important;
    font-weight: 500 !important;
    margin-left: 8px !important;
}


/* Action Buttons */
.card-actions {
    display: flex !important;
    gap: 8px !important;
    padding: 5px 12px 12px !important; /* Reduced padding */
    margin-top: 0 !important;
}

.btn-buy-now {
    flex: 1 !important;
    padding: 10px 15px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    background: var(--brand-blue) !important;
    color: #fff !important;
    border: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
}

.btn-wishlist-custom {
    position: absolute !important;
    top: 15px !important;
    left: 15px !important; /* Move to top-left corner per competitor mockup */
    right: auto !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 12px !important; /* Boxy rounded look like competitor */
    background: #fff !important;
    color: #444 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
    border: 1px solid #eee !important;
    padding: 0 !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
}

.btn-wishlist-custom i {
    font-size: 16px !important;
}

.btn-wishlist-custom.added,
.btn-wishlist-custom.w-icon-heart-full {
    color: #ff4b2b !important;
    background: #fff !important;
}

.btn-wishlist-custom:hover {
    transform: scale(1.1) !important;
    color: #ff4b2b !important;
}

/* New Add to Cart Icon Button (Top Right) */
.btn-add-cart-icon {
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    width: 38px !important;
    height: 38px !important;
    border-radius: 12px !important; /* Boxy rounded look like competitor */
    background: linear-gradient(135deg, #4b6cb7, #182848) !important; /* Premium blue gradient */
    color: #fff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 10 !important;
    border: none !important;
    box-shadow: 0 6px 15px rgba(0,0,0,0.2) !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    padding: 0 !important;
}

.btn-add-cart-icon i {
    font-size: 18px !important;
    font-weight: 900 !important;
}

.btn-add-cart-icon:hover {
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 8px 18px rgba(0,0,0,0.25) !important;
}

.btn-buy-now {
    display: none !important; /* Hide the old bottom button */
}

.btn-wishlist-custom:hover {
    background: #e0e0e0;
}

/* ===== NAVIGATION CONTROLS ===== */
.arrivals-controls {
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
}

.arrivals-prev, .arrivals-next {
    pointer-events: auto;
    position: absolute;
    top: 42%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--brand-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    z-index: 15;
    border: none;
    transition: transform .2s ease, background .2s ease;
}

.arrivals-prev { left: 5px; }
.arrivals-next { right: 5px; }

.arrivals-prev:hover, .arrivals-next:hover {
    transform: translateY(-50%) scale(1.06);
    background: var(--brand-blue-hover);
}

.arrivals-prev::before { content: "‹"; font-size: 24px; }
.arrivals-next::before { content: "›"; font-size: 24px; }

/* ===== PRODUCT LISTING GRID (Non-Swiper) ===== */
.product-listing-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 20px !important;
    padding: 20px 0 !important;
}

/* Ensure all products in the grid fill their cell height */
.product-listing-grid .product {
    height: 100% !important;
}


@media (max-width: 1200px) {
    .product-listing-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    .product-listing-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 10px 0 !important;
    }
}

@media (max-width: 480px) {
    .product-listing-grid {
        gap: 8px !important;
    }
    
    .product {
        border-radius: 10px !important;
    }

    .product-details {
        padding: 10px !important;
    }
    
    .product-name {
        font-size: 12px !important;
        height: auto !important; /* Reduced vertical gap */
        min-height: 0 !important;
        margin-bottom: 4px !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
    }
    
    .product-price {
        font-size: 14px !important;
    }

    .card-actions {
        padding: 0 8px 10px !important;
        gap: 6px !important;
    }

    .btn-buy-now {
        padding: 8px 4px !important;
        font-size: 11px !important;
        border-radius: 6px !important;
    }

    .btn-buy-now span {
        display: inline !important; /* Keep label but make it small */
    }

    .btn-wishlist-custom {
        width: 30px !important;
        height: 30px !important;
        top: 8px !important;
        right: 8px !important;
    }
    
    .btn-wishlist-custom i {
        font-size: 14px !important;
    }
}


/* ===== FILTER TOOLBOX ===== */
.cat-v2-toolbox {
    margin-bottom: 24px;
    background: #ffffff;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid #f0f0f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.cat-v2-toolbox form {
    display: flex;
    gap: 16px;
    width: 100%;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
}

.cat-v2-filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.cat-v2-filter-group label {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 0;
    color: #2d3436;
    white-space: nowrap;
}

.cat-v2-select {
    flex: 1;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    font-size: 13px;
    font-weight: 500;
    background: #fbfbfb;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: calc(100% - 12px) center;
    padding-right: 32px;
}

.cat-v2-select:hover {
    border-color: #000098;
    background-color: #fff;
}

.cat-v2-select:focus {
    outline: none;
    border-color: #000098;
    box-shadow: 0 0 0 3px rgba(0, 0, 152, 0.1);
}

@media (max-width: 991px) {
    .cat-v2-filter-group {
        max-width: none;
    }
}

@media (max-width: 576px) {
    .cat-v2-toolbox {
        padding: 12px;
        margin-bottom: 20px;
    }
    .cat-v2-toolbox form {
        gap: 12px;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .cat-v2-filter-group {
        min-width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .cat-v2-filter-group:nth-child(1) {
        grid-column: span 2;
    }
    .cat-v2-filter-group label {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #888;
    }
    .cat-v2-select {
        width: 100%;
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* ===== SWIPER LAYOUT FOR CARDS ===== */
.product-card-container .swiper-container {
    overflow: hidden; /* Prevent bleeding beyond borders */
    position: relative;
    width: 100%;
}

.product-card-container .swiper-wrapper {
    display: flex;
    align-items: stretch;
}

.product-card-container .swiper-slide {
    height: auto !important;
    display: flex !important;
    width: auto; /* Let Swiper JS control the width */
}

.product-card-container .product {
    height: 100% !important;
    width: 100%; /* Fill the allocated slide width */
    max-width: 280px; /* Safety cap */
    margin: 0 auto;
}

/* Mobile Button Synchronization */
@media (max-width: 576px) {
    .btn-wishlist-custom,
    .btn-add-cart-icon {
        width: 36px !important;
        height: 36px !important;
        top: 12px !important; 
        border-radius: 10px !important; /* Forces consistent rounded square look */
        box-shadow: 0 4px 10px rgba(0,0,0,0.15) !important; /* Matching shadow for scale */
    }
    
    .btn-wishlist-custom {
        left: 12px !important;
        right: auto !important;
    }
    
    .btn-add-cart-icon {
        right: 12px !important;
        left: auto !important;
    }
}
