
@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter';
    src: url('../fonts/inter-bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --primary-blue: #0b63c7;
    --dark-blue: #0a2a57;
    --light-blue-bg: #e6eef8;
    --white: #ffffff;
    --text-main: #1f2a37;
    --text-muted: #4b5563;
    --border-color: #e0e0e0;
    --shadow-soft: 0 2px 8px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.02);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08), 0 12px 32px rgba(0, 0, 0, 0.04);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --radius-md: 11px;
    --radius-lg: 14px;
    --transition-speed: 0.25s;
    --row-h: 34px;
    --header-h: 30px;
}

html {
    font-size: 13.5px;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    background-color: var(--light-blue-bg);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-size: 1rem;
    line-height: 1.4;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-speed), transform var(--transition-speed);
}

.wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Header */
.site-header {
    background: var(--white);
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 8px 0;
    height: 60px; /* Fixed height for CLS */
    contain: size layout;
    box-sizing: border-box;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark-blue);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.logo .highlight {
    color: var(--primary-blue);
    background: rgba(0, 102, 204, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

/* Desktop Navigation */
.desktop-nav {
    display: flex;
    align-items: center;
    gap: 24px;
}

.nav-link {
    font-weight: 500;
    color: var(--text-main);
    cursor: pointer;
    font-size: 1.05rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--primary-blue);
}

.nav-highlight {
    border: 1px solid var(--primary-blue);
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--primary-blue) !important;
    transition: all 0.2s;
}

.nav-highlight:hover {
    background: var(--light-blue-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 4px;
}

.arrow {
    font-size: 0.7em;
    transition: transform var(--transition-speed);
}

.nav-item-dropdown {
    position: relative;
}

.nav-item-dropdown:hover .arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--white);
    min-width: 200px;
    box-shadow: var(--shadow-hover);
    border-radius: var(--radius-md);
    padding: 8px 0;
    margin-top: 10px;
    animation: fadeIn 0.2s ease-out;
}

.dropdown-menu.show {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-item {
    display: block;
    padding: 10px 20px;
    color: var(--text-main);
    font-size: 1rem;
}

.dropdown-item:hover {
    background: var(--light-blue-bg);
    color: var(--primary-blue);
}

/* Language Switch */
.lang-switch {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.lang-switch .active {
    color: var(--dark-blue);
}

/* Burger Button */
.burger-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 30px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 102;
}

.burger-btn span {
    width: 100%;
    height: 2px;
    background-color: var(--dark-blue);
    border-radius: 2px;
    transition: all 0.3s;
}

/* Mobile Menu */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    bottom: 0; /* Cover full height properly on mobile */
    background: rgba(255, 255, 255, 0.98);
    z-index: 101;
    display: none;
    padding-top: 80px;
    opacity: 0;
    transition: opacity 0.3s;
    overflow-y: auto; /* Allow scrolling if content is too long */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    box-sizing: border-box; /* Include padding in dimensions */
}

.mobile-menu.open {
    display: block;
    opacity: 1;
}

.mobile-menu-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding-bottom: 120px; /* Large padding to ensure bottom content is accessible */
    min-height: 100%; /* Ensure content takes up at least full height */
    box-sizing: border-box;
}

.mobile-link {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--dark-blue);
    padding: 10px;
}

.mobile-link-synergy {
    border: 2px solid var(--primary-blue);
    border-radius: 12px;
    padding: 10px 24px;
    margin: 5px 0;
    color: var(--primary-blue);
    background-color: rgba(11, 99, 199, 0.05);
    display: inline-block;
}

.mobile-submenu {
    display: none;
    flex-direction: column;
    gap: 10px;
    background: var(--light-blue-bg);
    width: 100%;
    text-align: center;
    padding: 10px 0;
    margin-top: 5px;
}

.mobile-submenu.open {
    display: flex;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 10px;
    width: 100%;
}

.hero-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--dark-blue);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.search-container {
    position: relative;
    max-width: 460px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 6px 45px 6px 16px;
    font-size: 1rem;
    border: 1px solid rgba(0,0,0,0.08);
    background: var(--white);
    border-radius: 50px;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    outline: none;
    box-sizing: border-box;
    font-family: var(--font-main);
}

.hero-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 520px;
    margin: 4px auto 0;
    line-height: 1.4;
    padding: 0;
}

.hero-subtitle strong {
    color: var(--dark-blue);
}

.view-full-btn {
    display: block;
    margin: 6px auto 0;
    text-align: center;
    color: var(--primary-blue);
    font-weight: 600;
    font-size: 0.8rem;
    text-decoration: none;
    padding: 3px 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.view-full-btn:hover {
    background-color: var(--light-blue-bg);
}

.search-input:focus {
    box-shadow: 0 0 0 4px rgba(11, 99, 199, 0.15), var(--shadow-hover);
    border-color: var(--primary-blue);
}

.search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, var(--primary-blue), #0a52a5);
    color: white;
    border: none;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(11, 99, 199, 0.3);
}

