﻿/** * Copyright (c) 2026 DNA Genics, S.L. All rights reserved.
 * 
 * Historical Populations Origins Report - Premium Cinematic Redesign
 * Earth tones, parchment textures, and narrative chapter-based design
 */

/* Import shared region card and drawer styles */
@import url('../Shared/AncestryRegionCards.css');

/* Import shared timeline styles */
@import url('../Shared/AncestryTimeline.css');

/* ========================================
   CSS Custom Properties - Earth Tone Palette
   ======================================== */
:root {
    /* Primary Colors - Earth Tones */
    --sao-ochre: #C4813D;
    --sao-sienna: #A0522D;
    --sao-umber: #635147;
    --sao-terracotta: #CB6843;
    --sao-gold: #C9A227;
    --sao-gold-light: #E8D5A3;
    
    /* Neutral Colors */
    --sao-parchment: #F5F0E6;
    --sao-parchment-dark: #E8E0D0;
    --sao-ivory: #FFFFF0;
    --sao-charcoal: #2C2C2C;
    --sao-charcoal-soft: #3D3D3D;
    --sao-text: #3A3A3A;
    --sao-text-muted: #6B6B6B;
    --sao-white: #FFFFFF;
    --sao-border: rgba(99, 81, 71, 0.15);
    
    /* Era Colors */
    --sao-era-ancient: #8B4513;
    --sao-era-medieval: #4A6741;
    --sao-era-exploration: #1E5E7A;
    --sao-era-colonial: #6D4C41;
    --sao-era-modern: #5C5C8A;
    
    /* Typography */
    --sao-font-serif: 'Cormorant Garamond', 'Georgia', 'Times New Roman', serif;
    --sao-font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Shadows */
    --sao-shadow-sm: 0 2px 8px rgba(44, 44, 44, 0.06);
    --sao-shadow-md: 0 8px 24px rgba(44, 44, 44, 0.10);
    --sao-shadow-lg: 0 16px 48px rgba(44, 44, 44, 0.14);
    --sao-shadow-xl: 0 24px 64px rgba(44, 44, 44, 0.18);
    --sao-shadow-gold: 0 8px 32px rgba(201, 162, 39, 0.25);
    --sao-shadow-warm: 0 12px 40px rgba(196, 129, 61, 0.20);
    
    /* Borders */
    --sao-radius-sm: 8px;
    --sao-radius-md: 16px;
    --sao-radius-lg: 24px;
    --sao-radius-xl: 32px;
    
    /* Transitions */
    --sao-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --sao-transition-slow: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    --sao-transition-bounce: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========================================
   Base & Typography
   ======================================== */
.sao-main {
    font-family: var(--sao-font-sans);
    color: var(--sao-text);
    background: var(--sao-parchment);
    overflow-x: hidden;
    /* Prevent nested scroll containers (keep scrolling on the window/body). */
    overflow-y: visible;
    height: auto;
    max-height: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Explicit override in case global styles target `#main-content` directly. */
#main-content.sao-main {
/*    overflow-y: visible !important;*/
/*    height: auto !important;
    max-height: none !important;*/
}

.sao-main h1,
.sao-main h2,
.sao-main h3,
.sao-main h4 {
    font-family: var(--sao-font-serif);
    font-weight: 600;
    color: var(--sao-charcoal);
    line-height: 1.2;
}

.sao-main p {
    line-height: 1.7;
}

/* ========================================
   Accessibility
   ======================================== */
.sao-skip-link {
    position: absolute;
    left: -999px;
    top: 10px;
    z-index: 2000;
    background: var(--sao-white);
    color: var(--sao-charcoal);
    padding: 12px 16px;
    border-radius: var(--sao-radius-sm);
    box-shadow: var(--sao-shadow-lg);
    text-decoration: none;
    font-weight: 600;
}

.sao-skip-link:focus {
    left: 10px;
    outline: 3px solid var(--sao-gold);
}

/* ========================================
   Scroll Progress Bar
   ======================================== */
.sao-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--sao-sienna) 0%, var(--sao-gold) 100%);
    width: 0%;
    z-index: 9999;
    transition: width 0.1s ease-out;
}

/* ========================================
   Page Navigation Dots
   ======================================== */
.sao-page-nav {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transition: var(--sao-transition);
}

.sao-page-nav.visible {
    opacity: 1;
    visibility: visible;
}

.sao-nav-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(99, 81, 71, 0.3);
    border: 2px solid rgba(99, 81, 71, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    transition: var(--sao-transition);
    cursor: pointer;
    text-decoration: none;
}

.sao-nav-dot:hover,
.sao-nav-dot:focus {
    transform: scale(1.2);
    background: rgba(196, 129, 61, 0.6);
    outline: none;
}

.sao-nav-dot.active {
    background: linear-gradient(135deg, var(--sao-sienna) 0%, var(--sao-gold) 100%);
    transform: scale(1.2);
    border-color: var(--sao-gold);
}

.sao-nav-dot::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    background: rgba(44, 44, 44, 0.95);
    color: var(--sao-white);
    padding: 8px 14px;
    border-radius: var(--sao-radius-sm);
    font-size: 0.8rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.sao-nav-dot:hover::after,
.sao-nav-dot:focus::after {
    opacity: 1;
}

@media (max-width: 991px) {
    .sao-page-nav {
        display: none;
    }
}

/* ========================================
   Back to Top Button
   ======================================== */
.sao-back-to-top {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--sao-sienna) 0%, var(--sao-gold) 100%);
    color: var(--sao-white);
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--sao-transition);
    z-index: 1100;
    box-shadow: var(--sao-shadow-lg);
}

.sao-back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.sao-back-to-top:hover {
    transform: translateY(-4px);
    box-shadow: var(--sao-shadow-gold);
}

/* ========================================
   Mobile Bottom Navigation
   ======================================== */
.sao-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1250;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid rgba(160, 82, 45, 0.2);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
}

.sao-bottom-nav-item {
    text-decoration: none;
    color: var(--sao-text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 0.65rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: var(--sao-transition);
    opacity: 0.7;
}

.sao-bottom-nav-item i {
    font-size: 1.1rem;
    color: var(--sao-text-muted);
    transition: var(--sao-transition);
}

.sao-bottom-nav-item:hover {
    color: var(--sao-sienna);
    text-decoration: none;
    opacity: 1;
}

.sao-bottom-nav-item:hover i {
    color: var(--sao-sienna);
    transform: scale(1.1);
}

.sao-bottom-nav-item.active {
    color: var(--sao-sienna);
    text-decoration: none;
    opacity: 1;
    font-weight: 600;
}

.sao-bottom-nav-item.active i {
    color: var(--sao-gold);
    transform: scale(1.15);
}

/* Adjust main content padding for bottom nav on mobile */
@media (max-width: 767.98px) {
    .sao-main {
        padding-bottom: 80px;
    }
    
    .sao-back-to-top {
        bottom: 90px;
    }
}

/* ========================================
   HERO SECTION - Cinematic Full Viewport
   ======================================== */
.sao-hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 20px 60px;
    overflow: hidden;
    margin-bottom: 0;
}

.sao-hero-bg {
    position: absolute;
    inset: 0;
    background: 
        linear-gradient(135deg, rgba(44, 44, 44, 0.85) 0%, rgba(99, 81, 71, 0.75) 50%, rgba(44, 44, 44, 0.9) 100%),
        url('/img/reports/ancestry/shared-ancient-origins/sharedancientorigins-header.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.sao-hero-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 0%, rgba(44, 44, 44, 0.4) 100%);
}

/* Animated migration paths effect */
.sao-hero-paths {
    position: absolute;
    inset: 0;
    opacity: 0.15;
    background-image: 
        repeating-linear-gradient(45deg, transparent, transparent 100px, rgba(201, 162, 39, 0.1) 100px, rgba(201, 162, 39, 0.1) 102px),
        repeating-linear-gradient(-45deg, transparent, transparent 100px, rgba(201, 162, 39, 0.08) 100px, rgba(201, 162, 39, 0.08) 102px);
    animation: saoPathFlow 30s linear infinite;
}

@keyframes saoPathFlow {
    0% { transform: translateX(0) translateY(0); }
    100% { transform: translateX(100px) translateY(-100px); }
}

/* Floating particles effect */
.sao-hero-particles {
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(2px 2px at 10% 20%, rgba(201, 162, 39, 0.5) 50%, transparent 50%),
        radial-gradient(2px 2px at 30% 60%, rgba(255, 255, 255, 0.3) 50%, transparent 50%),
        radial-gradient(3px 3px at 50% 40%, rgba(201, 162, 39, 0.4) 50%, transparent 50%),
        radial-gradient(2px 2px at 70% 75%, rgba(255, 255, 255, 0.25) 50%, transparent 50%),
        radial-gradient(2px 2px at 85% 30%, rgba(201, 162, 39, 0.35) 50%, transparent 50%);
    background-size: 250px 250px;
    animation: saoParticleDrift 25s linear infinite;
}

@keyframes saoParticleDrift {
    0% { transform: translateY(0); opacity: 0.6; }
    50% { opacity: 1; }
    100% { transform: translateY(-250px); opacity: 0.6; }
}

.sao-hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 900px;
    color: var(--sao-white);
}

.sao-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(201, 162, 39, 0.2);
    border: 1px solid rgba(201, 162, 39, 0.5);
    color: var(--sao-gold-light);
    padding: 10px 24px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 24px;
    backdrop-filter: blur(10px);
}

