/* ========================================
   SOYOSOYO SACCO – FINAL v53
   Cache-busted: ?v=53
   TWO CAROUSELS: INDEX + JOIN-US – NO CONFLICTS
   % GROWTH + GREEN/RED ARROWS + NUMBERS ON BARS
   MOBILE BARS: CENTERED, NO EDGE OVERFLOW
   DESIGN RESTORED – NO FULL-SCREEN STRETCH
   LOAN CALC: SLIDER -> NUMBER INPUT (MOBILE-FRIENDLY)
   DIVIDENDS MOBILE: 2-COL FIT (REDUCED GAP/PADDING, OVERFLOW PREVENTED)
   ======================================== */

/* ----------------- RESET & BASE ----------------- */
*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }
html { scroll-behavior:smooth; overflow-x:hidden; font-size:16px; }
body { 
    font-family: 'Lato', Arial, sans-serif; 
    background:#f8fafc; 
    color:#2d3748; 
    line-height:1.7; 
    overflow-x: hidden;
}

/* ----------------- TYPOGRAPHY ----------------- */
h1 { font-size:2.3rem; font-weight:900; margin-bottom:1rem; }
h2 { font-size:1.8rem; font-weight:800; margin-bottom:0.9rem; }
h3 { font-size:1.5rem; font-weight:700; margin-bottom:0.7rem; }
h4 { font-size:1.3rem; font-weight:700; }
p, li, label, input, select, button, a { font-size:1rem; color:#2d3748; }
ul { list-style:disc inside; margin:1rem 0; padding-left:1.5rem; }
ul li { margin-bottom:0.5rem; }

/* ----------------- LINKS ----------------- */
a { text-decoration:none; color:inherit; }
a:hover { text-decoration:underline; }

/* ----------------- IMAGES ----------------- */
img { max-width:100%; height:auto; display:block; }
.round, .brand-logo { border-radius:50% !important; object-fit:cover !important; }

/* ----------------- HEADER ----------------- */
header.site-header { 
    background:#ffffff; 
    width:100%; 
    position: relative;
    z-index:1000; 
    box-shadow:0 2px 10px rgba(0,0,0,0.1);
}
header.site-header .navbar {
    display:flex; 
    align-items:center; 
    justify-content:space-between;
    padding:0.6rem 1.2rem; 
    max-width:1200px; 
    margin:0 auto; 
    height:56px;
}
header.site-header .brand-logo { width:42px; height:42px; }
header.site-header .member-portal,
header.site-header .nav-links a {
    background:#003087; 
    color:#fff; 
    padding:0.5rem 1rem; 
    border-radius:30px;
    font-weight:700; 
    font-size:0.9rem; 
    transition:0.3s;
}
header.site-header .member-portal:hover,
header.site-header .nav-links a:hover { 
    background:#001f5b; 
    transform: translateY(-2px);
}
header.site-header .nav-links { 
    display:flex; 
    gap:1.2rem; 
}
header.site-header #menu-toggle { 
    display:none; 
    cursor:pointer; 
    background:none; 
    border:none; 
}

/* ----------------- HERO ----------------- */
.hero {
    position: relative;
    width: 100%;
    height: 45vh;
    min-height: 350px;
    max-height: 480px;
    background: url('./assets/header-image.jpg') center/cover no-repeat;
    background-attachment: scroll;
    margin: 0 0 2.5rem 0;
    overflow: hidden;
    z-index: 1;
}
.hero .banner-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    color: #ffffff !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.6);
    text-align: center;
    padding: 1.5rem;
    max-width: 900px;
    width: 92%;
}
.hero .banner-text h1 { 
    font-size: 2.6rem; 
    margin-bottom: 0.8rem; 
    font-weight: 900; 
    color: #ffffff;
}
.hero .banner-text p { 
    font-size: 1.25rem; 
    font-weight: 500; 
    color: #ffffff;
}

/* ----------------- MAIN LAYOUT ----------------- */
.container {
    max-width:1200px; 
    margin:2rem auto; 
    padding:0 1rem;
}

/* ----------------- SECTIONS ----------------- */
.section, .tool-section, .product-card {
    background:#ffffff;
    border-radius:16px; 
    padding:2rem;
    box-shadow:0 8px 24px rgba(0,0,0,0.08);
    margin-bottom:2rem;
    transition:transform 0.3s ease;
}
.section:hover, .tool-section:hover, .product-card:hover { 
    transform:translateY(-6px); 
}
.tool-section > .calculator-wrapper { all: unset; }
.calculator-wrapper { display: contents; }

