/* ==========================================================================
   MILLEX — User-side theme overrides
   Brand palette: Green (logo) + Dark navy (logo text)
   ========================================================================== */

:root {
    /* Override the Electro Bootstrap CSS variables so every var(--bs-primary) /
       var(--bs-secondary) usage in style.css turns green/navy automatically. */
    --bs-primary: #6CB728;
    --bs-primary-rgb: 108, 183, 40;
    --bs-secondary: #0E1B3D;
    --bs-secondary-rgb: 14, 27, 61;

    --millex-primary: #6CB728;
    --millex-primary-dark: #5AA01E;
    --millex-primary-darker: #498416;
    --millex-primary-light: #8FD449;
    --millex-primary-soft: #EAF6DA;
    --millex-secondary: #0E1B3D;
    --millex-secondary-light: #1F2F5C;
    --millex-accent: #FFB23F;
    --millex-text: #1f2937;
    --millex-muted: #6b7280;
    --millex-border: #e5e7eb;
    --millex-bg-soft: #f7fafc;
    --millex-shadow: 0 6px 24px rgba(14, 27, 61, .07);
    --millex-shadow-lg: 0 12px 36px rgba(14, 27, 61, .12);
}

/* ----------- Color overrides for Electro Bootstrap classes --------------- */
.bg-primary { background-color: var(--millex-primary) !important; }
.bg-secondary { background-color: var(--millex-secondary) !important; }
.text-primary { color: var(--millex-primary) !important; }
.text-secondary { color: var(--millex-secondary) !important; }
.border-primary { border-color: var(--millex-primary) !important; }

a { color: var(--millex-secondary); }
a:hover { color: var(--millex-primary); }