.sao-hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.15;
    font-family: var(--sao-font-serif);
}

.sao-title-line {
    display: block;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 400;
    font-size: 0.65em;
    margin-bottom: 0.25em;
}

.sao-title-accent {
    display: block;
    background: linear-gradient(135deg, var(--sao-gold-light) 0%, var(--sao-gold) 50%, var(--sao-ochre) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sao-hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.2rem);
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 32px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    font-family: var(--sao-font-serif);
    font-style: italic;
}

/* Hero Stats */
.sao-hero-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.sao-stat-item {
    text-align: center;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    padding: 16px 24px;
    border-radius: var(--sao-radius-md);
    border: 1px solid rgba(201, 162, 39, 0.3);
    min-width: 120px;
    transition: var(--sao-transition);
}

.sao-stat-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
}

.sao-stat-value {
    display: block;
    font-family: var(--sao-font-serif);
    font-size: 2rem;
    font-weight: 700;
    color: var(--sao-gold-light);
    line-height: 1;
}

.sao-stat-label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.75);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    max-width: 100px;
    word-wrap: break-word;
}

.sao-stat-divider {
    width: 1px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    align-self: center;
}

/* Trust Badges */
.sao-trust-badges {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 24px;
}

.sao-trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: 500;
}

.sao-trust-item i {
    color: var(--sao-gold-light);
    font-size: 1rem;
}

/* ========================================
   SECTION BACKGROUNDS
   ======================================== */
.sao-section {
    padding: 80px 0;
    position: relative;
    overflow-x: hidden; /* Prevent horizontal overflow */
    width: 100%;
    max-width: 100%;
}

.sao-section-light {
    background: var(--sao-parchment);
}

.sao-section-dark {
    background: linear-gradient(135deg, var(--sao-charcoal) 0%, var(--sao-charcoal-soft) 100%);
    color: var(--sao-white);
}

.sao-section-dark h2,
.sao-section-dark h3,
.sao-section-dark h4 {
    color: var(--sao-white);
}

.sao-section-dark p {
    color: rgba(255, 255, 255, 0.85);
}

.sao-section-parchment {
    background: linear-gradient(180deg, var(--sao-parchment-dark) 0%, var(--sao-parchment) 100%);
}

.sao-section-ivory {
    background: var(--sao-ivory);
}

/* ========================================
   CHAPTER HEADERS
   ======================================== */
.sao-chapter-header {
    text-align: center;
    margin-bottom: 48px;
}

.sao-chapter-number {
    display: inline-block;
    font-family: var(--sao-font-serif);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sao-ochre);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 12px;
    position: relative;
}

.sao-chapter-number::before,
.sao-chapter-number::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--sao-ochre));
}

.sao-chapter-number::before {
    right: calc(100% + 16px);
    background: linear-gradient(90deg, transparent, var(--sao-ochre));
}

.sao-chapter-number::after {
    left: calc(100% + 16px);
    background: linear-gradient(90deg, var(--sao-ochre), transparent);
}

.sao-section-dark .sao-chapter-number {
    color: var(--sao-gold-light);
}

.sao-section-dark .sao-chapter-number::before,
.sao-section-dark .sao-chapter-number::after {
    background: linear-gradient(90deg, transparent, var(--sao-gold-light));
}

.sao-section-dark .sao-chapter-number::after {
    background: linear-gradient(90deg, var(--sao-gold-light), transparent);
}

.sao-section-title {
    font-family: var(--sao-font-serif);
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 700;
    color: var(--sao-charcoal);
    margin-bottom: 12px;
    line-height: 1.2;
}

.sao-section-dark .sao-section-title {
    color: var(--sao-white);
}

.sao-section-subtitle {
    font-size: 1.1rem;
    color: var(--sao-text-muted);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.sao-section-dark .sao-section-subtitle {
    color: rgba(255, 255, 255, 0.75);
}

/* ========================================
   REVEAL ANIMATIONS
   ======================================== */
.sao-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.sao-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Fade-in animation classes */
.sao-animate-fade-in {
    opacity: 0;
    animation: saoFadeIn 0.8s ease-out forwards;
}

.sao-animate-fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: saoFadeInUp 0.8s ease-out forwards;
}

.sao-delay-1 { animation-delay: 0.2s; }
.sao-delay-2 { animation-delay: 0.4s; }
.sao-delay-3 { animation-delay: 0.6s; }
.sao-delay-4 { animation-delay: 0.8s; }

@keyframes saoFadeIn {
    to { opacity: 1; }
}

@keyframes saoFadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   SUMMARY CARDS - At-a-Glance
   ======================================== */
.sao-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.sao-summary-card {
    background: var(--sao-white);
    border-radius: var(--sao-radius-md);
    padding: 28px;
    box-shadow: var(--sao-shadow-md);
    border: 1px solid var(--sao-border);
    position: relative;
    overflow: hidden;
    transition: var(--sao-transition);
}

.sao-summary-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--sao-sienna), var(--sao-gold));
}

.sao-summary-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--sao-shadow-lg);
}

.sao-summary-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--sao-ochre) 0%, var(--sao-sienna) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.sao-summary-icon i {
    font-size: 1.5rem;
    color: var(--sao-white);
}

.sao-summary-label {
    font-size: 0.85rem;
    color: var(--sao-text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.sao-summary-value {
    font-family: var(--sao-font-serif);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sao-charcoal);
    line-height: 1.2;
}

.sao-summary-detail {
    font-size: 0.9rem;
    color: var(--sao-text-muted);
    margin-top: 8px;
}

/* ========================================
   INFO CARDS GRID - Understanding Section
   ======================================== */
.sao-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
}

.sao-info-card {
    background: var(--sao-white);
    border-radius: var(--sao-radius-md);
    padding: 32px;
    box-shadow: var(--sao-shadow-sm);
    border: 1px solid var(--sao-border);
    transition: var(--sao-transition);
    display: flex;
    gap: 20px;
}

.sao-info-card:hover {
    box-shadow: var(--sao-shadow-md);
    transform: translateY(-2px);
}

.sao-info-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, rgba(196, 129, 61, 0.15) 0%, rgba(160, 82, 45, 0.1) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sao-info-icon i {
    font-size: 1.2rem;
    color: var(--sao-sienna);
}

.sao-info-content h4 {
    font-family: var(--sao-font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--sao-charcoal);
    margin-bottom: 10px;
}

.sao-info-content p {
    font-size: 0.95rem;
    color: var(--sao-text-muted);
    line-height: 1.6;
    margin: 0;
}

/* ========================================
   FEATURE CARDS - What This Report Reveals
   ======================================== */
.sao-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.sao-feature-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--sao-radius-md);
    padding: 32px;
    text-align: center;
    transition: var(--sao-transition);
    backdrop-filter: blur(10px);
}

.sao-feature-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-4px);
    border-color: rgba(201, 162, 39, 0.4);
}

.sao-feature-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--sao-sienna) 0%, var(--sao-gold) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.sao-feature-icon i {
    font-size: 1.6rem;
    color: var(--sao-white);
}

.sao-feature-card h4 {
    font-family: var(--sao-font-serif);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--sao-white);
    margin-bottom: 12px;
}

.sao-feature-card p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.6;
    margin: 0;
}

/* ========================================
   CALLOUT BOXES
   ======================================== */
.sao-callout {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.1) 0%, rgba(196, 129, 61, 0.08) 100%);
    border-left: 4px solid var(--sao-gold);
    border-radius: 0 var(--sao-radius-md) var(--sao-radius-md) 0;
    padding: 24px;
    margin: 32px 0;
}

.sao-callout i {
    font-size: 1.3rem;
    color: var(--sao-ochre);
    flex-shrink: 0;
    margin-top: 2px;
}

.sao-callout p {
    font-size: 1.05rem;
    color: var(--sao-text);
    line-height: 1.6;
    margin: 0;
    font-style: italic;
}

.sao-callout-highlight {
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.15) 0%, rgba(196, 129, 61, 0.12) 100%);
    border-left-color: var(--sao-sienna);
}

/* ========================================
   CONDENSED TIMELINE - Historical Context
   ======================================== */
.sao-timeline {
    position: relative;
    padding-left: 40px;
    max-width: 800px;
    margin: 0 auto;
}

.sao-timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--sao-sienna), var(--sao-gold), var(--sao-sienna));
}

.sao-timeline-item {
    position: relative;
    padding-bottom: 32px;
    padding-left: 20px;
}

.sao-timeline-item:last-child {
    padding-bottom: 0;
}

.sao-timeline-marker {
    position: absolute;
    left: -34px;
    top: 6px;
    width: 12px;
    height: 12px;
    background: var(--sao-gold);
    border: 3px solid var(--sao-parchment);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--sao-gold);
    z-index: 1;
}

.sao-timeline-era {
    font-family: var(--sao-font-serif);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--sao-ochre);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 6px;
}

.sao-timeline-title {
    font-family: var(--sao-font-serif);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--sao-charcoal);
    margin-bottom: 8px;
}

.sao-timeline-description {
    font-size: 0.95rem;
    color: var(--sao-text-muted);
    line-height: 1.6;
    margin: 0;
}

.sao-timeline-regions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.sao-timeline-region-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(201, 162, 39, 0.12);
    color: var(--sao-sienna);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.sao-timeline-region-tag i {
    font-size: 0.7rem;
}

