:root {
    /* Primary Colors (Adjusted for WCAG AA Compliance) */
    /* Old: #3A9403 (Ratio 3.88 - Fail) -> New: #2F8002 (Ratio ~5.3 - Pass) */
    --primary-color: #2F8002;
    /* Kept original primary as 'light' for gradients/accents */
    --primary-light: #3A9403;
    --primary-dark: #245A01;

    /* Neutral Colors (User Requested) */
    --bg-color: #EEEDF5;
    --text-color: #000000;

    /* Functional Colors */
    --white: #ffffff;
    --text-muted: #333333;
    --border-color: rgba(47, 128, 2, 0.2);

    /* Gadients */
    --gradient-primary: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    --gradient-dark: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    --gradient-bg: linear-gradient(135deg, #EEEDF5 0%, #E6E5EF 100%);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(47, 128, 2, 0.1);
    --shadow-md: 0 4px 15px rgba(47, 128, 2, 0.15);
    --shadow-lg: 0 10px 30px rgba(47, 128, 2, 0.2);
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg-color);
    background: var(--gradient-bg);
    color: var(--text-color);
    font-family: 'Prompt', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease;
}

.container {
    max-width: 960px;
    margin: auto;
    padding: 0 20px;
    /* overflow: hidden; Removed to prevent clipping of sticky elements or dropdowns if not handled */
}

/* Global Transitions */
a,
button,
.card,
.btn,
.btn-primary,
.activity-card,
.product-card,
.video-card,
.article-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Component Overrides */
.btn-primary {
    background: var(--gradient-primary) !important;
    color: white !important;
    border: none !important;
    box-shadow: var(--shadow-md) !important;
    border-radius: 50px !important;
    padding: 12px 28px !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px;
}

.btn-primary:hover {
    background: var(--gradient-dark) !important;
    transform: translateY(-3px) scale(1.02);
    box-shadow: var(--shadow-lg) !important;
}

header {
    background: var(--gradient-dark) !important;
    box-shadow: var(--shadow-md) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    padding: 1rem 0;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow: visible;
}

footer {
    background: var(--gradient-dark) !important;
    color: white !important;
    padding: 4rem 0 !important;
}

section {
    padding: 80px 0;
}

section:nth-child(even) {
    background: rgba(255, 255, 255, 0.4);
}

section:nth-child(odd) {
    background: transparent;
}

/* Card Enhancements */
.card,
.activity-card,
.product-card,
.video-card,
.article-card,
.donation-card {
    background: var(--white) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-sm) !important;
    border-radius: 20px !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* Force 3 columns for Join Ways on Desktop */
