/**
 * CPI Main Stylesheet
 * Organized by sections for CMS UI block modularity
 */

/* ============================================
   BASE & RESET
   ============================================ */

/* iOS Safari sticky fix - avoid overflow on html/body */
html {
    background: #f8fafc;
    scroll-padding-top: 6rem;
    /* Do NOT use overflow-x: hidden on html - breaks sticky on iOS */
}

body {
    font-family: 'Inter', sans-serif;
    background: #f8fafc;
    scroll-behavior: smooth;
    margin: 0;
    padding: 0;
    /* Do NOT use overflow properties on body - breaks sticky on iOS Safari */
    -webkit-overflow-scrolling: touch;
    /* Smooth scrolling on iOS */
}

/* Wrapper to prevent horizontal overflow without breaking sticky */
body > *:not(nav):not(#mobile-menu):not(#search-modal):not(#backToTop) {
    max-width: 100vw;
    overflow-x: hidden;
}

.hero-pattern {
    background-color: #f1f5f9;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23e2e8f0' fill-opacity='0.4'%3E%3Cpath opacity='.5' d='M96 95h4v1h-4v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4h-9v4h-1v-4H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15v-9H0v-1h15V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h9V0h1v15h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9h4v1h-4v9zm-1 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm9-10v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-10 0v-9h-9v9h9zm-9-10h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9zm10 0h9v-9h-9v9z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ============================================
   NAVIGATION & STICKY HEADER
   ============================================ */

/* Sticky Header Styles */
nav.sticky,
nav#main-nav {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
    transition: box-shadow 0.3s ease-in-out, background-color 0.3s ease-in-out;
    /* IMPORTANT: Do NOT use will-change:transform or transform on sticky elements - breaks iOS Safari */
}

nav.sticky > div {
    transition: height 0.3s ease-in-out, padding 0.3s ease-in-out;
}

nav.sticky.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.98);
}

/* Force sticky positioning - ensure it works on all browsers */
#main-nav {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1000 !important;
}

/* Ensure no parent elements break sticky */
body > nav#main-nav {
    position: -webkit-sticky !important;
    position: sticky !important;
}

/* ============================================
   HERO SECTION & ANIMATIONS
   ============================================ */

.hero-banner {
    position: relative;
    background-image: url('https://images.unsplash.com/photo-1557804506-669a67965ba0?auto=format&fit=crop&q=80&w=1920');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-color: #0f172a;
    /* Fallback color */
}

/* News Panel Transitions */
.news-panel {
    opacity: 1;
    transform: translateX(0) scale(1);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.news-panel.hidden {
    display: none;
    opacity: 0;
    transform: translateX(30px) scale(0.95);
}

.news-panel.fade-out {
    opacity: 0;
    transform: translateX(-30px) scale(0.95);
}

.news-panel.fade-in {
    opacity: 1;
    transform: translateX(0) scale(1);
}

/* Hero: background slides, content stays (fade) */
#hero-slideshow-wrapper {
    position: relative;
    overflow: hidden;
    min-height: 400px;
}

#hero-bg-track {
    position: absolute;
    inset: 0;
    display: flex;
    width: 400%;
    transition: transform 0.6s ease-in-out;
    z-index: 0;
}

#hero-bg-track .hero-bg-slide {
    position: relative;
    flex: 0 0 25%;
    width: 25%;
    min-width: 25%;
    background-size: cover;
    background-position: center;
    background-color: #0f172a;
}

#hero-bg-track .hero-bg-slide-1 {
    background-image: url('https://images.unsplash.com/photo-1557804506-669a67965ba0?auto=format&fit=crop&q=80&w=1920');
}

#hero-bg-track .hero-bg-slide-2 {
    background-image: url('https://images.unsplash.com/photo-1450101499163-c8848c66ca85?auto=format&fit=crop&q=80&w=1920');
}

#hero-bg-track .hero-bg-slide-3 {
    background-image: url('https://images.unsplash.com/photo-1551288049-bebda4e38f71?auto=format&fit=crop&q=80&w=1920');
}

#hero-bg-track .hero-bg-slide-4 {
    background-image: url('https://images.unsplash.com/photo-1521791136064-7986c2920216?auto=format&fit=crop&q=80&w=1920');
}