.search-btn:hover {
    background: linear-gradient(135deg, #0a52a5, #083e7e);
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 14px rgba(11, 99, 199, 0.4);
}

.search-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.stat-card {
    background: var(--white);
    padding: 6px 8px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    text-align: center;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s;
    border: 1px solid rgba(255,255,255,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    /* overflow: hidden; Removed to allow tooltips to show */
}

.stat-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0,0,0,0.05);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.highlight-card {
    background: linear-gradient(135deg, var(--white) 0%, #f0f7ff 100%);
    border: 1px solid rgba(0, 102, 204, 0.15);
}





.tip { position: relative; display: inline-flex; align-items: center; margin-left: 8px; cursor: help; }
.tip-icon { display: inline-block; width: 18px; height: 18px; border-radius: 50%; background: #e8f2ff; color: var(--primary-blue); font-size: 12px; line-height: 18px; text-align: center; font-weight: 700; transition: all 0.2s; }
.tip:hover .tip-icon { background: var(--primary-blue); color: #fff; }

.tip-content { 
    position: absolute; 
    top: calc(100% + 10px); 
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #fff; 
    color: var(--text-main); 
    border: 1px solid rgba(0,0,0,0.1); 
    border-radius: 8px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
    padding: 12px; 
    white-space: normal; 
    width: 280px; 
    font-size: 0.85rem; 
    line-height: 1.4; 
    opacity: 0; 
    visibility: hidden; 
    transition: opacity 0.2s, transform 0.2s; 
    z-index: 10000; 
    text-align: left;
    pointer-events: none;
}

.tip-content::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent #fff transparent;
}

.tip:hover .tip-content, .tip:focus .tip-content { 
    opacity: 1; 
    visibility: visible; 
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.th-with-tip { display: inline-flex; align-items: center; gap: 6px; }

/* Tip Left: Align right edge to icon right edge (grows left) */
.tip.tip-left .tip-content { 
    left: auto; 
    right: 0; 
    transform: translateY(4px); 
}
.tip:hover.tip-left .tip-content { 
    transform: translateY(0); 
}
.tip.tip-left .tip-content::before {
    left: auto;
    right: 9px; /* Center of 18px icon */
    margin-left: 0;
    transform: translateX(50%);
}

/* Mobile Tooltip Fix: Center on screen as modal */
@media (max-width: 768px) {
    .tip-content,
    .tip.tip-left .tip-content {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        width: 85vw;
        max-width: 320px;
        transform: translate(-50%, -50%);
        white-space: normal;
        text-align: left;
        margin: 0;
        box-shadow: 0 10px 25px rgba(0,0,0,0.2);
        border: 1px solid rgba(0,0,0,0.15);
    }

    /* Override hover transforms to keep it centered */
    .tip:hover .tip-content, 
    .tip:focus .tip-content,
    .tip:hover.tip-left .tip-content {
        transform: translate(-50%, -50%);
    }
    
    /* Hide the arrow */
    .tip-content::before,
    .tip.tip-left .tip-content::before {
        display: none;
    }
    
    /* Remove backdrop-filter to allow fixed tooltips to escape the container */
    .data-table thead th {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}


.stat-icon {
    font-size: 1.35rem;
    line-height: 1;
    margin-bottom: 1px;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: 1px;
    font-weight: 600;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--dark-blue);
    margin-bottom: 1px;
}

.stat-sub {
    font-size: 0.65rem;
    color: var(--primary-blue);
    font-weight: 500;
}

.content-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    background: rgba(255,255,255,0.5);
    border-radius: var(--radius-md);
}

/* FAQ Styles */
.faq-container {
    max-width: 100%;
    margin: 20px 0;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 10px;
}

.faq-question {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 15px 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark-blue);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: color 0.2s;
}

.faq-question:hover {
    color: var(--primary-blue);
}

.faq-icon {
    font-size: 1.5rem;
    font-weight: 300;
    color: var(--primary-blue);
    transition: transform 0.3s ease;
}

.faq-question.active .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    padding-right: 20px;
}

.faq-answer p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: var(--text-main);
}

/* Methodology Styling Redesign */
#about-methodology {
    max-width: 900px;
    margin: 0 auto;
}

.methodology-main-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2rem;
    color: var(--dark-blue);
}

/* Conditions Card (Hero Style) */
.methodology-card {
    background: #fff;
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 30px;
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.05);
}

.methodology-card.conditions-card .card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.card-header .header-icon {
    font-size: 1.5rem;
}

.card-header h4 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--dark-blue);
    font-weight: 700;
}

.methodology-card .card-content {
    padding: 30px;
}

.condition-item {
    margin-bottom: 25px;
}

.condition-item:last-child {
    margin-bottom: 0;
}

.condition-title {
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 10px;
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Score Grid */
.score-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin: 15px 0;
}

.score-item {
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-val {
    background: var(--primary-blue);
    color: #fff;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    min-width: 35px;
    text-align: center;
}

/* Methodology Items (Accordion) */
.methodology-item {
    background: var(--white);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--radius-lg);
    margin-bottom: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s, box-shadow 0.2s;
}

.methodology-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
}

.methodology-trigger {
    width: 100%;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s;
}

.methodology-trigger .trigger-text {
    display: flex;
    flex-direction: column;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark-blue);
}

.trigger-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.methodology-item.active .methodology-trigger {
    background-color: rgba(0,0,0,0.01);
}

/* Content Styling */
.methodology-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--white);
}

.methodology-item.active .methodology-content {
    max-height: 3000px;
    padding-bottom: 30px;
    border-top: 1px solid var(--border-color);
}

.concept-intro {
    padding: 30px 30px 0;
    text-align: center;
}