/* Dark section timeline */
.sao-section-dark .sao-timeline::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.3), var(--sao-gold), rgba(255, 255, 255, 0.3));
}

.sao-section-dark .sao-timeline-marker {
    border-color: var(--sao-charcoal);
}

.sao-section-dark .sao-timeline-era {
    color: var(--sao-gold-light);
}

.sao-section-dark .sao-timeline-title {
    color: var(--sao-white);
}

.sao-section-dark .sao-timeline-description {
    color: rgba(255, 255, 255, 0.75);
}

.sao-section-dark .sao-timeline-region-tag {
    background: rgba(201, 162, 39, 0.2);
    color: var(--sao-gold-light);
}

/* ========================================
   FAQ ACCORDION
   ======================================== */
.sao-faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.sao-faq-title {
    font-family: var(--sao-font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--sao-charcoal);
    text-align: center;
    margin-bottom: 32px;
}

.sao-faq-accordion {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sao-faq-item {
    background: var(--sao-white);
    border-radius: var(--sao-radius-md);
    border: 1px solid var(--sao-border);
    overflow: hidden;
    transition: var(--sao-transition);
}

.sao-faq-item:hover {
    box-shadow: var(--sao-shadow-sm);
}

.sao-faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--sao-charcoal);
    text-align: left;
    transition: var(--sao-transition);
}

.sao-faq-question:hover {
    color: var(--sao-sienna);
}

.sao-faq-question i {
    color: var(--sao-ochre);
    transition: transform 0.3s ease;
}

.sao-faq-item.active .sao-faq-question i {
    transform: rotate(180deg);
}

.sao-faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sao-faq-item.active .sao-faq-answer {
    max-height: 500px;
}

.sao-faq-answer p {
    padding: 0 24px 20px;
    font-size: 0.95rem;
    color: var(--sao-text-muted);
    line-height: 1.7;
    margin: 0;
}

/* ========================================
   AI ASSISTANT SECTION (Premium Style)
   ======================================== */
.sao-ai-container {
    background: var(--sao-white);
    border-radius: var(--sao-radius-lg);
    padding: 40px;
    box-shadow: var(--sao-shadow-lg);
    border: 1px solid var(--sao-border);
    max-width: 800px;
    margin: 0 auto;
}

.sao-ai-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--sao-border);
}

.sao-ai-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sao-ai-title i {
    font-size: 1.75rem;
    color: var(--sao-sienna);
}

.sao-ai-title h4 {
    font-family: var(--sao-font-serif);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--sao-charcoal);
    margin: 0;
}

.sao-ai-title h4 small {
    font-size: 0.6em;
    color: var(--sao-text-muted);
    font-weight: 400;
}

.sao-ai-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.sao-ai-badge.badge-success {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
}

.sao-ai-badge.badge-warning {
    background: rgba(255, 193, 7, 0.15);
    color: #b38600;
}

.sao-ai-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: rgba(196, 129, 61, 0.08);
    border-radius: var(--sao-radius-sm);
    padding: 16px;
    margin-bottom: 24px;
}

.sao-ai-info i {
    color: var(--sao-ochre);
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.sao-ai-info p {
    font-size: 0.9rem;
    color: var(--sao-text-muted);
    margin: 0;
    line-height: 1.5;
}

.sao-suggested-prompts {
    margin-bottom: 24px;
}

.sao-suggested-prompts > p {
    font-size: 0.85rem;
    color: var(--sao-text-muted);
    margin-bottom: 12px;
}

.sao-prompt-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(196, 129, 61, 0.1);
    border: 1px solid rgba(196, 129, 61, 0.25);
    color: var(--sao-sienna);
    padding: 10px 16px;
    border-radius: var(--sao-radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--sao-transition);
    margin-right: 10px;
    margin-bottom: 10px;
}

.sao-prompt-btn:hover {
    background: rgba(196, 129, 61, 0.2);
    border-color: var(--sao-sienna);
}

.sao-ai-main-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, var(--sao-sienna) 0%, var(--sao-ochre) 100%);
    color: var(--sao-white);
    padding: 16px 32px;
    border: none;
    border-radius: var(--sao-radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--sao-transition);
    box-shadow: var(--sao-shadow-warm);
}

.sao-ai-main-btn img {
    width: 24px;
    height: 24px;
}

.sao-ai-main-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--sao-shadow-gold);
}

.sao-ai-results {
    margin-top: 24px;
}

/* ========================================
   METHODOLOGY SECTION
   ======================================== */
.sao-methodology {
    background: var(--sao-white);
    border-radius: var(--sao-radius-lg);
    padding: 40px;
    box-shadow: var(--sao-shadow-sm);
    border: 1px solid var(--sao-border);
    max-width: 800px;
    margin: 40px auto 0;
}

.sao-methodology h4 {
    font-family: var(--sao-font-serif);
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--sao-charcoal);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sao-methodology h4 i {
    color: var(--sao-sienna);
}