#hero-content-wrap {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
}

.hero-slide-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.8);
    transition: background 0.3s, transform 0.3s;
    cursor: pointer;
}

.hero-slide-indicator.active {
    background: #fff;
    transform: scale(1.2);
}

.hero-slide-indicator:hover {
    background: rgba(255, 255, 255, 0.7);
}

/* Hero entrance animations */
@keyframes heroFadeUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes heroFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes heroPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(8, 145, 178, 0.4); }
    50% { box-shadow: 0 0 0 12px rgba(8, 145, 178, 0); }
}
.hero-animate-badge {
    animation: heroFadeUp 0.6s ease-out 0.2s both;
}
.hero-animate-heading {
    animation: heroFadeUp 0.7s ease-out 0.35s both;
}
.hero-animate-desc {
    animation: heroFadeUp 0.6s ease-out 0.5s both;
}
.hero-animate-cta {
    animation: heroFadeUp 0.6s ease-out 0.65s both, heroPulse 2s ease-in-out 1.5s infinite;
}
.hero-animate-card {
    animation: heroFadeUp 0.7s ease-out 0.8s both;
}
.hero-animate-indicators {
    animation: heroFadeIn 0.5s ease-out 1s both;
}

/* ============================================
   CARD COMPONENTS
   ============================================ */

/* Quote card - pointer-events controlled by JavaScript */
/* Note: Base styles now handled by Tailwind utilities in HTML */

.bar-hover:hover {
    filter: brightness(1.1);
    transform: scaleY(1.05);
}

/* ============================================
   FOCUS GROUP SECTION
   ============================================ */

/* Active focus group button - subtle hover effect */
.fg-btn.active:hover {
    filter: brightness(1.1);
}

/* Focus Group: right explanation card – white background */
#fg-explanation-card {
    background: #fff;
    border: 1px solid rgba(148, 163, 184, 0.25);
    box-shadow: 0 4px 24px rgba(14, 165, 233, 0.08);
}

/* Focus Group: scrollable content area - thin scrollbar */
#news-content::-webkit-scrollbar {
    width: 6px;
}
#news-content::-webkit-scrollbar-track {
    background: transparent;
}
#news-content::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 3px;
}
#news-content::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* ============================================
   CHART COMPONENTS
   ============================================ */

.chart-bar {
    position: relative;
    min-height: 20px;
    flex-shrink: 0;
}

.chart-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    background: #1e293b;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    text-align: center;
    min-width: 80px;
}

.chart-tooltip div:first-child {
    margin-bottom: 3px;
}

.chart-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1e293b;
}

.chart-bar:hover .chart-tooltip {
    opacity: 1;
}

/* Line Graph Styles */
.chart-line {
    transition: stroke-width 0.3s ease;
}

.chart-point {
    transition: r 0.3s ease, fill 0.3s ease;
    cursor: pointer;
}

.chart-point:hover {
    r: 7;
    fill: #ea580c;
}

svg:hover .chart-line {
    stroke-width: 4;
}

/* Combined Chart Container */
.relative.h-64,
.relative.h-80 {
    position: relative;
}

/* Ensure line chart overlays properly */
svg[viewBox="0 0 600 200"] {
    z-index: 10;
}

/* Hide rank labels when tooltip is shown to prevent overlap */
.chart-bar:hover ~ svg .rank-label,
.chart-bar:hover + * .rank-label {
    opacity: 0.3;
}

/* Ensure tooltips have higher z-index than rank labels */
.chart-tooltip {
    z-index: 100 !important;
}

/* Adjust rank label opacity when bars are hovered */
.chart-bar:hover {
    z-index: 20;
}

.chart-bar:hover ~ svg text.rank-label,
svg text.rank-label {
    transition: opacity 0.2s ease;
}