@media (min-width: 992px) {
    #join-ways .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Force 3 columns for Groups sections on Desktop */
    #established-groups .product-grid,
    #regional-groups .product-grid,
    #issue-groups .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.product-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

/* Card Internal Layout */
.card-header-placeholder {
    height: 200px;
    background: #f0f2f5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-weight: bold;
    width: 100%;
    flex-shrink: 0;
}

.card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.card-tagline {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.card-body p {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.card-body p:last-child {
    margin-bottom: 0;
    color: #666;
    /* Matching the common pattern for 'Target' */
}

/* Helper for sections needing specific text colors if not last-child */
.text-muted {
    color: #666 !important;
}

.card:hover,
.activity-card:hover,
.product-card:hover,
.video-card:hover,
.article-card:hover,
.donation-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg) !important;
    border-color: var(--primary-light) !important;
}

/* =========================================
   Standardized Header & Navigation Styles
   ========================================= */



header nav {
    display: block;
}

header ul.main-nav,
header ul.products-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

header li {
    display: inline-block;
    position: relative;
    padding: 0 15px;
}

header li a {
    display: block;
    padding: 10px 0;
    color: #fff;
    text-decoration: none;
    font-size: 16px;
    transition: opacity 0.3s ease;
}

header li a:hover {
    opacity: 0.8;
}

.header-logo {
    max-height: 40px;
    width: auto;
    vertical-align: middle;
}

.mobile-menu-toggle {
    display: none;
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 6px 8px;
}

.main-nav li.active a,
.products-nav li.active a {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 8px 16px;
    transition: all 0.3s ease;
}

.main-nav li.active a:hover,
.products-nav li.active a:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Dropdown Menu Styles - ใช้ position: relative จาก header li */
/* Dropdown Menu Styles */
.dropdown {
    /* Base hidden state for desktop */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    position: absolute;
    top: 100%;
    left: 0;
    background: var(--gradient-dark);
    min-width: 220px;
    /* Slightly wider for better content fit */
    box-shadow: var(--shadow-lg);
    border-radius: 12px;
    /* Softer corners */
    padding: 0.5rem 0;
    margin-top: 5px;
    /* Visual spacing */
    z-index: 10000;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Invisible bridge to prevent dropdown from closing when navigating the gap */
.dropdown::before {
    content: '';
    position: absolute;
    top: -20px;
    /* Extends up to overlap with the parent link */
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
}

.dropdown li {
    display: block;
    padding: 0;
    width: 100%;
}

.dropdown li a {
    padding: 12px 20px !important;
    /* Larger click area */
    font-size: 15px !important;
    border-radius: 0 !important;
    width: 100% !important;
    display: flex !important;
    align-items: center;
    color: rgba(255, 255, 255, 0.9) !important;
}

.dropdown li a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff !important;
    transform: translateX(5px);
    /* Subtle nudge on hover */
}

/* Desktop: Show dropdown on hover with animation */
@media (min-width: 769px) {
    .has-dropdown:hover .dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {

    /* Mobile dropdown - always show when parent is clicked/toggled */
    .dropdown {
        /* Reset desktop animation properties for mobile */
        opacity: 1;
        visibility: visible;
        transform: none;
        transition: none;

        position: static;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.1);
        /* Darker background for contrast on mobile */
        margin: 0.5rem 0 0 1rem;
        border-radius: 8px;
        border: none;
        display: none;
        /* Hidden by default on mobile until toggled */
    }

    .has-dropdown .dropdown {
        display: none;
    }

    /* We need JS to toggle .open class on mobile for this to work perfectly 
       But current CSS relies on display:none/block toggling. 
       Let's stick to the existing logic for mobile visibility control */
    .has-dropdown.open .dropdown {
        display: block;
    }
}

@media (max-width: 768px) {
    header .container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 15px;
    }

    .mobile-menu-toggle {
        display: block !important;
    }

    header nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--gradient-dark);
        padding: 15px;
        border-radius: 0 0 15px 15px;
        box-shadow: var(--shadow-lg);
        z-index: 1000;
    }

    header ul.main-nav,
    header ul.products-nav {
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    header li {
        display: block;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    header li a {
        font-size: 14px;
        padding: 12px 15px;
        border-radius: 8px;
        transition: background 0.3s ease;
        display: block;
        width: calc(100% - 30px);
        text-align: left;
    }

    header li a:hover {
        background: rgba(255, 255, 255, 0.2);
        opacity: 1;
    }

    .mobile-nav.hidden {
        display: none;
    }
}

/* Logo Slider Animation */
.logo-slider-section {
    padding: 40px 0;
    overflow: hidden;
    background: #ffffff;
    /* Pure white background */
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    /* Optional: Keep subtle border or remove if "completely white" implies borderless */
}

.logo-slider-container {
    overflow: hidden;
    position: relative;
    width: 100%;
}

/* Gradient Fade Effect on Sides */
.logo-slider-container::before,
.logo-slider-container::after {
    background: linear-gradient(to right, white 0%, rgba(255, 255, 255, 0) 100%);
    content: "";
    height: 100%;
    position: absolute;
    width: 120px;
    z-index: 2;
    pointer-events: none;
}

.logo-slider-container::after {
    right: 0;
    top: 0;
    transform: rotateZ(180deg);
}

.logo-slider-container::before {
    left: 0;
    top: 0;
}

.logo-slider-track {
    display: flex;
    width: calc(320px * 26 * 2);
    /* Increased slide width to 320px */
    animation: scroll 100s linear infinite;
    /* Slower speed (80s -> 100s) */
}

.logo-slider-track:hover {
    animation-play-state: paused;
}

.logo-slide {
    width: 280px;
    /* Reduced width for tighter spacing */
    height: 200px;
    /* Increased height */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    /* Drastically reduced padding */
    flex-shrink: 0;
}

.logo-slide img {
    max-width: 100%;
    max-height: 160px;
    /* Increased max-height */
    object-fit: contain;
    filter: none !important;
    box-shadow: none !important;
    transition: all 0.3s ease;
}

.logo-slide img:hover {
    transform: scale(1.1);
    filter: none !important;
    box-shadow: none !important;
}

@keyframes scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(calc(-280px * 26));
        /* Updated transform calculation */
    }
}

/* Adjust for mobile */
@media (max-width: 768px) {
    .logo-slide {
        width: 140px;
        height: 120px;
        padding: 0 5px;
    }

    .logo-slide img {
        max-height: 90px;
    }

    .logo-slider-track {
        width: calc(160px * 26 * 2);
        animation: scroll 40s linear infinite;
    }

    @keyframes scroll {
        0% {
            transform: translateX(0);
        }

        100% {
            transform: translateX(calc(-160px * 26));
        }
    }
}

/* Stats Section Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
    text-align: center;
}

/* Force 3 columns specifically for Desktop as requested */
@media (min-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}