.formula-box {
    background: linear-gradient(to right, #f8f9fa, #fff);
    padding: 20px;
    border-radius: var(--radius-md);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1.2rem;
    text-align: center;
    margin: 20px 0;
    border: 1px solid #e9ecef;
    color: var(--dark-blue);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

/* Process Steps */
.step-process {
    padding: 0 30px;
    margin: 30px 0;
    position: relative;
}

.step-process::before {
    content: '';
    position: absolute;
    left: 49px; /* Adjust based on step-number width */
    top: 20px;
    bottom: 20px;
    width: 2px;
    background: #e9ecef;
    z-index: 0;
}

.process-step {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
}

.step-number {
    width: 40px;
    height: 40px;
    background: var(--primary-blue);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(33, 150, 243, 0.3);
}

.step-detail {
    flex-grow: 1;
    background: #fff;
}

.step-detail h5 {
    margin: 0 0 5px 0;
    font-size: 1.1rem;
    color: var(--dark-blue);
}

.sub-step {
    background: #fcfcfc;
    border-left: 3px solid #e9ecef;
    padding: 10px 15px;
    margin-top: 10px;
    font-size: 0.95rem;
}

.formula-small {
    font-family: monospace;
    background: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #eee;
    display: inline-block;
    margin-top: 5px;
    font-size: 0.9rem;
    color: #d63384; /* Highlight formulas */
}

/* Insight Box */
.insight-box {
    margin: 0 30px;
    background: #e8f5e9; /* Light green background */
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
    border-left: 4px solid #43a047; /* Green border accent */
}

.insight-icon {
    font-size: 1.5rem;
}

.insight-content strong {
    display: block;
    margin-bottom: 5px;
    color: #2e7d32; /* Darker green for title */
}

.insight-content p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #1b5e20; /* Dark green for text */
}

.methodology-list {
    padding: 0 30px;
    margin: 20px 0;
}

.methodology-list li {
    margin-bottom: 15px;
    padding-left: 20px;
    position: relative;
}

.methodology-list li::before {
    content: '•';
    color: var(--primary-blue);
    position: absolute;
    left: 0;
    font-weight: bold;
}

@media (max-width: 691px) {
    .step-process::before {
        display: none;
    }
    
    .process-step {
        flex-direction: column;
        gap: 10px;
    }
    
    .step-number {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
    }

    .methodology-trigger {
        padding: 15px 20px;
    }
    
    .methodology-content {
        padding: 0;
    }
    
    .concept-intro, .step-process, .insight-box, .methodology-list {
        padding-left: 15px;
        padding-right: 15px;
    }

    .score-grid {
        grid-template-columns: 1fr;
    }
}

/* Fix for iOS zoom on input focus */
@media screen and (max-width: 810px) {
    input, select, textarea, .search-input {
        font-size: 16px !important;
    }
}

/* Concept Page Styling */
#about-concept, #about-data, #about-faq {
    background: var(--white);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-soft);
    max-width: 900px;
    margin: 0 auto;
}

#about-concept h3, #about-data h3, #about-faq h3 {
    margin-top: 0;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.about-block h3 {
    font-size: 1.5rem;
    color: var(--dark-blue);
    margin-bottom: 20px;
    margin-top: 0;
}

.about-block h4 {
    font-size: 1.2rem;
    color: var(--dark-blue);
    margin-top: 25px;
    margin-bottom: 15px;
}

.about-list {
    margin-bottom: 20px;
    padding-left: 20px;
}

.about-list li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.support-link {
    color: var(--primary-blue);
    font-weight: 600;
    text-decoration: underline;
}

.about-disclaimer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
    opacity: 0.8;
}

.about-disclaimer h4 {
    color: var(--text-muted);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.disclaimer-list {
    padding-left: 20px;
    margin: 0;
}

.disclaimer-list li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 810px) {
    .desktop-nav {
        display: none;
    }
    
    .burger-btn {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .hero-title {
        font-size: 2rem;
    }

    /* Synergy styles moved to end of file */
}

/* Sections */
.data-section { margin-bottom: 40px; }
.hidden { display: none !important; }

.data-section.hidden { display: none; }
.section-title { font-size: 1.6rem; font-weight: 700; color: var(--dark-blue); margin: 0 0 16px 0; }

.section-description {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
    max-width: 100%;
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(225, 231, 239, 0.8);
    box-shadow: var(--shadow-soft);
    border-left: 4px solid var(--primary-blue);
}

.regions-select-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 15px; }
.chip { 
    background: var(--white); 
    border: 1px solid var(--border-color); 
    border-radius: 999px; 
    padding: 6px 12px; 
    cursor: pointer; 
    transition: all 0.2s ease;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.chip:hover { 
    border-color: var(--primary-blue); 
    color: var(--primary-blue); 
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.chip.active { 
    border-color: var(--primary-blue); 
    color: var(--white); 
    background: var(--primary-blue);
    box-shadow: 0 2px 6px rgba(11, 99, 199, 0.3);
}
button.chip { border: 1px solid #e1e7ef; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
button.chip:hover { background: #fff; }

.table-container { 
    background: var(--white); 
    border: 1px solid rgba(255,255,255,0.5); 
    border-radius: var(--radius-lg); 
    box-shadow: var(--shadow-soft); 
    overflow: visible; /* Ensure sticky headers work with body scroll */
    position: relative;
}
.table-container::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0,0,0,0.05);
    pointer-events: none;
    z-index: 10;
}

.data-table thead th {
    position: -webkit-sticky;
    position: sticky;
    top: 60px; /* Sticks below the site header */
    z-index: 90;
    background: #f8fbff;
    box-shadow: 0 1px 0 #e0e0e0;
    vertical-align: middle;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(248, 251, 255, 0.95);
    transition: z-index 0.1s;
}

.data-table thead th:hover {
    z-index: 105;
}

.data-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid #f1f3f5; font-size: 0.95rem; transition: background-color 0.2s; }
.data-table th { text-align: left; color: var(--text-muted); font-weight: 600; letter-spacing: 0.01em; }
.data-table tr:hover td { background: #f8fbff; }
.data-table tr:last-child td { border-bottom: none; }

.link-btn { 
    border: 1px solid #e1e7ef; 
    background: #fff; 
    color: var(--dark-blue); 
    border-radius: 999px; 
    padding: 6px 12px; 
    font-weight: 600; 
    font-size: 0.95rem; 
    cursor: pointer; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.04); 
    transition: all 0.2s ease;
}
.link-btn:hover { 
    background: #fff; 
    border-color: var(--primary-blue); 
    color: var(--primary-blue); 
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.08);
}

.flag { 
    width: 44px; 
    height: 30px; 
    object-fit: cover; 
    border: 1px solid #d1d5db; /* Darker border for better contrast */
    border-radius: 4px; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Stronger shadow */
    background-color: #f9fafb; /* Placeholder background */
}
.country-cell { display: flex; align-items: center; gap: 10px; }

/* Synergy */
.synergy-section { display: flex; flex-direction: column; padding-top: 20px; }
.synergy-grid { display: grid; grid-template-columns: 7fr 3fr; gap: 12px; align-items: start; }
.synergy-left { display: flex; flex-direction: column; gap: 8px; }

#synergy-map {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8898aa;
    border: 1px solid rgba(0,0,0,0.05); /* Optional: slight border for white map on white bg */
}