/* ----------------- JOIN INSTRUCTIONS LAYOUT – TARGETED FIX FOR PHONE-IMAGE ----------------- */
.join-instructions {
    display: flex;
    align-items: flex-start;
    gap: 2rem;
}
.join-instructions img.round { /* Specifically targets the phone-image with .round class */
    width: 280px;
    height: 280px;
    flex-shrink: 0;
    margin: 0;
}
.join-instructions .content {
    flex: 1;
    text-align: left;
}

/* ----------------- MISSION / VISION / CORE VALUES ----------------- */
.mission-vision-container,
.core-values-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: white;
    padding: 1.8rem;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
    margin: 1.5rem 0;
}
.mission-vision-container img,
.core-values-container img {
    width: 85px;
    height: 85px;
    border: 3px solid #006400;
    flex-shrink: 0;
}
.mission-vision-container h2,
.core-values-container h2 {
    color: #006400;
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}
@media (max-width: 768px) {
    .mission-vision-container,
    .core-values-container {
        flex-direction: column;
        text-align: center;
    }
    .mission-vision-container img,
    .core-values-container img {
        width: 70px;
        height: 70px;
    }
}

/* ----------------- LEADERSHIP ----------------- */
.leadership-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.leader-profile {
    text-align: center;
    background: white;
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.06);
}
.leader-profile img {
    width: 110px;
    height: 110px;
    border: 4px solid #006400;
    margin: 0 auto 0.8rem;
}
.leader-profile h3 { font-size: 1.15rem; margin: 0.5rem 0; }
.leader-profile p { font-size: 0.9rem; color: #006400; font-weight: 700; }

/* ----------------- PRODUCTS ----------------- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.8rem;
    margin-top: 1.5rem;
}
.product-card {
    text-align: center;
}
.product-card img {
    height: 180px;
    object-fit: cover;
    border-radius: 12px 12px 0 0;
}
.product-card h2 {
    font-size: 1.3rem;
    margin: 1rem 0 0.5rem;
    color: #003300;
}

/* ----------------- BUTTONS ----------------- */
.products-button,
.join-button,
.job-apply-button {
    display: inline-block;
    background: #006400;
    color: white;
    padding: 0.75rem 1.8rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.95rem;
    margin: 1.2rem 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0,100,0,0.25);
}
.products-button:hover,
.join-button:hover,
.job-apply-button:hover {
    background: #004d00;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,100,0,0.35);
}

/* ----------------- LOAN & DIVIDENDS CALCULATOR ----------------- */
.calculator {
    background:#fff; 
    padding:2rem; 
    border-radius:16px;
    box-shadow:0 8px 24px rgba(0,0,0,0.1);
    max-width: 600px;
    margin: 0 auto;
}
.calculator h2 { 
    font-size:1.7rem; 
    margin-bottom:1.2rem; 
    color:#006400; 
    text-align:center; 
}
.form-group { margin-bottom:1.5rem; }
.form-group label { 
    display:block; 
    margin-bottom:0.6rem; 
    font-weight:600; 
    color:#1a202c; 
}
.form-group input, .form-group select {
    width:100%; 
    padding:0.85rem; 
    border:1px solid #90EE90; 
    border-radius:8px; 
    font-size:1rem;
}
.calculator button {
    background:#006400; 
    color:white; 
    border:none; 
    padding:0.9rem; 
    border-radius:30px;
    font-weight:700; 
    cursor:pointer; 
    width:100%; 
    font-size:1rem; 
    transition:0.3s;
}
.calculator button:hover { 
    background:#004d00; 
    transform:translateY(-2px);
}
#dividends-calculator .calculator {
    max-width: 800px;
    display: grid;
    gap: 1.2rem;
}
.month-subheader {
    grid-column: 1 / -1;
    font-size: 1.1rem;
    font-weight: 700;
    color: #006400;
    text-align: center;
    margin-bottom: 0.5rem;
}
.month-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    width: 100%; /* Ensure full width to prevent overflow */
}
.month-inputs input {
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    width: 100%; /* Explicit width for grid items */
    box-sizing: border-box;
}
@media (max-width: 768px) {
    .month-inputs { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 0.5rem; /* Reduced gap to fit better on mobile */
    }
    .month-inputs input {
        padding: 0.6rem; /* Slightly reduced padding to save space */
        font-size: 0.9rem; /* Minor font reduction for compactness */
    }
    /* LOAN CALC: ENHANCE NUMBER INPUT FOR MOBILE (TOUCH-FRIENDLY, NO ZOOM) */
    .form-group input[type="number"] {
        font-size: 1.05rem; /* Slight bump for easier typing on mobile */
        padding: 1rem; /* Extra padding for thumb taps */
    }
    .form-group input[type="number"]::-webkit-outer-spin-button,
    .form-group input[type="number"]::-webkit-inner-spin-button {
        opacity: 1; /* Show spinner arrows if desired; hide with 0 if not */
    }
}