.sao-method-steps {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.sao-method-step {
    flex: 1;
    min-width: 200px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    background: var(--sao-parchment);
    border-radius: var(--sao-radius-sm);
}

.sao-step-number {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--sao-sienna) 0%, var(--sao-gold) 100%);
    color: var(--sao-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.sao-method-step p {
    font-size: 0.9rem;
    color: var(--sao-text);
    margin: 0;
    line-height: 1.5;
}

/* ========================================
   FOOTER NOTE
   ======================================== */
.sao-footer-note {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(196, 129, 61, 0.08);
    border: 1px solid rgba(196, 129, 61, 0.15);
    border-radius: var(--sao-radius-md);
    padding: 16px 24px;
    margin: 40px 0;
}

.sao-footer-note i {
    color: var(--sao-ochre);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sao-footer-note span {
    font-size: 0.9rem;
    color: var(--sao-text-muted);
}

.sao-footer-note strong {
    color: var(--sao-charcoal);
}

/* ========================================
   REGION CARD OVERRIDES (Premium Style)
   ======================================== */
.sao-section .card-ancestry-region {
    border: 1px solid var(--sao-border);
    box-shadow: var(--sao-shadow-sm);
    transition: var(--sao-transition);
}

.sao-section .card-ancestry-region:hover {
    box-shadow: var(--sao-shadow-md);
    transform: translateY(-4px);
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */
@media (max-width: 991px) {
    .sao-hero {
        min-height: 100vh;
        padding: 80px 16px 50px;
    }
    
    .sao-hero-title {
        font-size: clamp(1.8rem, 4vw, 2.5rem);
    }
    
    .sao-hero-stats {
        gap: 16px;
    }
    
    .sao-stat-item {
        padding: 12px 16px;
        min-width: 90px;
    }
    
    .sao-stat-value {
        font-size: 1.5rem;
    }
    
    .sao-stat-divider {
        display: none;
    }
    
    .sao-section {
        padding: 60px 0;
    }
    
    .sao-chapter-header {
        margin-bottom: 36px;
    }
    
    .sao-chapter-number::before,
    .sao-chapter-number::after {
        width: 25px;
    }
    
    .sao-info-card {
        padding: 24px;
    }
    
    .sao-ai-container {
        padding: 28px;
    }
    
    .sao-methodology {
        padding: 28px;
    }
}

@media (max-width: 576px) {
    .sao-hero {
        padding: 70px 12px 40px;
    }
    
    .sao-hero-badge {
        font-size: 0.75rem;
        padding: 8px 16px;
    }
    
    .sao-hero-stats {
        flex-direction: column;
        align-items: center;
    }
    
    .sao-stat-item {
        width: 100%;
        max-width: 200px;
    }
    
    .sao-trust-badges {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
    
    .sao-summary-grid {
        grid-template-columns: 1fr;
    }
    
    .sao-info-grid {
        grid-template-columns: 1fr;
    }
    
    .sao-info-card {
        flex-direction: column;
        text-align: center;
    }
    
    .sao-timeline {
        padding-left: 30px;
    }
    
    .sao-timeline-marker {
        left: -24px;
    }
    
    .sao-faq-question {
        padding: 16px 18px;
        font-size: 0.95rem;
    }
    
    .sao-ai-container {
        padding: 20px;
    }
    
    .sao-ai-main-btn {
        width: 100%;
        justify-content: center;
    }
    
    .sao-method-steps {
        flex-direction: column;
    }
}

/* Print styles */
@media print {
    .sao-scroll-progress,
    .sao-page-nav,
    .sao-back-to-top,
    .sao-bottom-nav,
    .sao-hero-particles,
    .sao-hero-paths,
    .sao-ai-container,
    .sao-suggested-prompts,
    .sao-ai-main-btn {
        display: none !important;
    }
    
    .sao-hero {
        min-height: auto;
        padding: 40px 20px;
    }
    
    .sao-section {
        padding: 30px 0;
        break-inside: avoid;
    }
}

/* ========================================
   Legacy Modal Styles (Commented Out)
   ======================================== */

/* These styles are no longer used but kept for reference
.region-detail-modal .modal-dialog {
    max-width: 900px;
}

.region-detail-modal .modal-content {
    border-radius: 12px;
    border: none;
}

/* Legacy modal styles - now replaced by drawer */
/*
.region-detail-modal .modal-header {
    background: white;
    color: var(--dnagenics-dark);
    border-bottom: 3px solid var(--dnagenics-teal);
    border-radius: 12px 12px 0 0;
    padding: 1.5rem;
}

.region-detail-modal .modal-title {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--dnagenics-teal);
}

.region-detail-modal .modal-body {
    padding: 0;
}
*/

/* Side-by-Side Sticky Layout - 2025 UX Redesign */
/* Ensure parent containers don't interfere with sticky */
.container:has(.ancestry-layout-container),
.container-fluid:has(.ancestry-layout-container) {
    overflow: visible !important; /* Critical: sticky won't work with overflow:hidden */
}

/* Fallback for browsers without :has() support */
@supports not selector(:has(*)) {
    .container.mt-5,
    .container-fluid {
        overflow-x: visible !important;
        overflow-y: visible !important;
    }
}

.ancestry-layout-container {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    margin-bottom: 3rem;
    position: relative; /* Required for sticky to work */
    z-index: 1;
    overflow: visible; /* Ensure sticky children can stick */
}

.table-container-scrollable {
    width: 40%;
    flex-shrink: 0;
    position: relative;
}

.map-container-sticky {
    position: -webkit-sticky; /* Safari support */
    position: sticky;
    top: 100px;
    width: 60%;
    height: calc(100vh - 120px);
    min-height: 600px;
    max-height: calc(100vh - 120px);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    background: white;
    display: flex;
    flex-direction: column;
    align-self: flex-start; /* Critical for sticky positioning in flexbox */
    z-index: 10;
    will-change: position; /* Optimize for sticky */
    transition: opacity 0.3s ease;
}

/* Map container sticky behavior is handled natively by CSS position: sticky */

/* Map Loading Skeleton */
.map-loading-skeleton {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.skeleton-animation {
    width: 60px;
    height: 60px;
    border: 4px solid #e0e0e0;
    border-top-color: var(--dnagenics-teal);
    border-radius: 50%;
    animation: spinner 1s linear infinite;
}

.skeleton-text {
    position: absolute;
    bottom: 50px;
    color: #999;
    font-size: 14px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes spinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Map Element */
.mapcontinental {
    width: 100%;
    height: 100%;
    flex-grow: 1;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
}

/* ========================================
   FULL-WIDTH MAP WITH FLOATING PANEL LAYOUT
   Desktop (992px+) - Edge-to-edge map with overlay panel
   ======================================== */
@media (min-width: 992px) {
    /* Section with full-width map - remove side padding */
    .sao-section-fullwidth-map {
        padding-left: 0;
        padding-right: 0;
    }
    
    /* Full-width map wrapper - breaks out of container */
    .sao-map-fullwidth-wrapper {
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        position: relative;
        height: 80vh;
        min-height: 700px;
        max-height: 90vh;
        overflow: hidden;
    }
    
    /* Map container - fills wrapper */
    .sao-map-fullwidth-container {
        position: relative;
        width: 100%;
        height: 100%;
    }
    
    /* Floating Ancestry Panel - Left Overlay */
    .sao-ancestry-overlay-panel {
        position: absolute;
        left: 24px;
        top: 24px;
        bottom: 24px;
        width: 380px;
        max-width: 30%;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border-radius: 16px;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
        z-index: 500;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        border: 1px solid rgba(255, 255, 255, 0.3);
        pointer-events: auto; /* Ensure panel is interactive */
    }
    
    /* Ensure map behind overlay is still interactive */
    .sao-fullwidth-map {
        pointer-events: auto;
    }
    
    /* Map controls should be above overlay */
    .sao-fullwidth-map .leaflet-control-container {
        pointer-events: auto;
    }
    
    /* Overlay panel content - scrollable */
    .sao-overlay-panel-content {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 0;
        /* Custom scrollbar styling */
        scrollbar-width: thin;
        scrollbar-color: rgba(160, 82, 45, 0.3) transparent;
    }
    
    .sao-overlay-panel-content::-webkit-scrollbar {
        width: 8px;
    }
    
    .sao-overlay-panel-content::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .sao-overlay-panel-content::-webkit-scrollbar-thumb {
        background: rgba(160, 82, 45, 0.3);
        border-radius: 4px;
    }
    
    .sao-overlay-panel-content::-webkit-scrollbar-thumb:hover {
        background: rgba(160, 82, 45, 0.5);
    }
    
    /* Compact ancestry breakdown in overlay */
    .sao-ancestry-overlay-panel .ancestry-breakdown-container {
        box-shadow: none;
        border-radius: 0;
        border: none;
        margin: 0;
    }
    
    .sao-ancestry-overlay-panel .ancestry-content {
        padding: 0;
    }
    
    .sao-ancestry-overlay-panel .region-group:first-child .region-header {
        border-radius: 16px 16px 0 0;
    }
    
    .sao-ancestry-overlay-panel .region-group:last-child {
        border-radius: 0 0 16px 16px;
    }
    
    .sao-ancestry-overlay-panel .region-group:last-child .ancestry-item:last-child {
        border-radius: 0 0 16px 16px;
    }
    
    /* Full-width Map Container */
    .sao-fullwidth-map {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        z-index: 1;
    }
    
    /* External zoom controls container - positioned above overlay panel */
    .sao-map-zoom-controls {
        position: absolute;
        top: 24px;
        right: 24px;
        z-index: 600;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    
    .sao-map-zoom-controls button {
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 8px;
        background: white;
        color: var(--sao-sienna, #A0522D);
        font-size: 20px;
        font-weight: bold;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sao-map-zoom-controls button:hover {
        background: var(--sao-sienna, #A0522D);
        color: white;
        transform: scale(1.05);
    }
    
    .sao-map-zoom-controls button:active {
        transform: scale(0.95);
    }
    
    /* Map element in full-width layout */
    .sao-fullwidth-map .mapcontinental {
        width: 100%;
        height: 100%;
        border-radius: 0;
        aspect-ratio: auto;
    }
    
    /* Map loading skeleton in full-width layout */
    .sao-fullwidth-map .map-loading-skeleton {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10;
    }
    
    /* Ensure Leaflet controls are visible above overlay */
    .sao-fullwidth-map .leaflet-control {
        z-index: 600;
    }
    
    /* Map legend positioning in full-width layout */
    .sao-fullwidth-map .map-legend {
        position: absolute;
        bottom: 24px;
        right: 24px;
        z-index: 600;
    }
}

/* Mobile/Tablet Responsive - Revert to Stacked Layout */
@media (max-width: 991px) {
    .sao-section-fullwidth-map {
        padding-left: 0;
        padding-right: 0;
        overflow-x: hidden; /* Prevent horizontal overflow */
    }
    
    .sao-map-fullwidth-wrapper {
        width: 100%;
        margin-left: 0;
        height: auto;
        min-height: 500px;
        max-height: none;
        overflow-x: hidden; /* Prevent horizontal overflow */
        max-width: 100vw; /* Ensure it doesn't exceed viewport */
    }
    
    .sao-map-fullwidth-container {
        display: flex;
        flex-direction: column;
        gap: 24px;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden; /* Prevent horizontal overflow */
    }
    
    .sao-ancestry-overlay-panel {
        position: relative;
        left: auto;
        top: auto;
        bottom: auto;
        width: calc(100% - 32px);
        max-width: calc(100% - 32px);
        margin: 0 16px;
        border-radius: 16px;
        box-shadow: var(--sao-shadow-lg);
        overflow-x: hidden; /* Prevent horizontal overflow */
    }
    
    .sao-overlay-panel-content {
        max-height: none;
        overflow-y: visible;
        overflow-x: hidden; /* Prevent horizontal overflow */
        width: 100%;
    }
    
    .sao-fullwidth-map {
        position: relative;
        width: calc(100% - 32px);
        max-width: calc(100% - 32px);
        height: 500px;
        min-height: 500px;
        margin: 0 16px 16px;
        border-radius: 16px;
        overflow: hidden;
        box-shadow: var(--sao-shadow-md);
    }
    
    .sao-fullwidth-map .mapcontinental {
        border-radius: 16px;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    /* Position custom zoom controls for mobile */
    .sao-map-zoom-controls {
        position: absolute;
        top: 16px;
        right: 16px;
        z-index: 100;
    }
    
    .sao-map-zoom-controls button {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }
}

/* Map Legend - Hidden */
.map-legend {
    display: none !important;
    position: absolute;
    bottom: 60px;
    right: 15px;
    background: white;
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 200px;
}

.map-legend h6 {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2d3748;
}

.legend-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.legend-label {
    font-size: 12px;
    color: #4a5568;
    white-space: nowrap;
}

.map-disclaimer {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    text-align: center;
    z-index: 999;
}

/* Map Polygon Styling - Enhanced Professional Appearance */
.leaflet-overlay-pane svg path.ancestry-map-region {
    stroke-linejoin: round;
    stroke-linecap: round;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.leaflet-overlay-pane svg path.ancestry-map-region:hover {
    filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.3));
}

/* Enhanced SVG path rendering for all map regions */
.leaflet-overlay-pane svg path {
    stroke-linejoin: round;
    stroke-linecap: round;
    transition: fill-opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                stroke-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                filter 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Map Highlight Animation */
@keyframes map-region-pulse {
    0%, 100% { 
        fill-opacity: 0.7;
        stroke-width: 2.5;
    }
    50% { 
        fill-opacity: 0.9;
        stroke-width: 4;
    }
}

.map-region-highlighted {
    animation: map-region-pulse 1.5s ease-in-out 2;
}

/* Map Tooltips and Popups Styling */
.custom-tooltip {
    background: rgba(255, 255, 255, 0.95) !important;
    border: 2px solid var(--dnagenics-teal) !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}

.custom-tooltip::before {
    border-top-color: var(--dnagenics-teal) !important;
}

.map-tooltip {
    text-align: center;
    color: #2d3748;
}

.map-tooltip strong {
    font-size: 14px;
    color: #1a202c;
    display: block;
    margin-bottom: 4px;
}

.map-popup {
    padding: 4px;
    min-width: 180px;
}

.map-popup h6 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}

.leaflet-popup-content-wrapper {
    border-radius: 10px !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15) !important;
}

.leaflet-popup-tip {
    box-shadow: 0 3px 8px rgba(0,0,0,0.1) !important;
}

/* Leaflet Control Styling - Custom zoom controls are used instead of built-in */
/* See .sao-map-zoom-controls for custom zoom button styling */

/* Hide Leaflet's built-in zoom controls - using custom controls instead */
.sao-fullwidth-map .leaflet-control-zoom,
#mapcontinentalSharedOrigins .leaflet-control-zoom {
    display: none !important;
}

/* Leaflet Attribution */
.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.8) !important;
    font-size: 11px !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
}

/* Accessibility - Focus Styles */
.ancestry-item:focus-visible,
.region-header:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 3px solid var(--dnagenics-teal) !important;
    outline-offset: 2px !important;
}

.leaflet-container:focus-visible {
    outline: 3px solid var(--dnagenics-teal) !important;
    outline-offset: -3px !important;
}

/* Skip to content link for screen readers */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--dnagenics-teal);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100000;
}

.skip-to-content:focus {
    top: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ancestry-item,
    .region-header,
    .map-legend {
        border: 2px solid currentColor !important;
    }
    
    .color-dot {
        border: 2px solid currentColor !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .map-region-highlighted {
        animation: none !important;
    }
    
    .skeleton-animation {
        animation: none !important;
    }
}

/* Mobile Responsive Layout - Map and Layout Only */
@media (max-width: 992px) {
    .ancestry-layout-container {
        flex-direction: column;
    }
    
    .table-container-scrollable,
    .map-container-sticky {
        width: 100%;
        position: relative;
        top: auto;
    }
    
    .map-container-sticky {
        height: 500px;
        min-height: 500px;
    }
    
    .map-legend {
        bottom: 50px;
        right: 10px;
        padding: 10px 12px;
        max-width: 160px;
    }
    
    .legend-label {
        font-size: 11px;
    }
}

/* Leaflet Map Legend */
.map-legend {
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    line-height: 24px;
    color: #555;
    font-size: 13px;
}

.map-legend h6 {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--dnagenics-dark);
}

.map-legend i {
    width: 18px;
    height: 18px;
    float: left;
    margin-right: 8px;
    opacity: 0.8;
    border-radius: 3px;
}

.map-legend .legend-item {
    margin: 5px 0;
    display: flex;
    align-items: center;
}

.map-legend .legend-color {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Map Control Buttons */
.leaflet-control-custom {
    background: white;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
}

.leaflet-control-custom:hover {
    background: #f4f4f4;
}

@media (max-width: 768px) {
    .mapcontinental {
        height: 400px;
    }
    
    .map-legend {
        font-size: 11px;
        padding: 8px 10px;
    }
    
    .map-legend h6 {
        font-size: 12px;
    }
}

/* At-a-Glance Summary Card */
.at-a-glance-card {
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.08) 0%, rgba(144, 238, 144, 0.08) 100%);
    border: 2px solid var(--dnagenics-teal);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 3rem;
    box-shadow: 0 8px 24px rgba(0, 180, 216, 0.15);
}

.at-a-glance-card h3 {
    color: var(--dnagenics-teal);
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
}

.at-a-glance-card h3 i {
    margin-right: 0.75rem;
    font-size: 1.5rem;
}

.top-regions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.top-region-item {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.top-region-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.top-region-percentage {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dnagenics-teal);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.top-region-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dnagenics-dark);
    margin-bottom: 0.25rem;
}

.top-region-continent {
    font-size: 0.85rem;
    color: #6c757d;
}

.quick-insights {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.quick-insights h5 {
    color: var(--dnagenics-teal);
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.quick-insights ul {
    margin-bottom: 0;
    padding-left: 1.5rem;
}

.quick-insights li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.quick-insights li:last-child {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .at-a-glance-card {
        padding: 1.5rem;
    }
    
    .top-regions-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .top-region-percentage {
        font-size: 2rem;
    }
}

/* Understanding Section */
.understanding-section {
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.05) 0%, rgba(144, 238, 144, 0.05) 100%);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.understanding-section h4 {
    color: var(--dnagenics-teal);
    font-weight: 700;
    margin-bottom: 1rem;
}

.understanding-section .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.info-item {
    display: flex;
    align-items: start;
}

.info-item i {
    color: var(--dnagenics-lime);
    font-size: 1.5rem;
    margin-right: 1rem;
    margin-top: 0.25rem;
}

.info-item-content h6 {
    font-weight: 600;
    color: var(--dnagenics-teal);
    margin-bottom: 0.5rem;
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-header h3 {
    color: var(--dnagenics-dark);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-header p {
    color: #6c757d;
    font-size: 1.1rem;
}

/* FAQ Accordion */
.faq-accordion .card {
    border: none;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.faq-accordion .card-header {
    background: white;
    border: none;
    padding: 0;
}

/* Collapsible Card Headers */
.card-header[data-toggle="collapse"] {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.card-header[data-toggle="collapse"]:hover {
    background-color: rgba(0, 180, 216, 0.05);
}

.faq-accordion .btn-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1.25rem 1.5rem;
    text-decoration: none;
    color: var(--dnagenics-dark);
    font-weight: 600;
    font-size: 1.1rem;
}

.faq-accordion .btn-link:hover {
    text-decoration: none;
    color: var(--dnagenics-teal);
}

.faq-accordion .btn-link i {
    color: var(--dnagenics-teal);
    margin-right: 1rem;
    font-size: 1.25rem;
}

.faq-accordion .card-body {
    padding: 1.5rem;
    line-height: 1.7;
}

/* AI Assistant Section */
.ai-assistant-section {
    background: linear-gradient(135deg, rgba(0, 180, 216, 0.1) 0%, rgba(144, 238, 144, 0.1) 100%);
    border: 2px solid var(--dnagenics-teal);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 3rem;
    margin-bottom: 3rem;
}

.ai-suggested-prompt {
    margin: 0.25rem;
    transition: all 0.3s ease;
    border-radius: 20px;
    font-size: 0.9rem;
}

.ai-suggested-prompt:hover {
    background-color: var(--dnagenics-teal);
    color: white;
    border-color: var(--dnagenics-teal);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 180, 216, 0.3);
}

.ai-suggested-prompt:active {
    transform: translateY(0);
}

.gap-2 {
    gap: 0.5rem;
}

.ai-assistant-section h4 {
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--dnagenics-dark);
}

.ai-assistant-section h4 i {
    color: var(--dnagenics-teal);
}

.ai-assistant-section small {
    color: #6c757d;
}

.ai-assistant-section .badge {
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
}

.ai-assistant-section .alert {
    background-color: white;
    border: 1px solid #dee2e6;
    color: var(--dnagenics-dark);
}

.ai-assistant-section .alert i {
    color: var(--dnagenics-teal);
}

.ai-assistant-section .btn {
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-assistant-section .btn-light {
    background-color: white;
    border: 2px solid var(--dnagenics-teal);
    color: var(--dnagenics-teal);
}

.ai-assistant-section .btn-light:hover {
    background-color: var(--dnagenics-teal);
    color: white;
}

.ai-results {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
    color: var(--dnagenics-dark);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.ai-result-content {
    line-height: 1.7;
}

/* Composition Table Enhancements */
.composition-table-container {
    border-radius: 12px;
    overflow: hidden;
}

/* ========================================
   ANCESTRY TABLE - Premium Earth-Tone Design
   Matches page's Cormorant Garamond + Inter typography
   and sienna/gold/parchment color palette
   ======================================== */
.ancestry-breakdown-container {
    max-width: 100%;
    margin: 0 auto;
    background: transparent; /* Remove white background to fix corner artifact */
    border-radius: var(--sao-radius-lg);
    box-shadow: var(--sao-shadow-lg);
    overflow: visible; /* Allow dots to be visible, prevent clipping */
    border: 1px solid var(--sao-border);
    width: 100%;
}

/* Remove header-specific styles - container now starts with content */
.ancestry-breakdown-container:has(.ancestry-content:first-child) {
    border-radius: var(--sao-radius-lg);
}

/* ========================================
   PREMIUM CINEMATIC HEADER - Parchment Style
   ======================================== */
.ancestry-header-premium {
    background: linear-gradient(180deg, 
        var(--sao-parchment) 0%, 
        var(--sao-parchment-dark) 50%,
        #E0D6C3 100%);
    padding: 0;
    color: var(--sao-charcoal);
    position: relative;
    overflow: hidden;
    text-align: center;
}

/* Parchment Texture Overlay */
.ancestry-header-premium .header-texture {
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(ellipse at 20% 30%, rgba(201, 162, 39, 0.08) 0%, transparent 40%),
        radial-gradient(ellipse at 80% 70%, rgba(160, 82, 45, 0.06) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, rgba(99, 81, 71, 0.03) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* Top Ornamental Divider */
.ancestry-header-premium .header-ornament-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        var(--sao-sienna) 15%, 
        var(--sao-gold) 50%, 
        var(--sao-sienna) 85%, 
        transparent 100%);
    z-index: 2;
}

/* Bottom Ornamental Divider */
.ancestry-header-premium .header-ornament-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(160, 82, 45, 0.4) 20%, 
        var(--sao-sienna) 50%, 
        rgba(160, 82, 45, 0.4) 80%, 
        transparent 100%);
    z-index: 2;
}

/* Header Content Wrapper */
.ancestry-header-premium .header-content {
    position: relative;
    z-index: 1;
    padding: 32px 28px 28px;
}

/* Icon Wrapper */
.ancestry-header-premium .header-icon-wrapper {
    margin-bottom: 16px;
}

.ancestry-header-premium .header-icon-circle {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    background: linear-gradient(145deg, 
        var(--sao-sienna) 0%, 
        var(--sao-ochre) 50%, 
        var(--sao-gold) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 
        0 4px 16px rgba(160, 82, 45, 0.35),
        inset 0 1px 2px rgba(255, 255, 255, 0.25);
    border: 2px solid rgba(201, 162, 39, 0.4);
}

.ancestry-header-premium .header-icon-circle i {
    font-size: 1.5rem;
    color: var(--sao-white);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Chapter Label with Decorative Lines */
.ancestry-header-premium .header-chapter-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.ancestry-header-premium .chapter-line {
    width: 50px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--sao-ochre), transparent);
}

.ancestry-header-premium .chapter-text {
    font-family: var(--sao-font-serif);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sao-ochre);
    text-transform: uppercase;
    letter-spacing: 3px;
}

/* Main Title - Premium Serif */
.ancestry-header-premium .header-title {
    font-family: var(--sao-font-serif);
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    color: var(--sao-charcoal);
    line-height: 1.2;
    position: relative;
    z-index: 1;
}

/* Subtitle */
.ancestry-header-premium .header-subtitle {
    font-family: var(--sao-font-serif);
    font-size: 1rem;
    color: var(--sao-text-muted);
    font-weight: 400;
    font-style: italic;
    margin: 0 0 20px 0;
    position: relative;
    z-index: 1;
}

/* Quick Stats Row */
.ancestry-header-premium .header-stats-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(160, 82, 45, 0.15);
}

.ancestry-header-premium .header-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: var(--sao-radius-sm);
    border: 1px solid rgba(160, 82, 45, 0.1);
    min-width: 80px;
    transition: var(--sao-transition);
}

.ancestry-header-premium .header-stat:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(160, 82, 45, 0.12);
}