.synergy-header-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0px; /* Reduced spacing */
    margin-top: -30px; /* Lift up Synergy Tool title even more */
}

.synergy-header-group .section-title {
    margin: 0;
    white-space: nowrap;
}

.synergy-helper-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.2;
    margin: 0;
    max-width: 342px;
    text-align: left; /* Changed from right to left */
}

@media (max-width: 810px) {
    .synergy-header-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .synergy-helper-text {
        text-align: left;
        max-width: 100%;
    }
}

.synergy-right { display: flex; flex-direction: column; gap: 8px; }
.section-subtitle { font-size: 1rem; font-weight: 700; color: var(--dark-blue); margin: 0; }
.synergy-controls { display: flex; gap: 6px; margin-bottom: 2px; flex-wrap: wrap; align-items: center; }
.combo input { padding: 6px 10px; border: 1px solid var(--border-color); border-radius: 8px; outline: none; font-size: 0.9rem; }
.combo { position: relative; }
.primary-btn { 
    background: linear-gradient(135deg, var(--primary-blue), #0a52a5); 
    color: #fff; 
    border: none; 
    border-radius: 8px; 
    padding: 6px 12px; 
    cursor: pointer; 
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(11, 99, 199, 0.2);
}
.primary-btn:hover { 
    background: linear-gradient(135deg, #0a52a5, #083e7e); 
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(11, 99, 199, 0.3);
}
.primary-btn:active {
    transform: translateY(0);
}

.synergy-result { 
    background: var(--white); 
    border: 1px solid rgba(0,0,0,0.06); 
    border-radius: 12px; 
    box-shadow: var(--shadow-soft); 
    padding: 6px 10px; 
    font-size: 0.9rem;
    transition: all 0.2s;
}
.synergy-result:hover {
    border-color: rgba(11, 99, 199, 0.2);
    box-shadow: var(--shadow-hover);
}

.synergy-controls .synergy-result { display:flex; align-items:center; gap:12px; flex: 1 1 auto; min-width: 320px; }
.synergy-result .gain-line { margin-top: 4px; color: var(--text-main); font-weight: 500; }
.gain-badge { 
    display: inline-block; 
    background: #e8f2ff; 
    border: 1px solid rgba(0, 102, 204, 0.2); 
    color: var(--dark-blue); 
    padding: 2px 8px; 
    border-radius: 999px; 
    font-weight: 700; 
    font-size: 0.9em;
}
.gain-badge.gain-high {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}
.gain-badge.gain-medium {
    background: #fef9c3;
    border-color: #fde047;
    color: #854d0e;
}
.gain-badge.gain-low {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.synergy-right { display: flex; flex-direction: column; gap: 12px; }
#synergy-map { 
    max-height: 65vh; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    position: relative;
}
#synergy-map svg { 
    flex: 1; 
    width: 100%; 
    height: auto; 
    min-height: 0; 
}
.synergy-right .synergy-result { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }

.country-filter-header {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    margin-bottom: 12px;
}

.country-filter-input {
    width: 200px; 
    padding: 10px 14px;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
    box-sizing: border-box;
    font-family: var(--font-main);
    transition: all 0.2s;
    background: var(--white);
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.country-filter-input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(11, 99, 199, 0.1);
}

.clear-filter-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    padding: 4px;
    background: #f1f3f5;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none; /* Controlled by JS */
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 5;
}

.clear-filter-btn:hover {
    background: #e9ecef;
    color: var(--dark-blue);
    transform: translateY(-50%) scale(1.1);
}

/* Suggestions for table filters */
.suggest-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    box-shadow: var(--shadow-hover);
    border-radius: var(--radius-md);
    z-index: 1000; /* Increased z-index to show above sticky headers */
    display: none;
    padding: 6px;
    max-height: 200px;
    overflow-y: auto;
}

.suggest-item {
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
    color: var(--text-main);
}

.suggest-item:hover {
    background: var(--light-blue-bg);
    color: var(--primary-blue);
}

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal.hidden { display: none; }
.modal-content { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-hover); width: min(680px, 90vw); padding: 20px; position: relative; }
.modal-close { position: absolute; right: 12px; top: 8px; border: none; background: transparent; font-size: 24px; cursor: pointer; }
.modal-title { font-size: 1.4rem; font-weight: 700; color: var(--dark-blue); margin: 0 0 10px 0; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-grid .cell { background: #f8fbff; border: 1px solid var(--border-color); border-radius: 8px; padding: 10px; }
.modal-grid .label { font-size: 0.85rem; color: var(--text-muted); }
.modal-grid .value { font-weight: 600; }

/* Home Bottom Grid */
.home-bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; width: 100%; margin-bottom: 30px; }
.home-card { 
    background: var(--white); 
    border: 1px solid rgba(0,0,0,0.08); 
    border-radius: var(--radius-lg); 
    box-shadow: var(--shadow-soft); 
    overflow: hidden; 
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}
.home-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
    border-color: rgba(11, 99, 199, 0.2);
}
.home-card-title { 
    padding: 16px 20px; 
    background: linear-gradient(to right, #f8fbff, #fff); 
    font-weight: 700; 
    font-size: 1.1rem;
    color: var(--dark-blue); 
    border-bottom: 1px solid #e1e7ef; 
}

.home-card .table-container {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
}
.home-card .table-container::after {
    display: none;
}

/* Ensure home card tables don't use sticky headers which might overlap content */
.home-card .data-table thead th {
    position: static;
    top: auto;
    box-shadow: none;
    border-bottom: 2px solid #e1e7ef;
    background: #fff;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
}

/* Dashboard Tables Redesign */
.home-card .data-table {
    width: 100%;
    table-layout: fixed;
}

.home-card .data-table th, 
.home-card .data-table td {
    padding: 12px 16px;
}

.view-full-btn {
    display: block;
    width: fit-content;
    margin: 16px auto;
    padding: 10px 24px;
    background: transparent;
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
    border-radius: 99px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-align: center;
}

.view-full-btn:hover {
    background: var(--primary-blue);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(11, 99, 199, 0.2);
}

/* Insights Banner */
.insights-banner {
    background: #ffffff;
    border: 1px solid rgba(11, 99, 199, 0.15);
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(11, 99, 199, 0.08);
    padding: 12px 16px 64px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
    position: relative;
    max-width: 100%;
    margin: 8px auto 14px;
}

.insights-banner.hidden {
    display: none !important;
}

.insight-content-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
    width: 100%;
    max-width: 100%;
    min-height: 48px;
}

