/* Custom styles for Food Grain project */
html,
body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #1a1a1a;
    background-color: #fcfcfc;
    overflow-x: hidden;
    width: 100%;
}

header {
    transition: all 0.3s ease;
    z-index: 1050;
    /* Ensure header stays on top */
}

header.scrolled {
    background: rgba(244, 244, 244, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding-top: 1rem !important;
    padding-bottom: 1rem;
}

/* Hero Section Layout */
.hero-section {
    width: 100%;
    min-height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Align content to top */
    padding-top: 200px;
    /* Push content down to sit just below the header */
    /* Dotted Pattern Background */
    background-color: #f4f4f4;
    background-image: radial-gradient(rgb(224, 224, 224) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: 1;
}

/* Hero Background Image - Bottom 50% */
.hero-section::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    /* Occupy bottom ~55% */
    background-image: url('../images/hero-bg.png');
    background-size: cover;
    background-position: center top;
    /* Focus on top of image */
    background-repeat: no-repeat;
    /* Soft fade at the top edge of the image */
    -webkit-mask-image: linear-gradient(to top, black 80%, transparent 100%);
    mask-image: linear-gradient(to top, black 80%, transparent 100%);
    pointer-events: none;
    z-index: -1;
}

/* Navbar Pill Container */
.navbar-pill {
    background-color: #1c1c1c;
    border-radius: 999px;
    padding: 6px;
    gap: 4px;
    display: inline-flex;
}

/* Nav Link Styles */
.navbar-pill .nav-link {
    color: rgb(170, 170, 170);
    font-weight: 500;
    font-size: 14.4px;
    padding: 8px 16px;
    border-radius: 999px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0;
    /* Gap handled by transition */
}

.navbar-pill .nav-link i {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s ease;
    margin-right: 0;
}

.navbar-pill .nav-link:hover {
    color: #ffffff;
}

.navbar-pill .nav-link.active {
    color: #1c1c1c !important;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding-left: 12px;
    padding-right: 16px;
}

/* Reveal icon on active state */
.navbar-pill .nav-link.active i {
    max-width: 20px;
    /* Adjust based on icon size */
    opacity: 1;
    margin-right: 6px;
}

/* Hamburger Button */
.hamburger-btn {
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    z-index: 1060;
    /* Above overlay */
}

.hamburger-btn span {
    width: 100%;
    height: 2px;
    background-color: #1a1a1a;
    transition: all 0.3s ease;
    border-radius: 2px;
    transform-origin: 1px;
}

.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(20px);
}

.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg);
}

/* Mobile Menu Overlay (Backdrop) */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    /* Dimmed backdrop */
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    /* Hide from clicks when closed */
    transition: all 0.3s ease;
}

.mobile-menu-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* Mobile Menu Drawer */
.mobile-menu-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 320px;
    /* Fixed width drawer */
    height: 100%;
    background-color: #ffffff;
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    /* Start hidden to the right */
    transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 1050;
    overflow-y: auto;
}

.mobile-menu-overlay.open .mobile-menu-drawer {
    transform: translateX(0);
    /* Slide in */
}

/* Prevent scrolling when menu is open */
body.menu-open {
    overflow: hidden;
}

/* Typography Overrides */
h1.display-3 {
    font-size: 80px !important;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: #111111;
}

p.lead {
    font-size: 17.6px;
    color: #666666;
}

/* Custom Utilities */
.text-balance {
    text-wrap: balance;
}

.btn-pill {
    border-radius: 999px;
}

.footer {
    margin-top: 3rem;
    padding: 1rem 0;
    border-top: 1px solid #eee;
    position: relative;
    z-index: 10;
}

/* Responsive Adjustments for Hero Section */
@media (max-width: 991.98px) {
    .hero-section {
        padding-top: 120px;
        /* Reduce top padding on tablets/mobile */
        background-size: 30px 30px;
        /* Smaller dots */
    }

    h1.display-3 {
        font-size: 56px !important;
        /* Smaller headline */
    }

    .hero-section::after {
        height: 50%;
        /* Reset height to avoid text overlap */
    }

    /* Adjust bottom text overlay */
    .hero-section .container-fluid.position-absolute {
        padding: 1.5rem !important;
        /* Reduce padding p-5 -> p-4 */
    }

    .hero-section .container-fluid.position-absolute h2 {
        font-size: 1.25rem;
        /* Smaller bottom text */
    }
}