/* ----------------- INDEX CAROUSEL (FINANCIAL HIGHLIGHTS) – WORKING ----------------- */
.carousel-wrapper {
    overflow: hidden;
    background: #f0fdf4;
    padding: 2rem 0;
    margin: 2rem 0;
}
.carousel {
    display: flex;
    width: max-content;
    animation: scroll-carousel var(--carousel-duration, 56s) linear infinite;
}
.carousel-item {
    flex: 0 0 var(--item-width, 300px);
    margin: 0 var(--item-margin, 40px);
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-align: center;
}
.carousel-button {
    background: #90EE90;
    color: #006400;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.6rem;
    margin-bottom: 0.6rem;
}
.carousel-description {
    font-size: 0.95rem;
    color: #333;
}
@keyframes scroll-carousel {
    0% { transform: translateX(0); }
    100% { transform: translateX(var(--carousel-translate, -2100px)); }
}
.carousel-wrapper:hover .carousel {
    animation-play-state: paused;
}

/* ----------------- JOIN-US CAROUSEL (FIXED: NO HORIZONTAL SCROLL) ----------------- */
.carousel-join-wrapper {
    overflow: hidden;
    padding: 2rem 0;
    background: #f0fdf4;
}
.carousel-join {
    display: flex;
    width: max-content;
    animation: scroll-join var(--carousel-duration, 40s) linear infinite;
}
.carousel-join-item {
    flex: 0 0 var(--item-width, 280px);
    margin: 0 var(--item-margin, 30px);
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    text-align: center;
}
.carousel-join-button {
    background: #90EE90;
    color: #006400;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-weight: bold;
    font-size: 1.5rem;
    margin-bottom: 0.8rem;
}
.carousel-join-description {
    font-size: 0.95rem;
    color: #333;
}
@keyframes scroll-join {
    0% { transform: translateX(0); }
    100% { transform: translateX(var(--carousel-translate, -1200px)); }
}
.carousel-join-wrapper:hover .carousel-join {
    animation-play-state: paused;
}