.insight-icon {
    font-size: 1.4rem;
    background: #fff;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(11, 99, 199, 0.15);
    flex-shrink: 0;
    color: var(--primary-blue);
}

.insight-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--dark-blue);
    line-height: 1.4;
    transition: opacity 0.5s ease;
    height: 4.2em;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.insight-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.insight-link:hover .insight-text {
    color: var(--primary-blue);
}

.insight-footer {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.insight-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(11, 99, 199, 0.25);
    background: rgba(11, 99, 199, 0.06);
    color: var(--primary-blue);
    font-weight: 700;
    font-size: 0.8rem;
    line-height: 1;
    text-decoration: none;
}

.insight-more:hover {
    background: rgba(11, 99, 199, 0.12);
    border-color: rgba(11, 99, 199, 0.4);
}

.insight-dots {
    display: flex;
    gap: 8px;
}

.insight-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(11, 99, 199, 0.2);
    cursor: pointer;
    transition: all 0.2s;
}

.insight-dot:hover {
    background: rgba(11, 99, 199, 0.5);
    transform: scale(1.1);
}

.insight-dot.active {
    background: var(--primary-blue);
    transform: scale(1.2);
}

.fade-out {
    opacity: 0;
}

@media (max-width: 600px) {
    .insights-banner {
        padding: 14px 15px 78px;
        min-height: 190px;
        justify-content: flex-start;
    }
    .insight-content-wrapper {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
    }
    .insight-text {
        font-size: 0.95rem;
        height: auto;
        display: block;
        overflow: visible;
        line-clamp: unset;
        -webkit-line-clamp: unset;
        -webkit-box-orient: unset;
    }
    .insight-icon {
        width: 32px;
        height: 32px;
        font-size: 1.2rem;
        margin-top: 2px;
    }
    .insight-footer {
        bottom: 14px;
        gap: 8px;
    }
    .insight-more {
        align-self: center;
    }
}

/* Column Widths & Alignment */
.home-card .data-table th:nth-child(1),
.home-card .data-table td:nth-child(1) {
    width: 45px;
    text-align: center;
    color: var(--text-muted);
    font-weight: 600;
}

.home-card .data-table th:nth-child(2),
.home-card .data-table td:nth-child(2) {
    text-align: left;
    width: auto;
}

.home-card .data-table th:nth-child(3),
.home-card .data-table td:nth-child(3) {
    width: 80px;
    text-align: right;
    font-weight: 700;
    color: var(--dark-blue);
}

.home-card .data-table tbody tr {
    border-bottom: 1px solid #f1f3f5;
    transition: background-color 0.2s;
}

.home-card .data-table tbody tr:last-child {
    border-bottom: none;
}

.home-card .data-table tbody tr:hover {
    background-color: #f8fbff;
}

/* Zebra striping for better readability */
.home-card .data-table tbody tr:nth-child(even) {
    background-color: #fcfcfc;
}

.home-card .data-table .flag {
    width: 28px;
    height: auto;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.home-card .link-btn {
    border: none;
    background: transparent;
    padding: 0;
    box-shadow: none;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.95rem;
}

.home-card .link-btn:hover {
    color: var(--primary-blue);
    background: transparent;
    transform: none;
    box-shadow: none;
    text-decoration: underline;
}

.home-card .view-full-btn {
    margin-top: auto;
    margin-bottom: 20px;
    margin-left: auto;
    margin-right: auto;
    display: block;
    padding: 8px 24px;
    background: var(--light-blue-bg);
    color: var(--primary-blue);
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s;
    text-align: center;
    width: fit-content;
    align-self: center;
}

.home-card .view-full-btn:hover {
    background: var(--primary-blue);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(11, 99, 199, 0.2);
}

/* About Section Typography */
#about-section p, 
#about-section li {
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Footer Styles */
.site-footer {
    background: #fff;
    border-top: 1px solid rgba(0,0,0,0.05);
    padding: 36px 0;
    margin-top: 40px;
    font-size: 0.9rem;
    color: #4b5563;
    min-height: 120px;
    box-sizing: border-box;
}
.footer-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}
.footer-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.footer-right {
    max-width: 400px;
    text-align: right;
}
.footer-contacts {
    font-weight: 500;
}
.footer-contacts a {
    color: var(--primary-blue);
    text-decoration: none;
    transition: all 0.2s;
}
.footer-contacts a:hover {
    text-decoration: underline;
    color: var(--dark-blue);
}
.footer-disclaimer-text {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.5;
    color: #6b7280; /* Slightly lighter than main footer text */
}
.disclaimer-link {
    color: #4b5563;
    text-decoration: underline;
    transition: color 0.2s;
}
.disclaimer-link:hover {
    color: var(--primary-blue);
}

