:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --bg-light: #f8f9fa;
    --text-color: #333;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    margin: 0;
    padding: 0 15%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* align-items: center; */
    justify-content: center;
}

/* Navbar */
.navbar {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 1rem 10%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 15%;
    right: 15%;
    z-index: 1000;
}

/* Add padding to body to account for fixed navbar */
body {
    padding-top: 70px;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links a {
    margin-left: 20px;
    text-decoration: none;
    color: #555;
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--accent-color);
}

.nav-links a.active {
    color: var(--accent-color);
    font-weight: bold;
}

/* Hero */
.hero {
    /* background: var(--primary-color); */
    /* background-color: #2c3e50; */
    background: #f4f7f6;
    color: black;
    padding: 1rem 1rem;
    text-align: center;
}

.hero h1 {
    margin: 0 0 1rem 0;
    font-size: 2.5rem;
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto 2rem auto;
}

.hero p a {
    color: black;
    text-decoration: underline;
    font-style: italic;
}

.btn {
    display: inline-block;
    background: #28a745;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    font-size: large;
    transition: background 0.3s;
    text-align: center;
}

/* .btn:hover { background: #2980b9; } */

/* Hero Button Override */
.hero .btn {
    display: block;
    width: auto;
    /* margin: 0 auto; Căn trái. Dùng 'margin: 0 auto' nếu muốn căn giữa lại, hoặc 'margin-left: auto' để căn phải */
}

/* Sections */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0rem 2rem 3rem;
    flex: 1;
    width: 100%;
    box-sizing: border-box;

}

.container a {
    text-decoration: none;
    color: var(--accent-color);
}

.section-title {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 2rem;
    color: var(--primary-color);
}

/* Results Grid */
.stats-grid {
    display: flex;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    text-align: center;
    justify-items: center;
    justify-content: space-evenly;
    flex-wrap: wrap;
}

.stat-card {
    background: white;
    padding: 1.2rem;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border-top: 4px solid var(--accent-color);
    min-width: 200px;
    margin-bottom: 1rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Map */
.map-section {
    background: var(--bg-light);
}

iframe {
    width: 100%;
    height: 600px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Methodology */
.method-grid {
    /* display: grid; */
    /* grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); */
    gap: 2rem;
    margin-top: 2rem;
}

.method-item {
    background: #fff;
    border-radius: 10px;
    padding: 2rem;
    margin: 6% 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    /* transition: transform 0.3s ease, box-shadow 0.3s ease; */
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

/* .method-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0,0,0,0.1);
    border-color: var(--accent-color);
} */

.method-item h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-top: 0;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--accent-color);
    position: relative;
}

.method-item p {
    color: #555;
    line-height: 1.7;
    font-size: 1rem;
    margin-bottom: 0;
}

.method-item a {
    color: var(--accent-color);
    text-decoration: none;
}

/* Authors */
.authors-list {
    display: flex;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    flex-wrap: wrap;
    justify-content: center;
}

.author-item {
    display: inline-block;
    margin: 0.5rem 1rem;
    font-weight: bold;
}

.author-affil {
    display: block;
    font-size: 0.85rem;
    color: #777;
    font-weight: normal;
}

/* Export Options */
.export-option {
    flex: 1;
    min-width: 280px;
    border: 1px solid rgba(0, 0, 0, 0.142);
    padding: 1rem;
}


.export-option h4 {
    margin-top: 0;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: #666;
}

/* Footer */
footer {
    /* background: var(--primary-color); */
    background: #f4f7f6;
    color: black;
    text-align: center;
    padding: 2rem;
    margin-top: auto;
}

/* Results Details */
.results-detail {
    max-width: 900px;
    margin: 0 auto;
}

.detail-item {
    background: transparent;
    border-radius: 0;
    padding: 0;
    margin-bottom: 2.5rem;
    box-shadow: none;
    border-left: none;
}

.detail-item h3 {
    color: #333;
    margin-top: 0;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #000;
}

.detail-item p {
    color: #333;
    margin-bottom: 0;
    line-height: 1.6;
}

/* Info Grid (Updates & Related) */
.two-column-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    margin-top: 2rem;
    border-top: 1px solid #eee;
    padding-top: 2rem;
}

@media (max-width: 768px) {
    .two-column-grid {
        grid-template-columns: 1fr;
    }
}

.info-column h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-color);
    font-weight: normal;
}

.info-list {
    list-style-type: disc;
    padding-left: 1.5rem;
    color: #333;
}

.info-list li {
    margin-bottom: 0.8rem;
    line-height: 1.5;
}

.info-list a {
    color: var(--accent-color);
    text-decoration: none;
}

.info-list a:hover {
    text-decoration: underline;
}

.badge {
    background-color: #28a745;
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-right: 0.3rem;
}