@media (max-width: 575.98px) {
    .hero-section {
        padding-top: 0;
        justify-content: center;
        /* Center vertically */
    }

    h1.display-3 {
        font-size: 40px !important;
        margin-bottom: 1rem !important;
    }

    p.lead {
        font-size: 16px;
        margin-bottom: 2rem !important;
    }

    /* Enhance mobile readability by darkening the image mask slightly more */
    .hero-section::after {
        height: 45%;
        -webkit-mask-image: linear-gradient(to top, black 60%, transparent 100%);
        mask-image: linear-gradient(to top, black 60%, transparent 100%);
    }

    /* Stack the bottom text vertically */
    .hero-section .container-fluid.position-absolute {
        flex-direction: column;
        align-items: center !important;
        text-align: center !important;
        gap: 1rem;
        padding-bottom: 2rem !important;
    }
}


/* Stats Section Styles */
.bg-gray-banner {
    background-color: #b3b3b3;
    /* Approximate gray from image */
}

@media (max-width: 767.98px) {
    .bg-gray-banner {
        background-color: transparent !important;
    }
}

/* Desktop Vertical Dividers */
.stats-divider {
    border-right: 1px solid #e9ecef;
    /* Lighter, neater gray */
    position: relative;
}

/* Container Bottom Border */
.stats-row-container {
    border-bottom: 2px solid #e9ecef;
    /* The 'large border' at bottom */
    padding-bottom: 3rem;
    /* Spacing from stats to border */
    margin-bottom: 3rem;
}

/* Mobile/Tablet Adjustments */
@media (max-width: 991.98px) {
    .stats-divider {
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        /* Horizontal divider on mobile */
        padding-bottom: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .stats-divider:last-child {
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 0;
    }

    /* Stats usually don't need huge bottom padding inside the item on mobile */
    .stats-row-container {
        padding-bottom: 2rem;
        margin-bottom: 2rem;
        text-align: center;
    }
}

/* Trading Block Utilities */
@media (min-width: 768px) {
    .trading-block-min-height {
        min-height: 300px;
    }
}

/* Dropdown Menu Styles for Categories */
.navbar-pill .dropdown-toggle::after {
    margin-left: 4px;
    font-size: 10px;
}

.dropdown-menu-categories {
    background-color: #1c1c1c;
    border: none;
    border-radius: 12px;
    padding: 8px;
    margin-top: 0;
    padding-top: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    min-width: 220px;
}

.dropdown-menu-categories .dropdown-item {
    color: rgb(170, 170, 170);
    font-weight: 500;
    font-size: 14.4px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.dropdown-menu-categories .dropdown-item:hover,
.dropdown-menu-categories .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.dropdown-menu-categories .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

/* Nested dropdown (dropend) styles */
.dropdown-menu-categories .dropend {
    position: relative;
}

.dropdown-menu-categories .dropend .dropdown-menu {
    background-color: #1c1c1c;
    border: none;
    border-radius: 12px;
    padding: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    position: absolute;
    left: 100%;
    top: 0;
    margin-left: 8px;
    min-width: 200px;
}

.dropdown-menu-categories .dropend .dropdown-toggle::after {
    border-left: 0.3em solid transparent;
    border-right: 0;
    border-top: 0.3em solid;
    border-bottom: 0.3em solid transparent;
    margin-left: auto;
    margin-right: 0;
    float: right;
    transform: rotate(-90deg);
}

/* Active state for dropdown toggle */
.navbar-pill .nav-link.dropdown-toggle.active {
    color: #1c1c1c !important;
    background-color: #ffffff;
}

.navbar-pill .nav-link.dropdown-toggle.show {
    color: #ffffff;
}

/* Footer Styles */
.footer {
    position: relative;
    z-index: 10;
}

.footer-links a {
    transition: all 0.2s ease;
    position: relative;
}

.footer-links a:hover {
    color: #1a1a1a !important;
    padding-left: 4px;
}

.footer-links a::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 1px;
    background-color: #1a1a1a;
    transition: width 0.3s ease;
}

.footer-links a:hover::before {
    width: 20px;
}

/* Footer Newsletter Input */
.footer .form-control:focus {
    border-color: #1a1a1a;
    box-shadow: 0 0 0 0.2rem rgba(28, 28, 28, 0.1);
}

/* Footer Responsive */
@media (max-width: 991.98px) {
    .footer .col-lg-4 {
        margin-bottom: 2rem;
    }
}

@media (max-width: 767.98px) {
    .footer h6 {
        font-size: 0.9rem;
    }

    .footer .form-control,
    .footer .btn {
        font-size: 0.875rem;
    }
}

/* Hover-based dropdown menu functionality */
@media (min-width: 992px) {

    /* Show dropdown on hover */
    .navbar-pill .nav-item.dropdown:hover>.dropdown-menu {
        display: block;
        animation: fadeInDown 0.3s ease;
    }

    /* Show nested dropdown on hover */
    .dropdown-menu-categories .dropend:hover>.dropdown-menu {
        display: block;
        animation: fadeInRight 0.3s ease;
    }

    /* Smooth fade-in animations */
    @keyframes fadeInDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    @keyframes fadeInRight {
        from {
            opacity: 0;
            transform: translateX(-10px);
        }

        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    /* Highlight dropdown toggle on hover */
    .navbar-pill .nav-item.dropdown:hover>.nav-link.dropdown-toggle {
        color: #ffffff;
    }
}

/* ========================================
   HOME PAGE STYLES
   ======================================== */

/* Minimalist Stats Section Styles */
.stat-card {
    background: #ffffff;
    border: 1px solid #e5e7eb !important;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: #1a1a1a !important;
    transform: translateY(-4px);
}

.stat-number {
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-size: 2.5rem;
}

.stat-label {
    line-height: 1.3;
    font-size: 1rem;
}

.stat-description {
    line-height: 1.4;
    opacity: 0.7;
    font-size: 0.875rem;
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .stat-number {
        font-size: 2.25rem;
    }
}

@media (max-width: 767px) {
    #stats-section {
        padding: 3rem 0 !important;
    }

    .stat-card {
        padding: 2rem !important;
    }

    .stat-number {
        font-size: 2rem;
    }
}

/* Category Navigation Styles */
.category-link {
    transition: all 0.3s ease;
    position: relative;
}

.category-link:hover {
    color: #1a1a1a !important;
}

.category-link.active {
    color: #1a1a1a !important;
    font-weight: 700 !important;
}

.category-link.active::before {
    content: '';
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    background-color: #1a1a1a;
    border-radius: 50%;
}

@media (max-width: 767px) {
    .category-link.active::before {
        display: none;
    }
}

/* Content fade animation */
#category-content {
    transition: opacity 0.3s ease;
}