@media (max-width: 600px) {
    .footer-row {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .footer-right {
        text-align: center;
    }
}

/* Synergy Disclaimer */
.synergy-disclaimer {
    margin-top: 12px;
    font-size: 0.75rem;
    color: #9ca3af;
    line-height: 1.3;
    padding: 8px 12px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #f3f4f6;
}

/* Visibility Utilities */
.mobile-only { display: none; }
.desktop-only { display: block; }

@media (max-width: 810px) {
    .mobile-only { display: block; }
    .desktop-only { display: none; }
}



@media (max-width: 620px) {
    .home-bottom-grid { grid-template-columns: 1fr; }
}

#synergy-top-list { max-height: calc(var(--header-h) + var(--row-h) * 14); overflow: auto; }
#synergy-top-list::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
#synergy-top-list::-webkit-scrollbar-track {
    background: var(--light-blue-bg);
    border-radius: 10px;
}
#synergy-top-list::-webkit-scrollbar-thumb {
    background: var(--primary-blue);
    border-radius: 10px;
    border: 2px solid var(--light-blue-bg);
}
#synergy-top-list::-webkit-scrollbar-thumb:hover {
    background: var(--dark-blue);
}

/* Wide Container Mode for Rankings */
.container.wide-mode {
    max-width: 1215px; /* Wider container for rankings page */
}

/* Header Row for Sections */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.section-header-row .section-title {
    margin-bottom: 0;
}
.region-stat-badge {
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 500;
    color: var(--text-muted);
    box-shadow: var(--shadow-soft);
    font-size: 0.95rem;
}
.region-stat-badge .value {
    color: var(--dark-blue);
    font-weight: 700;
    font-size: 1.1rem;
    margin-left: 6px;
}

/* Rankings Layout */
.rankings-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

#rankings-map-container {
    flex: 1;
    min-width: 0;
    /* Map takes remaining space, but we limit it to ensure it doesn't dominate on smaller large screens */
    max-width: 65%; 
    background: #fff;
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    position: sticky;
    top: 90px; /* Sticky map on desktop */
    transition: box-shadow 0.3s;
    height: calc(100vh - 150px);
    overflow: hidden;
}

#rankings-map-container:hover {
    box-shadow: var(--shadow-hover);
    border-color: rgba(11, 99, 199, 0.1);
}

#rankings-map {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
}

#rankings-list {
    flex: 0 0 315px; /* Reduced width */
    width: 315px;
    height: calc(100vh - 150px);
    overflow-y: auto;
    
    /* Best Upgrades scrollbar style */
    background: var(--white);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

/* Allow text wrapping in country cell */
.country-cell {
    white-space: normal;
}
.country-cell .link-btn {
    white-space: normal;
    text-align: left;
    line-height: 1.3;
    height: auto;
    padding: 0;
    flex: 1; /* Allow button to take available space */
    min-width: 0; /* Allow shrinking below content size to force wrap */
    overflow-wrap: break-word;
    word-break: normal; /* Keep words whole */
    background: transparent;
    border: none;
    color: var(--primary-blue);
    box-shadow: none;
    border-radius: 0;
}

.country-cell .link-btn:hover {
    background: transparent;
    border: none;
    text-decoration: underline;
    color: var(--dark-blue);
    box-shadow: none;
}

#rankings-list::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
#rankings-list::-webkit-scrollbar-track {
    background: var(--light-blue-bg);
    border-radius: 10px;
}
#rankings-list::-webkit-scrollbar-thumb {
    background: var(--primary-blue);
    border-radius: 10px;
    border: 2px solid var(--light-blue-bg);
}
#rankings-list::-webkit-scrollbar-thumb:hover {
    background: var(--dark-blue);
}

/* Ensure sticky header works inside the scrollable container */
#rankings-list .data-table {
    border-collapse: separate; 
    border-spacing: 0;
}
#rankings-list .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 10; /* Higher z-index */
    background: #f8fbff;
    border-top: none; /* Fix double border */
    box-shadow: 0 1px 0 #e0e0e0;
}

#rankings-list .data-table thead th:hover {
    z-index: 105;
}

/* PQI Column - Fixed narrow width */
#rankings-list .data-table th:nth-child(3),
#rankings-list .data-table td:nth-child(3) {
    width: 54px;
    padding-left: 4px;
    padding-right: 8px;
    text-align: right;
}

/* Compact header for PQI to fit in narrow column */
#rankings-list .th-with-tip {
    gap: 2px;
    justify-content: flex-end;
}
#rankings-list .th-with-tip .tip {
    margin-left: 2px;
}

/* Fix Filter Input Spacing */
.country-filter-header {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}
.country-filter-input {
    flex: 1;
    min-width: 0; /* Allow shrinking */
    margin: 0; /* Remove potential margins */
    width: 100%;
    padding: 6px 8px;
    font-size: 0.9rem;
}