/* ----------------- MOBILE MENU ----------------- */
@media (max-width: 768px) {
    header.site-header .navbar { height:60px; padding:0.5rem 0.8rem; }
    header.site-header .brand-logo { width:38px; height:38px; }
    header.site-header #menu-toggle { display: block !important; }
    header.site-header .nav-links {
        position: fixed;
        top: 60px;
        right: 0;
        width: auto;
        max-width: 240px;
        background: #003087;
        padding: 1.2rem 1.5rem;
        z-index: 9999;
        border-radius: 0 0 0 16px;
        box-shadow: -6px 10px 25px rgba(0,0,0,0.3);
        flex-direction: column;
        gap: 0.8rem;
        transition: all 0.35s ease;
        transform: translateX(100%);
        opacity: 0;
        visibility: hidden;
    }
    header.site-header .nav-links.show {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
    }
    header.site-header .nav-links a {
        color: #ffffff !important;
        background: #001f5b;
        padding: 0.75rem 1.2rem;
        border-radius: 8px;
        font-weight: 700;
        font-size: 1rem;
        text-align: center;
        white-space: nowrap;
    }
    header.site-header .nav-links a:hover {
        background: #90EE90;
        color: #003087 !important;
    }
    .hero { height: 40vh; min-height: 300px; max-height: 400px; }
    .hero .banner-text h1 { font-size: 2rem; }
    .hero .banner-text p { font-size: 1.1rem; }
    .container { margin: 1.5rem auto; padding: 0 0.8rem; }
    .section, .tool-section { padding: 1.6rem; margin-bottom: 1.5rem; }
    .carousel-wrapper, .carousel-join-wrapper { padding: 1.5rem 0; }
    .carousel-item, .carousel-join-item { 
        flex: 0 0 42vw; /* Reduced from 80vw to ~42vw to fit at least two items side-by-side */
        margin: 0 8px; /* Slightly reduced margins for better fit without overflow */
        padding: 1.2rem; /* Reduced internal padding to keep contents compact */
    }
    .carousel-button, .carousel-join-button { 
        font-size: 1.3rem; /* Slightly reduced button font size for mobile */
        padding: 0.8rem 1.2rem; 
    }
    .carousel-description, .carousel-join-description { 
        font-size: 0.85rem; /* Reduced description font size */
    }
    /* MOBILE FIX FOR JOIN-INSTRUCTIONS: STACK VERTICALLY, KEEP IMAGE AS-IS (FINE ON MOBILE) */
    .join-instructions {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    .join-instructions img.round {
        width: 200px;
        height: 200px;
        margin: 0 auto;
    }
    .join-instructions .content {
        text-align: center;
    }
}

/* ----------------- DESKTOP FULL-WIDTH ENLARGEMENT – SAFE, SYMMETRIC SCALE ----------------- */
@media (min-width: 769px) {
    .container { 
        max-width: 1400px; /* Increased from 1200px for fuller desktop use without overflow */
        margin: 2rem auto; 
        padding: 0 1.5rem; /* Slight padding increase for symmetry on wider screens */
    }
    /* Symmetric scale for key elements to match enlarged container */
    .section, .tool-section { padding: 2.2rem; } /* Minor padding bump for breathing room */
    h1 { font-size: 2.5rem; } /* Slight h1 enlargement for balance */
    h2 { font-size: 1.95rem; } /* Proportional h2 scaling */
    .products-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); } /* Wider product cards */
    .product-card img { height: 200px; } /* Scaled image height for symmetry */
    .leadership-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } /* Wider leader profiles */
    .leader-profile img { width: 130px; height: 130px; } /* Symmetric profile image scale */
    .carousel-item { --item-width: 340px; --item-margin: 45px; } /* Wider carousel items for desktop */
    .carousel-join-item { --item-width: 320px; --item-margin: 35px; } /* Adjusted join carousel */
    .mission-vision-container, .core-values-container { padding: 2rem; } /* Scaled containers */
    .mission-vision-container img, .core-values-container img { width: 100px; height: 100px; } /* Larger icons */
}

/* ----------------- FOOTER ----------------- */
footer {
    background:#003087; 
    color:#ffffff; 
    text-align:center; 
    padding:3rem 1rem; 
    margin-top:4rem;
    font-size:1rem;
}
footer a { color:#90EE90; text-decoration:none; font-weight:600; }
footer a:hover { color:#ffffff; }
.social-icons a { 
    margin:0 1rem; 
    font-size:1.5rem; 
    color:#90EE90; 
    transition:0.3s; 
}
.social-icons a:hover { 
    color:#ffffff; 
    transform:scale(1.15); 
}

/* ----------------- GROWTH CHARTS – SMALL, CENTERED, NO STRETCH ----------------- */
.growth-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}
.chart-card {
    background: #ffffff;
    padding: 1.6rem 1.2rem;
    border-radius: 18px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    text-align: center;
    transition: transform 0.3s ease;
    overflow: hidden;
    position: relative;
}
.chart-card:hover { transform: translateY(-6px); }
.chart-card canvas {
    height: 180px !important;
    margin: 0 auto;
    max-width: 100%;
    display: block;
}
.chart-card p {
    margin-top: 0.8rem;
    font-weight: 600;
    color: #1f2937;
    font-size: 0.95rem;
}

/* % GROWTH INDICATOR – 100% MATHEMATICAL */
.growth-indicator {
    text-align: center;
    margin-top: 0.5rem;
    font-weight: bold;
    font-size: 1rem;
}
.growth-indicator.positive { color: #10B981; }
.growth-indicator.negative { color: #EF4444; }
.growth-indicator i { margin-right: 4px; font-size: 0.9em; }

/* MOBILE: CENTERED, NO EDGE OVERFLOW */
@media (max-width: 768px) {
    .growth-charts-grid { 
        grid-template-columns: 1fr; 
        gap: 1.2rem;
    }
    .chart-card {
        padding: 1.4rem 1rem;
    }
    .chart-card canvas { 
        height: 160px !important; 
    }
    .growth-indicator {
        font-size: 0.95rem;
    }
}

/* ----------------- END OF FILE ----------------- */