.ancestry-header-premium .header-stat-primary {
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.15) 0%, rgba(160, 82, 45, 0.1) 100%);
    border-color: rgba(201, 162, 39, 0.3);
}

.ancestry-header-premium .header-stat-primary:hover {
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.25) 0%, rgba(160, 82, 45, 0.15) 100%);
}

.ancestry-header-premium .stat-icon {
    color: var(--sao-ochre);
    font-size: 0.9rem;
}

.ancestry-header-premium .stat-value {
    font-family: var(--sao-font-serif);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--sao-charcoal);
    line-height: 1;
}

.ancestry-header-premium .stat-label {
    font-family: var(--sao-font-sans);
    font-size: 0.7rem;
    color: var(--sao-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    max-width: 80px;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ancestry-header-premium .header-stat-divider {
    width: 1px;
    height: 40px;
    background: linear-gradient(180deg, transparent, rgba(160, 82, 45, 0.2), transparent);
}

/* Legacy Header - Fallback for backward compatibility */
.ancestry-header:not(.ancestry-header-premium) {
    background: linear-gradient(135deg, var(--sao-umber) 0%, var(--sao-charcoal) 100%);
    padding: 32px 28px;
    color: var(--sao-white);
    position: relative;
    overflow: hidden;
}

/* Decorative gold accent line - Legacy */
.ancestry-header:not(.ancestry-header-premium)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--sao-sienna), var(--sao-gold), var(--sao-sienna));
}