#category-content.fading {
    opacity: 0;
}

/* Explore button hover */
#explore-btn {
    transition: all 0.3s ease;
}

#explore-btn:hover {
    background-color: #000000 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Gallery Carousel Styles */
.btn-plus:hover {
    transform: rotate(90deg);
}

.nav-btn {
    transition: all 0.3s ease;
    cursor: pointer;
}

.nav-btn-prev {
    color: #333;
}

.nav-btn-prev:hover {
    background-color: #f5f5f5 !important;
}

.nav-btn-next:hover {
    background-color: #333 !important;
}

/* Gallery card styles */
.gallery-card {
    background-size: cover;
    background-position: center;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.card-number,
.card-caption {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sliding animation classes */
.gallery-card.slide-out-left {
    transform: translateX(-120%) scale(0.8);
    opacity: 0;
}

.gallery-card.slide-out-right {
    transform: translateX(120%) scale(0.8);
    opacity: 0;
}

.gallery-card.slide-in-left {
    transform: translateX(-120%) scale(0.8);
    opacity: 0;
}

.gallery-card.slide-in-right {
    transform: translateX(120%) scale(0.8);
    opacity: 0;
}

/* Mobile Carousel Styles */
.mobile-carousel-wrapper {
    overflow: hidden;
    padding: 0 1rem;
}

.mobile-carousel-track {
    display: flex;
    gap: 1rem;
    transition: transform 0.4s ease;
    padding-bottom: 1rem;
}

.mobile-carousel-item {
    flex: 0 0 80%;
    max-width: 80%;
}

.mobile-carousel-card {
    aspect-ratio: 3/4;
    background-color: #cccccc;
    background-size: cover;
    background-position: center;
    border-radius: 1rem;
}

.mobile-card-caption {
    margin-top: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #111111;
}

.mobile-card-number {
    margin-top: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: #666666;
}

/* Countries Banner Styles */
.countries-banner {
    background-color: #b3b3b3;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    height: 500px;
    display: flex;
    align-items: center;
    transition: background-image 0.6s ease;
}


.banner-content-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

.banner-headline,
.banner-location {
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.banner-headline.fade-out,
.banner-location.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

.banner-nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.05);
}

.banner-nav-btn:active {
    transform: scale(0.95);
}

.counter-circle {
    transition: transform 0.3s ease;
}

/* Mobile Responsive Styles */
@media (max-width: 767px) {
    .countries-banner {
        height: 500px;
    }

    /* Flex container for mobile content */
    .banner-content-wrapper {
        display: flex;
        flex-direction: column;
        padding: 2rem;
        align-items: flex-start;
    }

    /* Headline - adjust positioning and size for mobile */
    .banner-headline-wrapper {
        position: static !important;
        max-width: none !important;
        margin-bottom: 1rem;
    }

    .banner-headline {
        font-size: 1.5rem !important;
    }

    /* Location - adjust positioning for mobile */
    .banner-location {
        position: static !important;
        margin-top: 0;
    }

    /* Navigation - adjust positioning for mobile */
    .banner-navigation {
        bottom: 2rem !important;
        right: 2rem !important;
    }

    .counter-circle {
        width: 55px !important;
        height: 55px !important;
        font-size: 0.85rem !important;
    }

    .banner-nav-btn {
        width: 40px !important;
        height: 40px !important;
    }

    .banner-nav-btn svg {
        width: 14px !important;
        height: 14px !important;
    }
}

/* Core Values Section Styles */
.value-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.value-card:hover {
    transform: translateY(-8px);
}

.value-card-image {
    transition: all 0.3s ease;
    position: relative;
}

.value-card:hover .value-card-image {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* Ensure consistent card heights on desktop */
@media (min-width: 992px) {
    .value-card {
        display: flex;
        flex-direction: column;
    }

    .value-card-content {
        flex: 1;
        display: flex;
        flex-direction: column;
    }
}

/* Mobile responsive adjustments */
@media (max-width: 991px) {
    .value-card-image {
        aspect-ratio: 16/9 !important;
    }
}

@media (max-width: 767px) {

    /* Stack cards vertically on mobile */
    .value-card {
        margin-bottom: 2rem;
    }

    /* Adjust header text size */
    .display-5 {
        font-size: 2rem !important;
    }
}

/* ========================================
   CATALOG PAGE STYLES
   ======================================== */

/* Sidebar Navigation */
.category-nav .nav-link {
    color: #666;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.category-nav .nav-link:hover {
    background-color: #f8f9fa;
    color: #1a1a1a;
}

.category-nav .nav-link.active {
    background-color: #1a1a1a;
    color: #fff;
}

.category-nav .nav-link.active .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

/* Product Cards */
.product-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08) !important;
}