/* When hovering over a bar, reduce opacity of nearby rank labels */
.chart-bar:nth-child(1):hover ~ svg text.rank-label:nth-of-type(1),
.chart-bar:nth-child(2):hover ~ svg text.rank-label:nth-of-type(2),
.chart-bar:nth-child(3):hover ~ svg text.rank-label:nth-of-type(3),
.chart-bar:nth-child(4):hover ~ svg text.rank-label:nth-of-type(4),
.chart-bar:nth-child(5):hover ~ svg text.rank-label:nth-of-type(5),
.chart-bar:nth-child(6):hover ~ svg text.rank-label:nth-of-type(6) {
    opacity: 0.2;
}

/* ============================================
   MODALS
   ============================================ */

/* CPI Trend Modal */
#cpi-trend-modal {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#cpi-trend-modal.is-open {
    opacity: 1;
    visibility: visible;
}

#cpi-trend-modal .modal-dialog {
    background: white;
    border-radius: 1.5rem;
    max-width: 42rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

#cpi-trend-modal.is-open .modal-dialog {
    transform: scale(1);
}

#cpi-trend-modal .modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 10;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    border: none;
    background: rgba(15, 23, 42, 0.08);
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: background 0.2s, color 0.2s;
}

#cpi-trend-modal .modal-close:hover {
    background: rgba(15, 23, 42, 0.15);
    color: #0f172a;
}

/* ============================================
   FOOTER
   ============================================ */

/* Footer - global (all screen sizes) */
footer .footer-link {
    position: relative;
    display: inline-block;
    transition: color 0.25s ease, transform 0.25s ease !important;
}

footer .footer-link:hover {
    transform: translateX(8px) !important;
    color: #fff !important;
}

footer .footer-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 2px;
    background: #fff;
    transition: width 0.3s ease;
}

footer .footer-link:hover::after {
    width: 100%;
}

/* ============================================
   RESPONSIVE STYLES
   ============================================ */

/* Sticky Nav Responsive */
@media (max-width: 639px) {
    nav.sticky {
        height: auto;
        min-height: 60px;
    }

    nav.sticky > div {
        height: 60px !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    nav.sticky img {
        width: 60px !important;
        height: auto;
        transition: width 0.3s ease-in-out;
    }
}

@media (min-width: 640px) and (max-width: 1024px) {
    nav.sticky {
        height: auto;
        min-height: 70px;
    }

    nav.sticky > div {
        height: 70px !important;
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }

    nav.sticky img {
        width: 70px !important;
        height: auto;
        transition: width 0.3s ease-in-out;
    }
}

@media (min-width: 1025px) {
    nav.sticky {
        height: auto;
        min-height: 80px;
    }

    nav.sticky > div {
        height: 80px !important;
    }

    nav.sticky img {
        width: 85px !important;
        height: auto;
        transition: width 0.3s ease-in-out;
    }
}

/* Hero Banner Responsive */
@media (max-width: 768px) {
    .hero-banner {
        background-attachment: scroll;
        /* Better performance on mobile */
    }
}

@media (min-width: 768px) {
    #hero-slideshow-wrapper {
        min-height: 600px;
    }

    /* Desktop: show desktop arrows, hide mobile arrows */
    #card-slide-prev,
    #card-slide-next {
        display: flex !important;
    }

    #card-slide-prev-mobile,
    #card-slide-next-mobile {
        display: none !important;
    }
}

/* Mobile fix: allow hero content (card) to define height */
@media (max-width: 767px) {
    #hero-slideshow-wrapper {
        overflow: visible;
        min-height: unset;
    }

    #hero-content-wrap {
        position: relative;
        inset: auto;
        padding-bottom: 2.5rem; /* space so the card isn't clipped */
    }

    /* keep indicators visible below content */
    .hero-animate-indicators {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
        margin-top: 1rem;
        padding-bottom: 1rem;
    }

    /* Mobile: hide desktop arrows, show mobile arrows */
    #card-slide-prev,
    #card-slide-next {
        display: none !important;
    }

    #card-slide-prev-mobile,
    #card-slide-next-mobile {
        display: flex !important;
    }
}

/* Focus Group Responsive */
@media (min-width: 1024px) {
    #fg-explanation-card {
        min-height: 0;
    }
}