/* Map Legend */
.map-legend-container {
    margin-bottom: 16px;
    background: #f8fbff;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #eef2f6;
}
.map-legend-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark-blue);
    margin-bottom: 8px;
}
.map-legend-scale {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}
.legend-gradient {
    flex: 1;
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(to right, #dcfce7 20%, #86efac 20% 40%, #4ade80 40% 60%, #22c55e 60% 80%, #15803d 80%);
}

/* VFE Table Header Styles */
.vfe-country-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.vfe-filter-wrapper {
    position: relative;
    flex: 1;
    min-width: 140px;
}
.vfe-filter-wrapper .country-filter-input {
    width: 100%;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 0.85rem;
    font-weight: normal;
    box-sizing: border-box;
}

/* Utility classes for responsive text */
.mobile-only { display: none; }
.desktop-only { display: inline; }

/* Mobile adjustments */
@media (max-width: 1000px) {
    html {
        font-size: 16px; /* Main content 16px for readability on mobile */
    }
    body {
        font-size: 1rem;
    }
    .mobile-only { display: inline; }
    .desktop-only { display: none; }

    .rankings-layout {
        flex-direction: column;
    }
    #rankings-map-container {
        display: none; /* Hide map on mobile/tablet as requested */
    }
    #rankings-list {
        width: 100%;
        flex: auto;
        height: auto !important; /* Force reset fixed height */
        max-height: none !important;
        overflow: visible !important; /* Ensure content flows and pushes footer down */
    }

    /* Restore sticky header offset on mobile to match site header */
    #rankings-list .data-table thead th {
        top: 60px;
    }

    /* Fix word breaking in home page tables */
    .home-card .data-table {
        table-layout: auto;
    }
    .home-card .data-table th, 
    .home-card .data-table td {
        padding: 12px 8px;
        word-break: keep-all;
        word-wrap: normal;
        overflow-wrap: normal;
        white-space: normal; /* Allow wrapping only between words */
    }
    .home-card .data-table th:nth-child(3),
    .home-card .data-table td:nth-child(3) {
        width: 65px; /* Slightly narrower PQI column on mobile */
    }

    /* Fix for VFE table overflow on mobile */
    #vfe-list {
        width: 100%;
        height: auto;
        overflow: visible; /* Use body scroll */
        display: block;
    }
    
    #vfe-list .data-table {
        width: 100%;
        min-width: 0;
        table-layout: auto; /* Allow flexible columns on mobile */
    }

    #vfe-list .data-table th, 
    #vfe-list .data-table td {
        padding: 6px 4px;
        font-size: 14px; /* Minimum 12px, preferred 14px for accessibility on mobile */
        word-break: keep-all;
        word-wrap: normal;
        overflow-wrap: normal;
        white-space: normal;
    }

    /* Column Widths */
    #vfe-list .data-table th:nth-child(1),
    #vfe-list .data-table td:nth-child(1) {
        width: 30px; /* Rank */
        text-align: center;
        padding-left: 0;
        padding-right: 0;
    }
    
    #vfe-list .data-table th:nth-child(2),
    #vfe-list .data-table td:nth-child(2) {
        width: auto; /* Country */
    }
    
    #vfe-list .data-table th:nth-child(3),
    #vfe-list .data-table td:nth-child(3) {
        width: 45px; /* VFE */
        text-align: center;
        padding-left: 0;
        padding-right: 0;
    }
    
    #vfe-list .data-table th:nth-child(4),
    #vfe-list .data-table td:nth-child(4) {
        width: 60px; /* Count */
        text-align: center;
        font-size: 0.75rem;
        line-height: 1.1;
        padding-left: 0;
        padding-right: 0;
    }
    
    /* Header for Country Column - Row Layout on Mobile */
    .vfe-country-header {
        flex-direction: row;
        align-items: center;
        gap: 6px;
    }
    .vfe-filter-wrapper {
        width: auto;
        flex: 1;
        min-width: 60px; /* Allow shrinking */
    }
    
    /* Fix VFE Tooltip spacing */
    .th-with-tip {
        gap: 2px !important;
        justify-content: center;
    }
    
    /* Sticky Header - Relative to Page */
    #vfe-list .data-table thead th {
        position: sticky;
        top: 60px;
        z-index: 5;
        background: #fff;
        vertical-align: bottom;
        box-shadow: 0 1px 0 #e0e0e0;
    }

    #vfe-list .data-table thead th:focus-within {
        z-index: 50;
    }
    
    /* Ensure input font size 16px to prevent zoom */
    .country-filter-input {
        font-size: 16px !important;
    }
}
#synergy-top-list .data-table { border-collapse: separate; border-spacing: 0; }
#synergy-top-list .data-table thead th { position: sticky; top: 0; z-index: 2; background: #f8fbff; }

/* Mobile Redesign for Synergy Tool */
@media (max-width: 810px) {
    .synergy-grid {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 20px;
    }

    /* Use display: contents to flatten the structure and reorder items */
    .synergy-left, .synergy-right {
        display: contents;
    }

    /* 1. Header */
    .synergy-header-group {
        order: 1;
        width: 100%;
        margin-bottom: 10px;
    }

    /* 2. Controls (Inputs + Result) */
    .synergy-controls {
        order: 2;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    .synergy-controls .combo, 
    .synergy-controls .primary-btn, 
    .synergy-controls .synergy-result {
        width: 100%;
    }
    .synergy-controls .synergy-result {
        min-width: 0; /* Allow shrinking */
    }

    /* Hide mobile disclaimer here, we'll show the desktop one at bottom */
    .synergy-disclaimer.mobile-only {
        display: none !important;
    }

    /* 3. Table Title (from Right column) */
    .synergy-right > .section-subtitle:nth-child(1) {
        order: 3;
        margin-top: 10px;
    }

    /* 4. Best Upgrades Table (from Right column) */
    #synergy-top-list {
        order: 4;
        width: 100%;
        max-height: 300px; /* Limit height on mobile */
    }

    /* 5. Map Title (from Left column) */
    .synergy-left > .section-subtitle:nth-child(3) {
        order: 5;
        margin-top: 20px;
    }

    /* 6. Map (from Left column) */
    #synergy-map {
        order: 6;
        width: 100%;
        height: 300px;
    }

    /* 7. Disclaimer (from Right column - reuse desktop one) */
    .synergy-disclaimer.desktop-only {
        order: 7;
        display: block !important; /* Force show */
        margin-top: 15px;
    }
}
#synergy-top-list { overflow-x: auto; }

#synergy-top-list .data-table th, 
#synergy-top-list .data-table td {
    padding: 3px 8px;
    font-size: 0.85rem;
    line-height: 1.2;
}
#synergy-top-list .link-btn {
    font-size: 0.85rem;
    padding: 2px 6px;
}