.btn-primary,
.btn-primary:focus {
    background-color: var(--millex-primary) !important;
    border-color: var(--millex-primary) !important;
    color: #fff !important;
    transition: all .25s ease;
}
.btn-primary:hover {
    background-color: var(--millex-primary-dark) !important;
    border-color: var(--millex-primary-dark) !important;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(108, 183, 40, .35);
}
.btn-secondary,
.btn-secondary:focus {
    background-color: var(--millex-secondary) !important;
    border-color: var(--millex-secondary) !important;
    color: #fff !important;
    transition: all .25s ease;
}
.btn-secondary:hover {
    background-color: var(--millex-secondary-light) !important;
    border-color: var(--millex-secondary-light) !important;
    transform: translateY(-1px);
}
.btn-outline-primary {
    color: var(--millex-primary) !important;
    border-color: var(--millex-primary) !important;
    background: transparent !important;
}
.btn-outline-primary:hover {
    background: var(--millex-primary) !important;
    color: #fff !important;
}
.btn-outline-secondary { color: var(--millex-secondary) !important; border-color: var(--millex-secondary) !important; }
.btn-outline-secondary:hover { background: var(--millex-secondary) !important; color: #fff !important; }

/* Form focus rings */
.form-control:focus,
.form-select:focus {
    border-color: var(--millex-primary);
    box-shadow: 0 0 0 .2rem rgba(108, 183, 40, .18);
}
.form-check-input:checked {
    background-color: var(--millex-primary) !important;
    border-color: var(--millex-primary) !important;
}

/* Headings */
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6,
h1, h2, h3, h4, h5, h6 { color: var(--millex-secondary); }

/* Topbar / navbar */
.nav-bar .bg-primary { background-color: var(--millex-secondary) !important; }
.nav-bar .navbar-light .nav-link { color: rgba(255, 255, 255, .85) !important; font-weight: 500; }
.nav-bar .navbar-light .nav-link.active,
.nav-bar .navbar-light .nav-link:hover { color: var(--millex-primary-light) !important; }
.nav-bar .navbar-light .navbar-toggler { color: #fff; }

/* Mobile: logo strip above the navy bar (wide PNG + hamburger no longer compete for one flex row) */
.millex-mobile-brand {
    border-color: var(--millex-border) !important;
}
/* Flex row: account control is flex-shrink-0; the logo must not shrink to 0 when crossing <lg (WebKit/Safari). */
.millex-mobile-brand > .d-flex {
    min-width: 0;
}
.millex-mobile-logo-link {
    flex: 0 0 auto;
    max-width: min(220px, calc(100% - 6.5rem));
    overflow: hidden;
}
.millex-mobile-header-logo {
    height: 44px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    object-position: left center;
    display: block;
}

/* Page header (breadcrumb hero) — replace orange/red with navy + green */
.page-header {
    background: linear-gradient(135deg, var(--millex-secondary) 0%, var(--millex-secondary-light) 100%) !important;
    position: relative;
    overflow: hidden;
}
.page-header::before {
    content: "";
    position: absolute;
    top: -40%; right: -10%;
    width: 360px; height: 360px;
    background: radial-gradient(circle, rgba(108, 183, 40, .35), transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}
.page-header h1 { color: #fff; position: relative; }
.page-header .breadcrumb-item a { color: rgba(255, 255, 255, .8); }
.page-header .breadcrumb-item a:hover { color: var(--millex-primary-light); }

/* Carousel */
.carousel-banner-offer .bg-primary { background-color: var(--millex-primary) !important; color: #fff !important; }

/* Pagination */
.pagination .page-link {
    color: var(--millex-secondary);
    border-color: var(--millex-border);
    margin: 0 4px;
    border-radius: 8px;
}
.pagination .page-item.active .page-link {
    background-color: var(--millex-primary) !important;
    border-color: var(--millex-primary) !important;
    color: #fff !important;
}
.pagination .page-link:hover { background: var(--millex-primary-soft); color: var(--millex-primary-dark); }

/* Badges */
.badge.bg-primary { background-color: var(--millex-primary) !important; }
.badge.bg-secondary { background-color: var(--millex-secondary) !important; }
.badge.bg-success { background-color: #16a34a !important; }
.badge.bg-warning { background-color: var(--millex-accent) !important; color: #1f2937 !important; }

/* Footer */
.footer { background: var(--millex-secondary) !important; }
.footer .text-primary { color: var(--millex-primary-light) !important; }
.footer .bg-secondary { background: rgba(108, 183, 40, .15) !important; }
.footer .fa-2x.text-primary { color: var(--millex-primary-light) !important; }
.copyright { background: #0a142f !important; color: #fff; }

/* Categories sidebar item */
.categories-bars-item { transition: all .2s ease; padding: 8px 4px; border-radius: 6px; }
.categories-bars-item:hover { background: var(--millex-primary-soft); padding-left: 10px; }

/* ==========================================================================
   PRODUCT CARDS — uniform height, image, alignment
   Applies to .product-item (grid) and .products-mini-item (mini)
   ========================================================================== */

/* Make column wrapper a flex container so the card stretches to row height */
[class*="col-"] > .product-item {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.product-item-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    background: #fff;
    transition: transform .3s ease, box-shadow .3s ease;
}
.product-item-inner:hover {
    transform: translateY(-4px);
    box-shadow: var(--millex-shadow-lg);
    border-color: var(--millex-primary) !important;
}

/* image area — fixed height, contained, soft background */
.product-item-inner-item {
    position: relative;
    height: 240px;
    background: var(--millex-bg-soft);
    border-bottom: 1px solid var(--millex-border);
    overflow: hidden;
}
/* the <a> wrapping the image becomes the centering flexbox so the image is
   always perfectly centered regardless of its natural aspect ratio */
.product-item-inner-item > a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 14px;
    text-align: center;
}
.product-item-inner-item img,
.product-item-inner-item > a > img {
    display: block !important;
    margin: 0 auto !important;
    width: auto !important;
    height: auto !important;
    max-width: 85% !important;
    max-height: 90% !important;
    object-fit: contain;
    object-position: center center;
    transition: transform .4s ease;
}
.product-item-inner:hover .product-item-inner-item img { transform: scale(1.06); }

/* New / best badge */
.product-new {
    position: absolute;
    top: 12px; left: 12px;
    background: var(--millex-primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(108, 183, 40, .35);
}
.product-details {
    position: absolute;
    inset: 0;
    background: rgba(14, 27, 61, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s ease;
    z-index: 2;
}
.product-item-inner:hover .product-details { opacity: 1; }
.product-details a {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: #fff;
    color: var(--millex-secondary) !important;
    display: flex; align-items: center; justify-content: center;
    transition: all .2s ease;
}
.product-details a:hover { background: var(--millex-primary); color: #fff !important; }

/* body — keeps category/title/price aligned across all cards */
.product-item-inner > .text-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.25rem !important;
}
.product-item-inner > .text-center > a:first-child {
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--millex-muted) !important;
    margin-bottom: 6px !important;
    font-weight: 500;
}
.product-item-inner > .text-center > a.h4 {
    font-size: 16px !important;
    font-weight: 600;
    color: var(--millex-secondary) !important;
    line-height: 1.35;
    height: 44px;            /* exactly 2 lines */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 12px !important;
    margin-top: 0 !important;
}
.product-item-inner > .text-center > a.h4:hover { color: var(--millex-primary) !important; }
.product-item-inner > .text-center del {
    color: #9ca3af !important;
    font-size: 14px !important;
}
.product-item-inner > .text-center .text-primary.fs-5 {
    color: var(--millex-primary) !important;
    font-size: 18px !important;
    font-weight: 700;
}

/* footer (price + MOQ) */
.product-item-add {
    background: #fff;
    padding: 0 1.25rem 1.25rem !important;
    margin-top: auto;
}
.product-item-add .btn { width: 100%; padding: .75rem !important; }
.product-item-add .btn i { margin-right: 6px; }

/* mini cards (bestseller small grid) */
.products-mini-item {
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform .3s ease, box-shadow .3s ease;
    border-color: var(--millex-border) !important;
    background: #fff;
}
.products-mini-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--millex-shadow);
    border-color: var(--millex-primary) !important;
}
.products-mini-img {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--millex-bg-soft);
    overflow: hidden;
    position: relative;
}
.products-mini-img img {
    max-width: 80% !important;
    max-height: 85% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    transition: transform .4s ease;
}
.products-mini-item:hover .products-mini-img img { transform: scale(1.06); }
.products-mini-content { display: flex; flex-direction: column; height: 100%; }
.products-mini-content > a:first-child {
    font-size: 12px !important;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--millex-muted) !important;
    margin-bottom: 6px !important;
}
.products-mini-content > a.h4 {
    font-size: 15px !important;
    font-weight: 600;
    color: var(--millex-secondary) !important;
    height: 42px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px !important;
}
.products-mini-content > a.h4:hover { color: var(--millex-primary) !important; }

/* Slide-up reveal for the Request Quote bar — kept INSIDE the card so it
   overlays the product on hover instead of spilling into the next row. */
.products .products-mini .products-mini-item {
    overflow: hidden !important;
    position: relative !important;
}
.products .products-mini .products-mini-item .products-mini-add {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    margin: 0 !important;
    width: 100%;
    background: #fff !important;
    border: 0 !important;
    border-top: 1px solid var(--millex-border) !important;
    border-bottom-left-radius: 10px !important;
    border-bottom-right-radius: 10px !important;
    padding: .9rem 1rem !important;
    opacity: 0;
    transform: translateY(100%);
    transition: transform .4s ease, opacity .35s ease;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}
.products .products-mini .products-mini-item:hover .products-mini-add {
    opacity: 1 !important;
    transform: translateY(0) !important;
    margin: 0 !important;
}
.products-mini-add .btn { width: 100%; }
/* Keep rounded corners + tame the original 1.3x scale on hover */
.products .products-mini .products-mini-item:hover {
    border-bottom-left-radius: 10px !important;
    border-bottom-right-radius: 10px !important;
}
.products .products-mini .products-mini-item:hover .products-mini-img img {
    transform: scale(1.08) !important;
}

/* ==========================================================================
   PRODUCT DETAILS — gallery (large image + circular equal thumbnails)
   ========================================================================== */
.product-gallery-main {
    position: relative;
    width: 100%;
    height: 480px;
    background: var(--millex-bg-soft);
    border: 1px solid var(--millex-border);
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow .3s ease;
}
.product-gallery-main:hover { box-shadow: var(--millex-shadow-lg); }
.product-gallery-main img {
    max-width: 92%;
    max-height: 92%;
    object-fit: contain;
    transition: transform .35s ease;
}
.product-gallery-main:hover img { transform: scale(1.04); }

.product-thumb-list {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}
.product-thumb-btn {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    overflow: hidden;
    padding: 0;
    background: #fff;
    border: 3px solid var(--millex-border);
    box-shadow: 0 2px 6px rgba(14, 27, 61, .06);
    cursor: pointer;
    transition: all .25s ease;
    flex-shrink: 0;
    position: relative;
}
.product-thumb-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
    transition: transform .35s ease;
}
.product-thumb-btn:hover {
    border-color: var(--millex-primary-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(108, 183, 40, .25);
}
.product-thumb-btn:hover img { transform: scale(1.08); }
.product-thumb-btn.is-active {
    border-color: var(--millex-primary);
    box-shadow: 0 0 0 4px rgba(108, 183, 40, .18), 0 6px 18px rgba(108, 183, 40, .35);
}
.product-thumb-btn.is-active::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    pointer-events: none;
    border: 3px solid var(--millex-primary);
}

@media (max-width: 575.98px) {
    .product-gallery-main { height: 320px; }
    .product-thumb-btn { width: 64px; height: 64px; border-width: 2px; }
}

/* ==========================================================================
   CATEGORIES PAGE — wider cards, better spacing
   ========================================================================== */
.categories-show .product-item-inner-item { height: 260px; }
.categories-show .product-item-inner > .text-center { padding: 1.25rem 1.5rem !important; }

/* on category page reduce side padding so cards take more width */
.categories-show .container { max-width: 1300px; }

/* ==========================================================================
   SUPPLIER cards / category cards consistency
   ========================================================================== */
.supplier-card { transition: all .25s ease; }
.supplier-card:hover { transform: translateY(-3px); box-shadow: var(--millex-shadow); border-color: var(--millex-primary) !important; }

/* ==========================================================================
   BRANDED LOADING SPINNER — global B2B/marketplace animation
   ========================================================================== */
#spinner {
    background: linear-gradient(135deg, #ffffff 0%, #f7fafc 100%) !important;
    opacity: 1 !important;
    visibility: visible !important;
    /* keep the branded spinner on screen briefly so the animation is visible,
       then fade it away gracefully even though main.js drops `.show` early */
    transition: opacity .55s ease-out 1.1s, visibility 0s linear 1.65s !important;
}
#spinner:not(.show) {
    opacity: 0 !important;
    visibility: hidden !important;
}

.millex-loader {
    position: relative;
    width: 220px;
    height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.millex-loader-stage {
    position: relative;
    width: 140px;
    height: 140px;
}

/* the brand logo/orb in the center */
.millex-loader-orb {
    position: absolute;
    top: 50%; left: 50%;
    width: 64px; height: 64px;
    margin: -32px 0 0 -32px;
    background: radial-gradient(circle at 30% 30%, var(--millex-primary-light), var(--millex-primary) 70%);
    border-radius: 50%;
    box-shadow: 0 8px 28px rgba(108, 183, 40, .45);
    animation: millex-pulse 1.4s ease-in-out infinite;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-size: 22px;
}
.millex-loader-orb::before {
    content: "\f291"; /* fa-shopping-bag */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
}

/* spinning ring around the orb */
.millex-loader-ring {
    position: absolute;
    inset: 0;
    border: 3px solid rgba(14, 27, 61, .08);
    border-top-color: var(--millex-secondary);
    border-radius: 50%;
    animation: millex-spin 1.2s linear infinite;
}

/* orbiting packages = global trade animation */
.millex-loader-package {
    position: absolute;
    top: 50%; left: 50%;
    width: 22px; height: 22px;
    margin: -11px 0 0 -11px;
    border-radius: 4px;
    background: var(--millex-secondary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    box-shadow: 0 4px 12px rgba(14, 27, 61, .3);
}
.millex-loader-package::before {
    content: "\f466"; /* fa-box */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
}
.millex-loader-package-1 { animation: millex-orbit 2.4s linear infinite; }
.millex-loader-package-2 { animation: millex-orbit 2.4s linear infinite; animation-delay: -.8s; background: var(--millex-primary); }
.millex-loader-package-3 { animation: millex-orbit 2.4s linear infinite; animation-delay: -1.6s; background: var(--millex-accent); color: var(--millex-secondary); }

.millex-loader-text {
    margin-top: 22px;
    font-weight: 700;
    font-size: 18px;
    color: var(--millex-secondary);
    letter-spacing: 4px;
}
.millex-loader-text span {
    display: block;
    font-weight: 400;
    font-size: 12px;
    color: var(--millex-muted);
    letter-spacing: 1px;
    margin-top: 4px;
    text-transform: uppercase;
}

@keyframes millex-spin { to { transform: rotate(360deg); } }
@keyframes millex-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}
@keyframes millex-orbit {
    from { transform: rotate(0deg) translateX(80px) rotate(0deg); }
    to   { transform: rotate(360deg) translateX(80px) rotate(-360deg); }
}

/* ==========================================================================
   Misc small tweaks
   ========================================================================== */

/* page-content (about/services/...) */
.page-content h1, .page-content h2, .page-content h3, .page-content h4 { color: var(--millex-secondary); margin-top: 1.2rem; }
.page-content ul li { margin-bottom: 6px; }

/* alerts */
.alert-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert-danger { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* tabs (product details) */
.nav-tabs .nav-link { color: var(--millex-secondary); font-weight: 500; }
.nav-tabs .nav-link.active { color: var(--millex-primary); border-color: var(--millex-border) var(--millex-border) #fff; }

/* small responsive tweaks */
@media (max-width: 575.98px) {
    .product-item-inner-item { height: 200px; }
    .products-mini-img { height: 160px; }
    .millex-loader-stage { width: 120px; height: 120px; }
    @keyframes millex-orbit {
        from { transform: rotate(0deg) translateX(64px) rotate(0deg); }
        to   { transform: rotate(360deg) translateX(64px) rotate(-360deg); }
    }
}