/* Mobile reordering for Focus Group Part 1 (buttons + explanation) */
@media (max-width: 1023px) {
    #focus-group-section .grid.lg\:grid-cols-4 {
        display: flex !important;
        flex-direction: column;
        gap: 1.5rem !important;
    }

    /* Focus Group buttons card first on mobile */
    #focus-group-section .grid.lg\:grid-cols-4 > div.lg\:col-span-3 {
        order: 1;
    }

    /* Initiatives explanation panel second on mobile */
    #focus-group-section .grid.lg\:grid-cols-4 > div:first-child {
        order: 0;
    }
}

/* Responsive Component Styles */
/* Mobile: < 640px */
@media (max-width: 639px) {
    /* Navigation arrows - ensure they're accessible */
    #card-slide-prev-mobile,
    #card-slide-next-mobile {
        width: 3rem !important;
        height: 3rem !important;
        min-width: 3rem !important;
        min-height: 3rem !important;
        touch-action: manipulation;
    }

    /* Scroll to top button - ensure it's accessible */
    #backToTop {
        width: 3rem !important;
        height: 3rem !important;
        bottom: 1rem !important;
        right: 1rem !important;
        z-index: 50 !important;
    }

    /* Mobile card adjustments */
    .insight-card .h-40 {
        height: 10rem !important;
    }

    .insight-card h3 {
        font-size: 1rem !important;
        line-height: 1.4 !important;
        margin-top: 0.75rem !important;
    }

    .insight-card p {
        font-size: 0.75rem !important;
        line-height: 1.5 !important;
        margin-top: 0.5rem !important;
    }

    .insight-card .p-4 {
        padding: 1rem !important;
    }
}

/* Tablet: 640px - 1024px */
@media (min-width: 640px) and (max-width: 1024px) {
    /* Navigation arrows */
    #card-slide-prev-mobile,
    #card-slide-next-mobile {
        width: 3.5rem !important;
        height: 3.5rem !important;
    }

    #backToTop {
        width: 3.5rem !important;
        height: 3.5rem !important;
        bottom: 1.5rem !important;
        right: 1.5rem !important;
    }

    /* Better spacing for tablet */
    .grid.md\\:grid-cols-3 {
        gap: 1.5rem !important;
    }

    /* Responsive card adjustments */
    .insight-card .h-40,
    .insight-card .h-44 {
        height: 11rem !important;
    }

    .insight-card h3 {
        font-size: 1.125rem !important;
        line-height: 1.5 !important;
    }

    .insight-card p {
        font-size: 0.875rem !important;
    }

    .insight-card .p-4,
    .insight-card .p-5 {
        padding: 1.25rem !important;
    }
}

/* Desktop: > 1024px */
@media (min-width: 1025px) {
    #backToTop {
        width: 3.5rem !important;
        height: 3.5rem !important;
        bottom: 2rem !important;
        right: 2rem !important;
    }
}

/* Large Desktop: > 1280px */
@media (min-width: 1280px) {
    /* (insight-card responsive styles now in HTML) */
}

/* Mobile Responsive Adjustments */
@media (max-width: 1024px) {
    .hero-banner {
        min-height: auto;
        padding: 3rem 1rem;
    }

    .hero-banner h2 {
        font-size: 2.5rem !important;
    }

    .hero-banner .glass-card {
        margin-top: 2rem;
    }

    /* Mobile menu z-index for tablet */
    #mobile-menu {
        z-index: 9999 !important;
    }

    #mobile-menu-btn {
        z-index: 10001 !important;
    }
}