.transition-transform {
    transition: transform 0.5s ease;
}

.product-card:hover .transition-transform {
    transform: scale(1.05);
}

.transition-opacity {
    transition: opacity 0.3s ease;
}

.product-card:hover .product-overlay {
    opacity: 1 !important;
}

.limit-text-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Mobile Category Filter */
#mobile-filter-btn {
    transition: all 0.3s ease;
}

#mobile-filter-btn:active {
    transform: scale(0.98);
}

#filter-chevron {
    transition: transform 0.3s ease;
}

#filter-chevron.rotated {
    transform: rotate(180deg);
}

/* Mobile Category Panel */
@media (max-width: 991.98px) {

    /* Hide sidebar by default on mobile - override Bootstrap column */
    #categories-sidebar {
        display: none !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1050;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    #categories-sidebar.show {
        display: block !important;
        opacity: 1;
        visibility: visible;
    }

    .mobile-category-panel {
        position: absolute;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 400px;
        height: 100%;
        background-color: #ffffff;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    #categories-sidebar.show .mobile-category-panel {
        transform: translateX(0);
    }

    /* Prevent body scroll when filter is open */
    body.filter-open {
        overflow: hidden;
    }
}


/* ========================================
   PRODUCT DETAIL PAGE STYLES
   ======================================== */

/* Scoped styles for product detail specific adjustments */
.nav-pills .nav-link {
    color: #666;
    background-color: transparent;
    border: 1px solid transparent;
    font-weight: 500;
}

.nav-pills .nav-link:hover {
    background-color: #f8f9fa;
    color: #111;
}

.nav-pills .nav-link.active {
    background-color: #111;
    color: #fff;
}