/* Methodology Page Styles */
.method-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.method-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.method-btn {
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.method-btn:hover {
    background-color: var(--accent-color);
    color: white;
    text-decoration: none;
}

.method-section {
    margin-bottom: 3rem;
}

.method-section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.method-section p {
    margin-bottom: 1rem;
    color: #444;
    line-height: 1.7;
}

.method-item {
    margin-bottom: 2.5rem;
}


/* Navbar Container */
.navbar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-color);
}

/* Sidebar Styles */
.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100%;
    background: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 2000;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.mobile-sidebar.active {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
}

.sidebar-title {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--primary-color);
}

.close-sidebar-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.sidebar-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.sidebar-content a {
    padding: 0.8rem 0;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    border-bottom: 1px solid #f5f5f5;
}

.sidebar-content a:hover,
.sidebar-content a.active {
    color: var(--accent-color);
}

.sidebar-divider {
    height: 1px;
    background: #eee;
    margin: 1rem 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .navbar {
        padding: 0.5rem 1rem;
    }

    .mobile-menu-btn {
        display: block;
    }

    .desktop-only {
        display: none;
    }

    /* .navbar-brand { margin: 0 auto; } */

    .container {
        padding: 0 1rem 2rem;
    }

    .hero h1 {
        font-size: 1.8rem;
    }

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

    .export-section {
        padding: 1rem;
        border: 1px solid rgba(0, 0, 0, 0.142);
        background: #f8f9fa00;
        border-radius: 8px;
        border: 1px solid #e9ecef00;
        justify-content: center;
    }

    .export-section>div {
        flex-direction: column;
        gap: 1rem;
    }

    .export-option {
        width: 100%;
    }

    /* Fix Date Range overflow on mobile */
    .export-option>div {
        flex-direction: column;
        align-items: stretch !important;
    }

    .export-option select,
    .export-option button {
        width: 100%;
        margin-top: 0.5rem;
    }

    .export-option span {
        text-align: center;
        display: block;
        margin: 0.2rem 0;
    }
}

iframe {
    max-width: 100%;
    width: 100%;
}

/* IPv4 / IPv6 Switch Buttons */
.ip-switch-btn {
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 0.45rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    letter-spacing: 0.03em;
}

.ip-switch-btn:hover {
    background: rgba(52, 152, 219, 0.12);
    color: var(--accent-color);
}

.ip-switch-btn.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.35);
}

/* Index page normalization */
main {
    width: 100%;
}

.hero-home {
    padding: 2.5rem 1.5rem;
}

.hero-kicker,
.section-label {
    color: #667085;
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    margin-bottom: 0.6rem;
    text-transform: uppercase;
}

.hero .btn {
    display: inline-block;
    width: auto;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.btn {
    border: 0;
    cursor: pointer;
}

.btn:hover {
    background: #218838;
}

.btn-secondary {
    background: var(--primary-color);
}

.btn-secondary:hover {
    background: #1f2d3a;
}

.lead {
    font-size: 1.05rem;
    margin-top: 2rem;
}

.section-heading {
    margin: 0 auto 1.5rem;
    max-width: 780px;
    text-align: center;
}

.section-heading p {
    margin: 0;
}

.section-heading.compact {
    margin-bottom: 1.25rem;
}

.map-block {
    padding-top: 1rem;
}

.ip-switch {
    display: flex;
    background: #e8f0fe;
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10);
    gap: 4px;
    justify-content: center;
    margin-bottom: 1.5rem;
    margin-left: auto;
    margin-right: auto;
    padding: 4px;
    width: fit-content;
}

.chart-wrap {
    height: 400px;
    position: relative;
    width: 100%;
}

.export-section {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
}

.export-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

.export-controls {
    display: flex;
    gap: 0.5rem;
}

.export-controls select {
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    flex-grow: 1;
    padding: 0.5rem;
}

.export-controls span {
    align-self: center;
    color: #666;
}

.export-option h3 {
    color: #666;
    font-size: 0.95rem;
    margin: 0 0 0.5rem;
}

.info-column h2,
.content-section h2 {
    color: var(--text-color);
    font-size: 1.8rem;
    font-weight: normal;
    margin-bottom: 1rem;
}

.content-section {
    border-top: 1px solid #eee;
    margin-top: 3rem;
    padding-top: 2rem;
}

.content-section p {
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .navbar {
        left: 0;
        right: 0;
    }

    .hero-actions,
    .export-grid,
    .export-controls,
    .range-controls {
        flex-direction: column;
        gap: 1rem;
    }

    .hero-actions .btn,
    .export-controls .btn {
        box-sizing: border-box;
        width: 100%;
    }

    .export-option {
        box-sizing: border-box;
        min-width: 0;
        width: 100%;
    }

    .export-option select,
    .export-option button {
        width: 100%;
    }
}