/* Mobile Fixes for Synergy Tool (Moved to end to override desktop styles) */
@media (max-width: 810px) {
    .synergy-grid {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start;
        width: 100%;
        gap: 20px;
    }
    
    .synergy-left, .synergy-right {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    /* Hide map on mobile */
    #synergy-map { display: none !important; }
    .synergy-left > .section-subtitle { display: none; }

    /* Controls Styling */
    .synergy-controls {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    .synergy-controls .combo {
        width: 100%;
        flex: 0 0 auto;
    }
    .synergy-controls .primary-btn {
        width: 100%;
        flex: 0 0 auto;
    }
    .synergy-controls .synergy-result {
        flex: 1 1 100%;
        min-width: 0;
        padding: 6px;
        margin-top: 6px;
        font-size: 0.85em;
    }

    /* Table Visibility and Overflow */
    #synergy-top-list {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-top: 10px;
        max-height: calc(var(--header-h) + var(--row-h) * 12);
    }
    
    #synergy-top-list .data-table {
        min-width: 100%;
        width: auto;
    }
    
    #synergy-top-list .data-table th, 
    #synergy-top-list .data-table td { 
        font-size: 0.9rem; 
        padding: 8px 10px; 
    }
    
    #synergy-top-list .link-btn { 
        font-size: 0.85rem; 
        padding: 4px 8px; 
        white-space: normal; 
        flex-shrink: 1; 
        min-width: 0; 
    }
    
    /* Hide Rank column on mobile */
    #synergy-top-list .data-table thead th:nth-child(1), 
    #synergy-top-list .data-table tbody td:nth-child(1) { 
        display: none; 
    }
    
    #synergy-top-list .country-cell { 
        min-width: 0; 
        display: flex; 
        align-items: center; 
        gap: 10px; 
        width: 100%; 
    }

    /* Reorder Layout: Inputs -> Table -> Disclaimer */
    /* Hide the mobile disclaimer in the left column */
    .synergy-left .synergy-disclaimer.mobile-only {
        display: none !important;
    }
    
    /* Show the desktop disclaimer in the right column (which is now at bottom) */
    .synergy-right .synergy-disclaimer.desktop-only {
        display: block !important;
        margin-top: 15px;
    }
    
    .synergy-right .section-subtitle {
        margin-top: 0;
        margin-bottom: 10px;
        display: block;
    }
}

/* Isolated Regional PQI Mobile Fix */
@media (max-width: 810px) {
    #regional-power-list .table-container {
        overflow-x: visible;
        width: 100%;
        display: block;
    }
    #regional-power-list .data-table {
        width: 100%;
        table-layout: auto;
    }
    #regional-power-list .data-table th,
    #regional-power-list .data-table td {
        white-space: normal;
        padding: 8px 6px;
        word-break: break-word;
    }
    #regional-power-list .data-table th:nth-child(1),
    #regional-power-list .data-table td:nth-child(1) {
        width: 45px;
        text-align: center;
        padding-left: 2px;
        padding-right: 2px;
        word-break: normal;
    }
    #regional-power-list .data-table th:nth-child(3),
    #regional-power-list .data-table td:nth-child(3) {
        width: 75px;
        text-align: right;
    }
    #regional-power-list .country-filter-header {
        width: 100%;
    }
    #regional-power-list .country-filter-header span {
        white-space: nowrap;
        word-break: normal;
    }
    #regional-power-list .th-with-tip {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    /* Scoped Mobile Tooltip for Regional PQI */
    #regional-power-list .tip-content {
        position: fixed;
        top: 50%;
        left: 50%;
        width: 85vw;
        max-width: 320px;
        transform: translate(-50%, -50%);
        white-space: normal;
        text-align: left;
        margin: 0;
        box-shadow: 0 10px 25px rgba(0,0,0,0.2);
        border: 1px solid rgba(0,0,0,0.15);
        z-index: 9999;
    }
    #regional-power-list .tip:hover .tip-content,
    #regional-power-list .tip:focus .tip-content {
        transform: translate(-50%, -50%);
    }
    #regional-power-list .tip-content::before {
        display: none;
    }
}

.csv-export-btn {
    background-color: #f3f4f6;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    margin-bottom: 8px;
    margin-left: auto;
}
.csv-export-btn:hover {
    background-color: #e5e7eb;
    border-color: #d1d5db;
    color: var(--dark-blue);
}

.share-btn {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    text-decoration: none;
    line-height: 1.2;
}
.share-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
}
.share-btn svg {
    width: 14px;
    height: 14px;
}

/* Home Filter & Toggle Switch */
.home-filter-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
    padding-right: 12px;
    border-right: 1px solid var(--border-color);
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary-blue);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-blue);
}

input:checked + .slider:before {
    -webkit-transform: translateX(18px);
    -ms-transform: translateX(18px);
    transform: translateX(18px);
}

/* Ensure country names in table wrap correctly on mobile */
.country-cell .link-btn {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
    text-align: left;
    display: inline-block; /* Allow wrapping behavior */
}

/* Mobile adjustments for filters */
@media (max-width: 600px) {
    .country-filter-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .country-filter-input {
        width: 140px; /* Reduce width to fit */
        font-size: 16px; /* Prevent iOS zoom */
    }

    .home-filter-wrapper {
        margin-right: 4px;
        padding-right: 8px;
    }
}

/* Fix suggest box overflow on mobile */
.suggest-box {
    width: 100%;
    min-width: 200px;
    max-width: 80vw;
}

/* Increase home icon size on desktop */
@media (min-width: 601px) {
    .home-filter-wrapper > span,
    .home-icon {
        font-size: 24px; /* Increased size for desktop */
        line-height: 1;
    }
    
    .home-icon {
        margin-left: 5px; /* Add some spacing from the country name */
    }
}