/* Subtle texture overlay - Legacy */
.ancestry-header:not(.ancestry-header-premium)::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(201, 162, 39, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(196, 129, 61, 0.06) 0%, transparent 50%);
    pointer-events: none;
}

.ancestry-header:not(.ancestry-header-premium) .header-title {
    font-family: var(--sao-font-serif);
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
    color: var(--sao-white);
    position: relative;
    z-index: 1;
}

.ancestry-header:not(.ancestry-header-premium) .header-subtitle {
    font-family: var(--sao-font-sans);
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 400;
    margin: 0;
    position: relative;
    z-index: 1;
    letter-spacing: 0.3px;
}

/* Legacy header-icon styles */
.header-icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.25) 0%, rgba(196, 129, 61, 0.15) 100%);
    border: 1px solid rgba(201, 162, 39, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
}

.header-icon i {
    font-size: 24px;
    color: var(--sao-gold-light);
}

/* Content Section - Clean Start Without Header */
.ancestry-content {
    padding: 0;
    background: transparent; /* Transparent to let region headers fill edges */
    overflow: visible; /* Allow dots to be visible */
    width: 100%;
    max-width: 100%;
}

.region-group {
    margin-bottom: 0;
    background: var(--sao-white);
    border-radius: 0;
    box-shadow: none;
    overflow: visible; /* Allow subregion dots to be visible */
    border: none;
    border-bottom: 1px solid rgba(99, 81, 71, 0.1);
    transition: var(--sao-transition);
    width: 100%;
    max-width: 100%;
}

.region-group:first-child {
    border-top: none;
    border-radius: var(--sao-radius-lg) var(--sao-radius-lg) 0 0;
}

.region-group:hover {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.region-group:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

/* Region Header - Elegant Continent Banners */
.region-group:first-child .region-header {
    border-radius: var(--sao-radius-lg) var(--sao-radius-lg) 0 0;
}

.region-group:last-child .region-header {
    border-radius: 0;
}

.region-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-radius: 0;
    margin-bottom: 0;
    cursor: pointer;
    transition: var(--sao-transition);
    /* Default fallback if inline style doesn't override */
    background-color: var(--sao-parchment);
    color: var(--sao-charcoal);
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border-bottom: 2px solid rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* Prevent horizontal overflow */
    box-sizing: border-box;
}

.region-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    opacity: 0.5;
}

.region-header:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.region-header:active {
    transform: translateY(0);
}

.region-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--sao-font-serif);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.region-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: linear-gradient(135deg, rgba(201, 162, 39, 0.15) 0%, rgba(196, 129, 61, 0.1) 100%);
    border-radius: 50%;
}

.region-percentage {
    font-family: var(--sao-font-serif);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.3px;
    color: inherit;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0; /* Prevent percentage from shrinking */
    margin-left: 12px;
    white-space: nowrap;
}

/* Subregion - Secondary Hierarchy with Elegant Indentation */
.subregion {
    padding: 14px 24px 14px 60px; /* Extra padding to prevent dot clipping */
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    transition: var(--sao-transition);
    border-radius: 0;
    background: linear-gradient(90deg, rgba(245, 240, 230, 0.5) 0%, rgba(255, 255, 255, 0.3) 100%);
    border-bottom: 1px solid rgba(99, 81, 71, 0.1);
    border-left: 3px solid transparent;
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible; /* Allow dot to be visible, prevent clipping */
}

.subregion::before {
    content: '';
    position: absolute;
    left: 40px; /* Positioned with extra space from left edge to prevent clipping */
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--sao-ochre);
    opacity: 0.6;
    box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.2);
    z-index: 1; /* Ensure dot is above other elements */
    pointer-events: none; /* Don't interfere with hover */
}

.subregion:hover {
    background: linear-gradient(90deg, rgba(201, 162, 39, 0.08) 0%, rgba(255, 255, 255, 0.4) 100%);
    border-left-color: rgba(201, 162, 39, 0.3);
    padding-left: 64px; /* Increased padding on hover to accommodate scaled dot */
}

.subregion:hover::before {
    opacity: 0.9;
    transform: translateY(-50%) scale(1.2);
    left: 42px; /* Adjusted position when scaled to prevent clipping */
}

.subregion:last-of-type {
    border-bottom: none;
}

.subregion-name {
    font-family: var(--sao-font-sans);
    color: var(--sao-text);
    font-weight: 600;
    letter-spacing: 0.15px;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.subregion-percentage {
    font-family: var(--sao-font-sans);
    color: var(--sao-charcoal);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-size: 0.95rem;
    flex-shrink: 0; /* Prevent percentage from shrinking */
    margin-left: 12px;
}

/* Ancestry Item - Population Rows with Premium Interactions */
.ancestry-item {
    padding: 13px 24px 13px 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    border-radius: 0;
    transition: var(--sao-transition);
    cursor: pointer;
    border: none;
    border-bottom: 1px solid rgba(99, 81, 71, 0.06);
    background-color: var(--sao-white);
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent horizontal overflow */
}

/* Subtle left border indicator */
.ancestry-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, transparent, var(--sao-gold), transparent);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ancestry-item:hover {
    background: linear-gradient(90deg, rgba(201, 162, 39, 0.05) 0%, rgba(255, 255, 255, 0.95) 100%);
    transform: translateX(3px);
    border-bottom-color: rgba(99, 81, 71, 0.1);
}

.ancestry-item:hover::before {
    opacity: 0.6;
}

.ancestry-item:last-child {
    border-bottom: none;
}

.ancestry-item:focus {
    outline: none;
    background: rgba(201, 162, 39, 0.08);
    box-shadow: inset 0 0 0 2px var(--sao-gold);
}