@media (max-width: 768px) {
    /* Mobile menu adjustments */
    #mobile-menu {
        padding-top: 5rem !important;
    }

    nav.sticky,
    nav#main-nav {
        z-index: 1000 !important;
    }

    #mobile-menu-btn {
        z-index: 10001 !important;
        position: relative;
    }

    /* Top bar adjustments */
    .bg-white.shadow-sm {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .bg-white.shadow-sm > div {
        flex-wrap: wrap;
    }

    /* Navigation */
    nav .max-w-7xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    /* Hero Section */
    .hero-banner {
        padding: 2rem 1rem;
        min-height: auto;
        background-attachment: scroll !important;
        background-color: #0f172a !important;
        /* Ensure background color on mobile */
        background-image: url('https://images.unsplash.com/photo-1557804506-669a67965ba0?auto=format&fit=crop&q=80&w=1920') !important;
    }

    .hero-banner .absolute.inset-0 {
        background: linear-gradient(to right, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.85) 50%, rgba(8, 145, 178, 0.75) 100%) !important;
    }

    .hero-banner h2 {
        font-size: 2rem !important;
        line-height: 1.2;
    }

    .hero-banner p {
        font-size: 1rem !important;
    }

    .hero-banner .flex.flex-wrap {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-banner button {
        width: 100%;
        justify-content: center;
    }

    /* Initiatives Section - Card Slideshow */
    #card-slideshow {
        gap: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
        display: flex !important;
        transition: transform 0.5s ease-in-out !important;
        will-change: transform;
        overflow: visible !important;
    }

    @media (min-width: 768px) {
        #card-slideshow {
            gap: 1rem !important;
        }
    }

    /* Hide desktop arrows on mobile */
    #card-slide-prev,
    #card-slide-next {
        display: none;
    }

    /* Show mobile arrows */
    #card-slide-prev-mobile,
    #card-slide-next-mobile {
        display: flex;
    }

    /* Fix grid layout for mobile */
    /* Note: Removed aggressive grid overrides that were breaking desktop layout */

    /* Quote cards section - target the quote cards container */
    .relative.h-full.mt-6,
    .relative.h-full.mt-8 {
        min-height: 300px !important;
        margin-top: 2rem !important;
    }

    /* Card slideshow container */
    .md\\:col-span-2.relative {
        margin-bottom: 1rem;
    }

    /* Ensure slideshow shows only one card on mobile */
    #card-slideshow {
        overflow: visible !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        position: relative;
        display: flex !important;
        transition: transform 0.5s ease-in-out !important;
        will-change: transform;
    }

    #card-slideshow article {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        flex-shrink: 0 !important;
        margin: 0 !important;
    }

    /* Ensure parent container properly constrains width on mobile */
    @media (max-width: 767px) {
        #card-slideshow {
            width: 100% !important;
            max-width: 100% !important;
        }

        #card-slideshow article {
            width: 100% !important;
            max-width: 100% !important;
            flex-basis: 100% !important;
        }
    }

    /* Desktop: show 2 cards side by side */
    @media (min-width: 768px) {
        #card-slideshow article {
            flex: 0 0 calc(50% - 0.5rem) !important;
            max-width: calc(50% - 0.5rem) !important;
            width: calc(50% - 0.5rem) !important;
        }
    }

    /* Ensure parent containers are constrained */
    .max-w-7xl {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Adjust padding on mobile to prevent overflow */
    .px-4 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Ensure section padding doesn't cause overflow */
    section.bg-gradient-to-br {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    /* Ensure slideshow parent container properly constrains width on mobile */
    @media (max-width: 767px) {

        /* Target the slideshow container parent */
        div.md\:col-span-2 {
            width: 100% !important;
            max-width: 100% !important;
            overflow: hidden !important;
            box-sizing: border-box !important;
        }

        /* Target the overflow-hidden wrapper */
        div.md\:col-span-2 > div.relative {
            width: 100% !important;
            max-width: 100% !important;
            box-sizing: border-box !important;
        }
    }

    section.bg-gradient-to-br > div {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Ensure container doesn't overflow */
    .md\\:col-span-2.relative {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
        overflow: hidden;
        padding-left: 0;
        padding-right: 0;
    }

    .relative.overflow-hidden.rounded-2xl {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* Focus Group Section */
    .grid.lg\\:grid-cols-4 {
        grid-template-columns: 1fr;
    }

    .space-y-8 > div:first-child {
        margin-bottom: 1.5rem;
    }

    /* Chart Section */
    .h-64 {
        height: 12rem;
    }

    .chart-bar {
        min-height: 1rem;
    }

    /* Line Graph Responsive */
    .relative.h-32 {
        height: 6rem !important;
    }

    .relative.h-40 {
        height: 8rem !important;
    }

    svg {
        max-width: 100%;
        height: auto;
    }

    /* Search Modal */
    #search-modal input {
        font-size: 1.5rem !important;
    }

    /* Back to Top Button - Enhanced for mobile */
    #backToTop {
        width: 3rem !important;
        height: 3rem !important;
        min-width: 44px !important;
        /* Minimum touch target */
        min-height: 44px !important;
        bottom: 1rem !important;
        right: 1rem !important;
        z-index: 50 !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Ensure sections have proper background */
    section {
        background-color: inherit;
    }

    /* Fix any white gaps */
    main {
        background: #f8fafc;
    }

    /* Ensure mobile menu button is visible above everything */
    #mobile-menu-btn {
        display: block !important;
        z-index: 10001 !important;
        position: relative;
    }

    /* Mobile menu positioning */
    .mobile-menu {
        padding-top: 5rem !important;
    }

    /* Ensure header stays on top and visible */
    nav.sticky,
    nav#main-nav {
        z-index: 1000 !important;
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
    }

    /* Ensure nav stays visible when mobile menu is open */
    nav#main-nav {
        display: block !important;
        visibility: visible !important;
    }
}