.ancestry-item:focus-visible {
    outline: 3px solid var(--sao-gold);
    outline-offset: -3px;
    background: rgba(201, 162, 39, 0.05);
}

/* Active/Selected State - Gold Accent */
.ancestry-item.active {
    background: linear-gradient(90deg, rgba(201, 162, 39, 0.1) 0%, rgba(201, 162, 39, 0.03) 100%);
    border-left: 3px solid var(--sao-gold);
    padding-left: 61px;
}

.ancestry-item.active::before {
    opacity: 1;
    width: 3px;
    background: var(--sao-gold);
}

.ancestry-item.active .ancestry-name {
    color: var(--sao-charcoal);
    font-weight: 600;
}

.ancestry-item.active .ancestry-percentage {
    color: var(--sao-sienna);
    font-weight: 700;
}

.ancestry-name {
    display: flex;
    align-items: center;
    gap: 14px;
    font-family: var(--sao-font-sans);
    color: var(--sao-text);
    font-weight: 400;
    transition: color 0.2s ease, font-weight 0.2s ease;
    flex: 1;
    min-width: 0;
/*    overflow: hidden;*/
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ancestry-item:hover .ancestry-name {
    color: var(--sao-charcoal);
    font-weight: 500;
}

.color-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 
        0 1px 3px rgba(0, 0, 0, 0.2),
        0 0 0 2px rgba(255, 255, 255, 0.8),
        inset 0 1px 1px rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.ancestry-item:hover .color-dot {
    transform: scale(1.3);
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.25),
        0 0 0 3px rgba(201, 162, 39, 0.2),
        inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.ancestry-percentage {
    font-family: var(--sao-font-sans);
    color: var(--sao-text-muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    transition: color 0.2s ease, font-weight 0.2s ease;
    white-space: nowrap;
    margin-left: 12px;
    flex-shrink: 0; /* Prevent percentage from shrinking */
}

.ancestry-item:hover .ancestry-percentage {
    color: var(--sao-charcoal);
    font-weight: 700;
}

/* Legacy styles for backward compatibility */
.ancestry-table-wrapper {
    background: linear-gradient(to bottom, #fafbfc 0%, #ffffff 100%);
    border-radius: 15px;
    overflow: hidden;
}

.ancestry-continent-section {
    border-bottom: 2px solid #e9ecef;
}

.ancestry-continent-section:last-child {
    border-bottom: none;
}

.continent-header {
    padding: 18px 24px;
    color: white;
    transition: all 0.3s ease;
}

.continent-header:hover {
    transform: translateX(3px);
}

.continent-title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.continent-percentage {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.continent-header-european {
    background: linear-gradient(135deg, #6B7FA8 0%, #8B9DC3 100%);
    border-left: 5px solid #4A5F88;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.1);
}

.continent-header-asian {
    background: linear-gradient(135deg, #5D9B9B 0%, #7DBCBC 100%);
    border-left: 5px solid #3D7B7B;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.1);
}

.continent-header-african {
    background: linear-gradient(135deg, #B8956A 0%, #D4B896 100%);
    border-left: 5px solid #98754A;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.1);
}

.region-subheader {
    background-color: #f8f9fa;
    border-left: 4px solid #dee2e6;
    padding: 14px 24px;
    transition: background-color 0.2s ease;
}

.region-subheader:hover {
    background-color: #f0f2f5;
}

.region-name {
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
}

.population-row {
    padding: 14px 24px;
    border-bottom: 1px solid #f0f2f5;
    transition: all 0.2s ease;
    cursor: pointer;
}

.population-row:last-child {
    border-bottom: none;
}

.population-row:hover {
    background-color: #f8f9fa;
    padding-left: 28px;
}

.population-color-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 14px;
    opacity: 0.85;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.population-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #495057;
}

.percentage-container {
    min-width: 140px;
    text-align: right;
}

.percentage-display {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    display: block;
    margin-bottom: 4px;
}

/* Legacy Composition Table Styles (for backward compatibility) */
#accordionCountries {
    font-size: 0.95rem;
}

#accordionCountries .card-header {
    border-radius: 8px;
}

#accordionCountries .card-header h6 {
    display: flex;
    align-items: center;
}

.composition-table {
    margin-bottom: 0;
}

.composition-table tr td,
.composition-table tr th {
    border-top: 0;
    font-size: 0.95rem;
    vertical-align: middle;
}

.composition-table tbody tr th {
    width: 35px;
    padding-left: 1rem !important;
}

.composition-table tbody tr td:first-of-type {
    padding-left: 0.5rem;
}

.composition-table tbody tr td:last-child {
    text-align: right;
    padding-right: 1rem;
    white-space: nowrap;
}

.region-row {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.region-row:hover {
    background-color: rgba(0, 180, 216, 0.08);
}

.region-row td {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

/* Color dot styling */
.composition-table .fa-circle {
    font-size: 0.75rem;
}

/* Mobile Responsive for Ancestry Table - Premium Earth-Tone Design */
@media (max-width: 768px) {
    .ancestry-breakdown-container {
        border-radius: var(--sao-radius-md);
        margin: 0;
        max-width: 100%;
        overflow-x: hidden;
        width: 100%;
    }
    
    .ancestry-content {
        padding: 0;
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
    }
    
    .region-group {
        margin-bottom: 0;
        border-radius: 0;
    }
    
    .region-group:first-child .region-header {
        border-radius: var(--sao-radius-md) var(--sao-radius-md) 0 0;
    }
    
    .region-header {
        padding: 14px 16px;
    }
    
    .region-title {
        font-size: 1rem;
        gap: 10px;
    }
    
    .region-icon {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }
    
    .region-percentage {
        font-size: 1.1rem;
    }
    
    .subregion {
        padding: 12px 16px 12px 52px; /* Extra padding to prevent dot clipping on mobile */
        font-size: 0.9rem;
    }
    
    .subregion::before {
        left: 34px; /* Positioned with extra space from left edge on mobile */
        width: 5px;
        height: 5px;
    }
    
    .subregion:hover {
        padding-left: 56px; /* Increased padding on hover for mobile */
    }
    
    .subregion:hover::before {
        left: 36px; /* Adjusted position when scaled on mobile */
    }
    
    .ancestry-item {
        padding: 11px 16px 11px 52px;
        font-size: 0.85rem;
    }
    
    .ancestry-item:hover {
        transform: translateX(2px);
    }
    
    .ancestry-item.active {
        padding-left: 49px;
    }
    
    .ancestry-name {
        gap: 10px;
    }
    
    .color-dot {
        width: 9px;
        height: 9px;
    }
    
    .ancestry-percentage {
        font-size: 0.85rem;
    }
    
    /* Legacy responsive styles */
    .continent-header {
        padding: 14px 16px;
    }
    
    .continent-title {
        font-size: 1rem;
    }
    
    .continent-percentage {
        font-size: 1.1rem;
    }
    
    .region-subheader {
        padding: 12px 16px;
    }
    
    .region-name,
    .region-percentage {
        font-size: 0.9rem;
    }
    
    .population-row {
        padding: 12px 16px;
    }
    
    .population-row:hover {
        padding-left: 20px;
    }
    
    .population-color-indicator {
        width: 10px;
        height: 10px;
        margin-right: 10px;
    }
    
    .population-name {
        font-size: 0.875rem;
    }
    
    .percentage-container {
        min-width: 100px;
    }
    
    .percentage-display {
        font-size: 0.9rem;
    }
    
    .understanding-section {
        padding: 1.5rem;
    }
    
    .understanding-section .info-grid {
        grid-template-columns: 1fr;
    }
}

/* Accessibility & Focus Styles */
.focus-visible,
*:focus-visible {
    outline: 3px solid var(--dnagenics-teal);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.3);
}

[role="button"]:focus,
button:focus,
a:focus {
    outline: 2px solid var(--dnagenics-teal);
    outline-offset: 2px;
}

/* Skip to content link for screen readers */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--dnagenics-teal);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 100;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: 0;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid currentColor;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}

/* Utility Classes */
.text-dnagenics-teal {
    color: var(--dnagenics-teal) !important;
}

.text-dnagenics-lime {
    color: var(--dnagenics-lime) !important;
}

.bg-dnagenics-teal-light {
    background-color: rgba(0, 180, 216, 0.1) !important;
}

.border-dnagenics-teal {
    border-color: var(--dnagenics-teal) !important;
}

/* Print Styles */
@media print {
    /* Hide non-essential elements */
    #content-wrapper .btn,
    #btnExportCSV,
    #btnPrint,
    .ai-assistant-section,
    .faq-accordion,
    .card-header[data-toggle="collapse"],
    nav,
    footer,
    .breadcrumb,
    .skip-to-content {
        display: none !important;
    }

    /* Ensure content is visible */
    body {
        background: white;
        color: black;
        font-size: 12pt;
    }

    /* Page breaks */
    .region-card,
    .understanding-section,
    .at-a-glance-card {
        page-break-inside: avoid;
    }

    .section-header {
        page-break-after: avoid;
    }

    /* Expand all collapsed sections for print */
    .collapse {
        display: block !important;
        height: auto !important;
    }

    /* Optimize charts for print */
    .chart-container {
        height: 300px !important;
    }

    /* Optimize map for print */
    .mapcontinental {
        height: 400px !important;
        page-break-inside: avoid;
    }

    /* Ensure good contrast */
    .card {
        border: 1px solid #333 !important;
        box-shadow: none !important;
    }

    /* Print headers */
    .section-header h3 {
        color: #000 !important;
        border-bottom: 2px solid #000;
        padding-bottom: 10px;
    }

    /* Composition table */
    .composition-table {
        font-size: 10pt;
    }

    .composition-table th,
    .composition-table td {
        border: 1px solid #ddd !important;
        padding: 5px !important;
    }

    /* At-a-glance card */
    .at-a-glance-card {
        border: 2px solid #000 !important;
        background: #f9f9f9 !important;
    }

    /* Top regions grid */
    .top-regions-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 10px !important;
    }

    .top-region-item {
        border: 1px solid #333 !important;
        page-break-inside: avoid;
    }

    /* Region cards */
    .region-card {
        border: 1px solid #333 !important;
        margin-bottom: 20px;
    }

    .region-card-image {
        height: 150px;
    }

    /* Hide decorative elements */
    .region-card-image::after {
        display: none;
    }

    /* Print URLs for links */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #666;
    }

    /* Don't print URLs for buttons and modal triggers */
    [data-toggle]:after,
    [data-target]:after {
        content: "" !important;
    }
}

/* ========================================
   Scroll Progress Indicator
======================================== */
.scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, var(--dnagenics-teal, #237465) 0%, var(--dnagenics-primary, #00b4d8) 100%);
    z-index: 9999;
    transition: width 0.1s ease-out;
    box-shadow: 0 1px 3px rgba(35, 116, 101, 0.3);
}

/* ========================================
   Page Navigation Dots
======================================== */
.page-nav {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 15px 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.page-nav a {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #d1d5db;
    transition: all 0.3s ease;
    position: relative;
    cursor: pointer;
    display: block;
}

.page-nav a:hover {
    background: var(--dnagenics-primary, #00b4d8);
    transform: scale(1.3);
}

.page-nav a.active {
    background: var(--dnagenics-teal, #237465);
    box-shadow: 0 0 0 3px rgba(35, 116, 101, 0.3);
}

.page-nav a[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translateY(-50%);
    background: #1a1a2e;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
}

.page-nav a[data-tooltip]::after {
    content: '';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: #1a1a2e;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.page-nav a:hover[data-tooltip]::before,
.page-nav a:hover[data-tooltip]::after {
    opacity: 1;
    visibility: visible;
}

/* Enhanced Page Nav (for scrollable sections) */
.page-nav.enhanced {
    gap: 14px;
    padding: 18px 12px;
    right: 24px;
}

.page-nav.enhanced a {
    width: 14px;
    height: 14px;
}

.page-nav.enhanced a.active {
    width: 16px;
    height: 16px;
    box-shadow: 0 0 0 4px rgba(35, 116, 101, 0.25);
}

/* Show labels on larger screens for enhanced nav */
@media (min-width: 1400px) {
    .page-nav.enhanced a[data-tooltip]::before {
        opacity: 0.7;
        visibility: visible;
        font-size: 11px;
        padding: 4px 10px;
    }
    
    .page-nav.enhanced a[data-tooltip]::after {
        opacity: 0.7;
        visibility: visible;
    }
    
    .page-nav.enhanced a:hover[data-tooltip]::before,
    .page-nav.enhanced a:hover[data-tooltip]::after,
    .page-nav.enhanced a.active[data-tooltip]::before,
    .page-nav.enhanced a.active[data-tooltip]::after {
        opacity: 1;
    }
}

/* ========================================
   Back to Top Button
======================================== */
.back-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--dnagenics-teal, #237465) 0%, var(--dnagenics-primary-dark, #1a5a4e) 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 15px rgba(35, 116, 101, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.back-to-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(35, 116, 101, 0.5);
}

.back-to-top-btn:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--dnagenics-teal, #237465);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 10000;
}

.skip-link:focus {
    top: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .page-nav {
        display: none;
    }
    
    .back-to-top-btn {
        right: 20px;
        bottom: 20px;
        width: 45px;
        height: 45px;
    }
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    
    .scroll-progress-bar {
        transition: none;
    }
    
    .page-nav a {
        transition: none;
    }
    
    .back-to-top-btn {
        transition: none;
    }
}

/* ========================================
   HERITAGE SUMMARY CARD - Elegant Dark Premium Design
   ======================================== */
#heritageSummaryCard.sao-summary-card {
    background: var(--sao-charcoal);
    border: 1px solid rgba(201,162,39,0.25);
    border-top: 3px solid var(--sao-gold);
    border-radius: var(--sao-radius-md);
    overflow: hidden;
    max-width: 560px;
    margin: 0 auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(201,162,39,0.1);
}

.sao-summary-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid rgba(201,162,39,0.2);
}

.sao-summary-logo img {
    opacity: 0.9;
    height: 16px;
    width: auto;
    max-width: 60px;
    max-height: 16px;
}

.sao-summary-title h3 {
    font-family: var(--sao-font-serif);
    font-size: 1.25rem;
    color: var(--sao-white);
    margin: 0;
    font-weight: 600;
}

.sao-summary-title span {
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.75);
    display: block;
    margin-top: 4px;
}

.sao-summary-body {
    padding: 2rem;
    background: transparent;
}

.sao-summary-stats {
    display: flex;
    justify-content: space-around;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.sao-summary-stat {
    text-align: center;
    flex: 1;
    min-width: 80px;
}

.sao-summary-stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 600;
    color: var(--sao-gold-light);
    font-family: var(--sao-font-serif);
}

.sao-summary-stat-value.sao-gold {
    color: var(--sao-gold);
}

.sao-summary-stat-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.45);
    margin-top: 4px;
    display: block;
}

.sao-summary-section {
    margin-bottom: 1.5rem;
}

.sao-summary-section h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.45);
    margin: 0 0 1rem;
    font-weight: 600;
}

.sao-summary-regions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.sao-summary-region {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: transparent;
    border-radius: 0;
    border: none;
    position: relative;
}

.sao-summary-region-rank {
    position: static;
    background: transparent;
    color: var(--sao-gold);
    font-family: var(--sao-font-serif);
    font-size: 1rem;
    font-weight: 700;
    width: 28px;
    flex-shrink: 0;
    padding: 0;
    border-radius: 0;
    z-index: 0;
}

.sao-summary-region-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
}

.sao-summary-region-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sao-gold) 0%, var(--sao-ochre) 100%);
    border-radius: 3px;
    transition: width 0.6s ease;
}

.sao-summary-region-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    min-width: 140px;
}

.sao-summary-region-name {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sao-summary-region-pct {
    font-size: 0.875rem;
    color: var(--sao-gold-light);
    font-weight: 600;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.sao-summary-highlights {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1.25rem 0;
    border-top: 1px solid rgba(255,255,255,0.08);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 1.5rem;
}

.sao-summary-highlight {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.875rem 1rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--sao-radius-sm);
}

.sao-summary-highlight i {
    color: var(--sao-gold);
    font-size: 1rem;
    flex-shrink: 0;
}

.sao-summary-hl-label {
    display: block;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255,255,255,0.45);
    margin-bottom: 2px;
}

.sao-summary-hl-value {
    font-size: 0.875rem;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
}

.sao-summary-timespan {
    background: transparent;
    text-align: center;
    padding: 1.5rem 0 0.5rem;
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sao-summary-timespan strong {
    color: var(--sao-gold-light);
    font-weight: 600;
}

.sao-summary-footer {
    padding: 1rem 2rem;
    background: rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255,255,255,0.06);
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.35);
}

.sao-summary-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.sao-summary-btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--sao-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--sao-transition);
    border: 2px solid;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--sao-font-sans);
}

.sao-summary-btn i {
    font-size: 0.875rem;
}

.sao-summary-btn-outline {
    background: transparent;
    border-color: rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.8);
}

.sao-summary-btn-outline:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.6);
    color: white;
}

.sao-summary-btn-primary {
    background: transparent;
    border-color: var(--sao-gold);
    color: var(--sao-gold-light);
}

.sao-summary-btn-primary:hover {
    background: var(--sao-gold);
    color: var(--sao-charcoal);
    transform: translateY(-2px);
    box-shadow: var(--sao-shadow-md);
}

/* Print Styles */
@media print {
    .sao-summary-card {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
    
    .sao-summary-actions {
        display: none;
    }
    
    .sao-summary-header,
    .sao-summary-footer,
    .sao-summary-timespan {
        background: #f5f5f5 !important;
        color: #333 !important;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sao-summary-card {
        margin: 0 1rem;
        max-width: none;
    }
    
    .sao-summary-header {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
        padding: 1.25rem 1.5rem;
    }
    
    .sao-summary-body {
        padding: 1.5rem;
    }
    
    .sao-summary-stats {
        gap: 0.5rem;
    }
    
    .sao-summary-stat {
        min-width: 70px;
    }
    
    .sao-summary-stat-value {
        font-size: 1.5rem;
    }
    
    .sao-summary-regions {
        gap: 0.75rem;
    }
    
    .sao-summary-region {
        flex-wrap: wrap;
    }
    
    .sao-summary-region-bar {
        order: 3;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .sao-summary-region-info {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        min-width: auto;
        flex: 1;
    }
    
    .sao-summary-region-pct {
        margin-left: 0;
    }
    
    .sao-summary-highlights {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .sao-summary-actions {
        flex-direction: column;
    }
    
    .sao-summary-btn {
        width: 100%;
        justify-content: center;
    }
}