@media (max-width: 640px) {

    /* Extra small devices */
    #card-slide-prev,
    #card-slide-next {
        width: 2rem !important;
        height: 2rem !important;
        font-size: 0.75rem !important;
    }

    #card-slide-prev {
        left: 0.25rem !important;
    }

    #card-slide-next {
        right: 0.25rem !important;
    }

    /* Extra small devices - ensure background consistency */
    body,
    html {
        background: #f8fafc !important;
    }

    /* Only override light gradients, not dark cyan hero gradients */
    section.bg-gradient-to-br.from-cyan-50,
    section.bg-gradient-to-br.from-slate-50 {
        background: linear-gradient(to bottom right, #ecfeff 0%, #cffafe 50%, #f1f5f9 100%) !important;
    }

    .text-5xl {
        font-size: 1.875rem !important;
    }

    .text-4xl {
        font-size: 1.5rem !important;
    }

    .text-3xl {
        font-size: 1.25rem !important;
    }

    .px-6 {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .py-16,
    .py-20 {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }

    .gap-8 {
        gap: 1.5rem;
    }

    .gap-12 {
        gap: 2rem;
    }
}

@media (max-width: 500px) {
    /* Very small devices (500px and below) - prevent cropping like CPI trend card */
    /* Apply same responsive principles as CPI trend card: proper box-sizing, max-width 100%, overflow handling */

    /* Root container fixes - match CPI trend card approach */
    body > *:not(nav):not(#mobile-menu):not(#backToTop) {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* Section containers - match CPI trend card container approach */
    section {
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    section.bg-gradient-to-br {
        width: 100% !important;
        max-width: 100vw !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    section.bg-gradient-to-br > div {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        box-sizing: border-box !important;
    }

    /* Max-width containers - match CPI trend card */
    .max-w-7xl {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    /* Card Slideshow Section - Full responsive down to 500px like CPI trend card */
    #card-slideshow {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: visible !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    #card-slideshow article {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Card slideshow parent containers - match CPI trend card container */
    .md\\:col-span-2.relative {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .relative.overflow-hidden.rounded-2xl {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    /* Grid containers - match CPI trend card grid approach */
    /* Note: Removed aggressive grid overrides that were breaking desktop layout */

    /* Inisiatif section specific fixes */
    section.bg-gradient-to-br.from-cyan-50 {
        width: 100% !important;
        max-width: 100vw !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    section.bg-gradient-to-br.from-cyan-50 > div {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        box-sizing: border-box !important;
    }

    /* Slideshow cards - ensure full width on mobile */
    #card-slideshow article {
        flex: 0 0 100% !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    /* Quote Cards Section - Full responsive down to 500px */
    .relative.h-full.min-h-\[280px\],
    .relative.h-full.min-h-\[320px\],
    .relative.h-full.min-h-\[400px\] {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 260px !important;
        box-sizing: border-box;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Navigation arrows - appropriate size for 500px, match CPI trend card button approach */
    #card-slide-prev-mobile,
    #card-slide-next-mobile {
        width: 2.5rem !important;
        height: 2.5rem !important;
        min-width: 44px !important;
        /* Minimum touch target size */
        min-height: 44px !important;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }

    /* Quote card navigation buttons - responsive sizing */
    #quote-prev,
    #quote-next {
        width: 2rem !important;
        height: 2rem !important;
        min-width: 36px !important;
        min-height: 36px !important;
    }

    /* Prevent any horizontal overflow - but NOT on body/html (breaks sticky on iOS Safari) */
    section,
    main,
    .container {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    /* All padding adjustments for very small screens - match CPI trend card */
    .px-4,
    .px-6 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    /* Gap adjustments for very small screens */
    .gap-4,
    .gap-6,
    .gap-8 {
        gap: 0.75rem !important;
    }

    /* Font size adjustments for very small screens */
    .text-2xl {
        font-size: 1.25rem !important;
    }

    .text-xl {
        font-size: 1.125rem !important;
    }

    .text-lg {
        font-size: 1rem !important;
    }
}

/* Footer Mobile Responsive */
@media (max-width: 768px) {
    /* Mobile footer: Quick Links + Support in 2 columns */
    footer .max-w-7xl.mx-auto.grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 1rem !important;
    }

    /* Logo/intro spans full width */
    footer .max-w-7xl.mx-auto.grid > div:nth-child(1) {
        grid-column: 1 / -1;
    }

    /* Hide the vertical separator on mobile */
    footer .max-w-7xl.mx-auto.grid > div:nth-child(4) {
        display: none !important;
    }

    /* Keep both quicklink lists in the left column */
    footer .max-w-7xl.mx-auto.grid > div:nth-child(2),
    footer .max-w-7xl.mx-auto.grid > div:nth-child(3) {
        grid-column: 1;
    }

    /* Put Support on the right column */
    footer .max-w-7xl.mx-auto.grid > div:nth-child(5) {
        grid-column: 2;
        grid-row: 2 / span 2;
    }
}

/* ============================================
   ABOUT PAGE SPECIFIC STYLES
   ============================================ */

/* Glass Card Effect */
.glass-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

/* Navigation Link Underline Effect */
.nav-link {
    position: relative;
    padding-bottom: 6px;
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #0891b2;
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Desktop Dropdown Menu */
.nav-item-with-dropdown {
    position: relative;
}

.nav-dropdown {
    position: absolute;
    left: 0;
    transform: translateY(-4px);
    top: 100%;
    min-width: 220px;
    padding: 0.5rem 0;
    margin-top: 6px;
    margin-left: 0.5rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    z-index: 1100;
    white-space: nowrap;
}

.nav-item-with-dropdown:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    font-weight: 400;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-dropdown a:hover {
    background: #f1f5f9;
    color: #0891b2;
}

/* Memperbaiki CPI Accordion */
.memperbaiki-accordion-item {
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 0.75rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.memperbaiki-accordion-item:hover,
.memperbaiki-accordion-item.open {
    border-color: #0891b2;
    box-shadow: 0 4px 20px rgba(8, 145, 178, 0.12);
}

.memperbaiki-accordion-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 700;
    font-size: 1rem;
    color: #0f172a;
    background: #fff;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.memperbaiki-accordion-btn:hover {
    background: #f8fafc;
    color: #0891b2;
}

.memperbaiki-accordion-btn .icon-wrap {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 1rem;
}

.memperbaiki-accordion-btn .chevron {
    flex-shrink: 0;
    transition: transform 0.3s ease;
    color: #64748b;
}

.memperbaiki-accordion-item.open .memperbaiki-accordion-btn .chevron {
    transform: rotate(180deg);
    color: #0891b2;
}

.memperbaiki-accordion-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-out;
}

.memperbaiki-accordion-item.open .memperbaiki-accordion-panel {
    max-height: 500px;
}

.memperbaiki-accordion-panel-inner {
    padding: 0 1.25rem 1.25rem;
    padding-left: calc(1.25rem + 2.5rem + 1rem);
}

@media (max-width: 640px) {
    .memperbaiki-accordion-panel-inner {
        padding-left: 1.25rem;
    }
}

.memperbaiki-accordion-panel-inner p {
    font-size: 0.9375rem;
    color: #475569;
    line-height: 1.6;
    margin: 0;
}

/* Language Button Active State */
.lang-btn.active {
    background: #0891b2;
    color: #ffffff;
}

/* Info Card Hover Effect */
.info-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

/* Timeline Item */
.timeline-item::before {
    content: '';
    position: absolute;
    left: -30px;
    top: 0;
    width: 16px;
    height: 16px;
    background: #0891b2;
    border-radius: 50%;
    border: 4px solid #f8fafc;
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 9999;
    padding: 5rem 2rem 2rem;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-20px);
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out, visibility 0.3s ease-in-out;
}

.mobile-menu.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.mobile-menu > a {
    display: block;
    padding: 1rem 0;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #334155;
    text-decoration: none;
    position: relative;
}

.mobile-menu > a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #0891b2;
    transition: width 0.3s ease;
}

.mobile-menu > a:hover {
    color: #0891b2;
}

.mobile-menu > a:hover::after {
    width: 100%;
}

.mobile-menu > a.bg-cyan-600 {
    color: white;
    text-align: center;
    border-bottom: none;
    border-radius: 9999px;
    margin-top: 1rem;
}

.mobile-menu > a.bg-cyan-600::after {
    display: none;
}

.mobile-menu > a.bg-cyan-600:hover {
    color: white;
}

/* Mobile Submenu */
.mobile-nav-item-with-sub {
    border-bottom: 1px solid #e2e8f0;
}

.mobile-nav-item-with-sub > .mobile-menu-row-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #334155;
    cursor: pointer;
    background: none;
    border: none;
    text-align: left;
    position: relative;
}

.mobile-nav-item-with-sub > .mobile-menu-row-trigger::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #0891b2;
    transition: width 0.3s ease;
}

.mobile-nav-item-with-sub > .mobile-menu-row-trigger:hover {
    color: #0891b2;
}

.mobile-nav-item-with-sub > .mobile-menu-row-trigger:hover::after {
    width: 100%;
}

.mobile-nav-item-with-sub.open > .mobile-menu-row-trigger .mobile-submenu-chevron {
    transform: rotate(180deg);
    color: #0891b2;
}

.mobile-submenu-chevron {
    color: #64748b;
    transition: transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.mobile-submenu {
    display: none;
    padding-left: 1rem;
    padding-bottom: 0.5rem;
}

.mobile-nav-item-with-sub.open .mobile-submenu {
    display: block;
}

.mobile-submenu a {
    display: block;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: #64748b;
    text-decoration: none;
    position: relative;
}

.mobile-submenu a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: #0891b2;
    transition: width 0.3s ease;
}

.mobile-submenu a:hover {
    color: #0891b2;
}

.mobile-submenu a:hover::after {
    width: 100%;
}

/* About Page Mobile Responsive */
@media (max-width: 768px) {
    .mobile-menu {
        padding-top: 5rem !important;
    }

    nav.sticky,
    nav#main-nav {
        z-index: 1000 !important;
    }

    #mobile-menu-btn {
        z-index: 10001 !important;
        position: relative;
    }

    .hero-banner {
        padding: 2rem 1rem !important;
        min-height: auto !important;
    }

    h1.text-5xl {
        font-size: 2rem !important;
    }

    h1.text-6xl {
        font-size: 2.5rem !important;
    }

    .grid.lg\\:grid-cols-2 {
        grid-template-columns: 1fr;
    }

    .grid.md\\:grid-cols-2,
    .grid.lg\\:grid-cols-3 {
        grid-template-columns: 1fr;
    }

    .h-64 {
        height: 12rem;
    }

    .chart-bar {
        min-height: 1rem;
    }

    footer .grid.md\\:grid-cols-4 {
        grid-template-columns: 1fr;
    }

    .px-6 {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .py-16,
    .py-20 {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
}

@media (max-width: 1023px) {
    .mobile-menu {
        z-index: 9999;
    }

    #mobile-menu-btn {
        z-index: 10001 !important;
    }
}

/* Chairperson Section Animation */
.chairperson-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
}

.chairperson-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Member Card Animation */
.member-card {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease, box-shadow 0.3s ease;
}

.member-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.member-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Focus Group Card */
.focus-group-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.focus-group-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

/* Shimmer Animation for Progress Bar */
@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}
