/**
 * Circassian DNA Heritage Feed Styles
 * Complete stylesheet for repository structure
 * Balanced version - not too dark, not too light
 * Based on Circassian DNA Project color codes
 */

/* Color Variables - Complete Palette */
:root {
    /* Primary gender colors */
    --male-color: #477571;      /* Dark teal for male/Y-DNA */
    --female-color: #7b68ee;    /* Medium slate blue for female/mtDNA */

    /* Backgrounds - Updated to light brown theme */
    --bg-white: #ffffff;
    --bg-light: #f0f2f2;
    --bg-light-light: #d8dedf;
    --bg-medium: #e0f3f3;
    --bg-card: #fafbfb;
    --bg-dark: #687b7b;
    --bg-brown: #DCD3C3;        /* Light brown from website */
    --bg-brown-light: #EAE4D8;  /* Lighter brown */

    /* Text colors */
    --text-primary: #151919;
    --text-secondary: #646e6e;
    --text-muted: #a0b0b0;
    
    /* Borders */
    --border-light: #d2d7d7;
    --border-medium: #b4bdbd;
    --border-dark: #687b7b;

    /* Brand / accents */
    --brand-header: #154341;
    --accent-info: #3498db;
    --accent-danger: #e74c3c;
    --accent-danger-hover: #c0392b;
    --accent-warning: #ffc107;
    --accent-warning-hover: #ffb300;

    /* Hover for male primary to avoid blue fallback */
    --male-color-hover: #3b5f5b; /* a tad darker than #477571 */
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*:focus {
    outline: 2px solid var(--male-color);
    outline-offset: 2px;
}

/* Title display control */
.desktop-title {
    display: inline;
}

.mobile-title {
    display: none;
}

/* Body - Brown background */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-brown);  /* Light brown #DCD3C3 */
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    color: var(--text-primary);
    color-scheme: light dark;
}

/* Statistics Bar - Prominent Header */
.stats-bar {
    background: var(--male-color-hover);
    color: #fff;
    padding: 12px 20px;
    display: grid;
    grid-template-columns: repeat(5, 1fr); /* 5 equal-width columns */
    text-align: center;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background 0.3s ease;
    align-items: center;
    gap: 10px; /* optional spacing between columns */
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

.stat-number {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Hover effect (optional) */
.stats-bar:hover {
    background: var(--male-color-hover, #2d6a8c);
}

/* Responsive layout for narrow screens */
@media (max-width: 600px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr); /* 2x2 grid on small screens */
        gap: 12px 8px;
        padding: 16px;
    }

    .stat-number {
        font-size: 1.4rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }
}

/* Tab Navigation */
.tab-navigation {
    background: var(--bg-white);
    display: flex;
    gap: 0;
    padding: 0;
    border-bottom: 2px solid var(--border-light);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 16px 20px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    transition: background 0.2s ease;
}

.tab-btn:hover {
    background: var(--bg-light);
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--male-color);
    font-weight: 600;
}

.tab-btn.active::after {
    background: var(--male-color);
}

.tab-icon {
    font-size: 1.1rem;
}

.tab-label {
    display: inline;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Map Sub-Navigation */
.map-tabs {
    background: var(--bg-light);
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
}

.map-tab-btn {
    background: var(--bg-white);
    border: 2px solid var(--border-medium);
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.map-tab-btn:hover {
    background: var(--bg-medium);
    border-color: var(--male-color);
}

.map-tab-btn.active {
    background: var(--male-color);
    color: white;
    border-color: var(--male-color);
}

/* Map Containers */
.map-container {
    display: none;
    position: relative;
}

.map-container.active {
    display: block;
}

.map-view {
    height: 600px;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    font-size: 0.85rem;
    max-width: 200px;
}

.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    display: flex;
    gap: 12px;
}

.map-controls label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

/* Statistics and About Content */
.stats-container,
.about-container {
    background: var(--bg-white);
    padding: 40px;
    border-radius: 8px;
    max-width: 1200px;
    margin: 20px auto;
}

.stats-container h2,
.about-container h2 {
    color: var(--male-color);
    margin-bottom: 20px;
}

.about-container p {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 15px;
}

/* Support Section */
.support-section {
    margin-top: 40px;
    padding: 30px;
    background: var(--bg-light);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.support-section h3 {
    color: var(--male-color);
    margin-bottom: 15px;
    font-size: 1.3em;
}

.support-section p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.support-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.support-link {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background: var(--bg-white);
    border: 2px solid var(--border-light);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.support-link:hover {
    border-color: var(--male-color);
    box-shadow: 0 2px 8px rgba(71, 117, 113, 0.2);
    transform: translateY(-2px);
}

.support-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.support-link span {
    font-weight: 500;
    font-size: 1.05em;
}

/* FamilyTreeDNA styled text logo */
.ftdna-logo {
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: linear-gradient(135deg, #2c5282 0%, #1a365d 100%);
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ftdna-text {
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95em;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.ftdna-link:hover .ftdna-logo {
    background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 24px;
}

.chart-card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.chart-card h3 {
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 16px;
    text-align: center;
}

.chart-card canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.chart-canvas-wrap {
    position: relative;
    height: 300px;
}

.chart-stats {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Sub-Ethnicity: donut left, collapsible legend right — mirrors Ethnicity layout */
.sub-ethnicity-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sub-ethnicity-chart-container {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    height: 300px;
}

.sub-ethnicity-legend {
    flex: 0 0 130px;
    width: 130px;
    padding-top: 4px;
    max-height: 300px;
    overflow-y: auto;
}

.sub-ethnicity-legend .legend-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    background: none;
    border: none;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1;
    font-weight: 600;
    color: var(--text-primary);
    text-align: left;
    transition: background 0.15s;
}

.sub-ethnicity-legend .legend-toggle:hover {
    background: var(--bg-light);
}

.sub-ethnicity-legend .legend-color {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 2px;
    flex-shrink: 0;
}

.sub-ethnicity-legend .legend-chevron {
    margin-left: auto;
    flex-shrink: 0;
    align-self: center;
    line-height: 1;
    font-size: 0.6rem;
    transition: transform 0.2s;
    color: var(--text-secondary);
}

.sub-ethnicity-legend .legend-group.open .legend-chevron {
    transform: rotate(180deg);
}

.sub-ethnicity-legend .legend-count {
    font-weight: 400;
    color: var(--text-secondary);
    line-height: 1;
}

.sub-ethnicity-legend .legend-subs {
    display: none;
    padding: 2px 0 6px 24px;
}

.sub-ethnicity-legend .legend-group.open .legend-subs {
    display: block;
}

.sub-ethnicity-legend .legend-sub-row {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.9;
}

/* Responsive tabs */
@media (max-width: 768px) {
    .tab-label {
        display: none;
    }
    
    .tab-icon {
        font-size: 1.3rem;
    }
    
    .map-tabs {
        justify-content: center;
    }
    
    .map-view {
        height: 400px;
    }
    
    .map-legend {
        bottom: 10px;
        right: 10px;
        font-size: 0.75rem;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid .chart-card {
        grid-column: 1 / -1;
    }

    /* Stack sub-ethnicity chart above legend on mobile */
    .sub-ethnicity-wrap {
        flex-direction: column;
    }

    .sub-ethnicity-legend {
        flex: none;
        width: 100%;
        max-height: 160px;
    }
    
    .chart-card.full-width {
        grid-column: 1;
    }
    
    .support-section {
        padding: 20px;
    }
    
    .support-logo {
        height: 32px;
    }
    
    .support-link {
        padding: 12px 16px;
    }
}

/* Filter bar - white background for contrast */
.filter-bar {
    background: var(--bg-white);
    padding: 18px 20px;
    border-bottom: 2px solid var(--border-light);
}

.filter-row {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.filter-dropdowns {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    align-items: center;
}

.filter-select {
    background: white;
    border: 2px solid var(--border-medium);
    padding: 10px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    min-width: 170px;
    height: 44px;
}

/* Two-column clade dropdown layout */
.clade-options {
    min-width: 200px;
    padding: 12px;
}

.clade-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.clade-column {
    display: flex;
    flex-direction: column;
}

.clade-column-header {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    margin-bottom: 4px;
    background: var(--bg-light);
    border-radius: 4px;
}

.clade-option {
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s ease;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.clade-option.reset-option {
    justify-content: center;
    font-weight: 600;
    margin-bottom: 8px;
    background: var(--bg-light);
}

.clade-option.reset-option:hover {
    background: var(--border-light);
}

.clade-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--male-color);
}

.clade-option:hover {
    background: var(--bg-medium);
}

.clade-option.selected {
    background: rgba(71, 117, 113, 0.15);
    color: var(--male-color);
    font-weight: 500;
}

/* Two-column location dropdown layout */
.location-options {
    min-width: 420px;
    padding: 12px;
}

.location-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.location-column {
    display: flex;
    flex-direction: column;
}

.location-column-header {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    margin-bottom: 4px;
    background: var(--bg-light);
    border-radius: 4px;
}

.location-option {
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s ease;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.location-option.reset-option {
    justify-content: center;
    font-weight: 600;
    margin-bottom: 8px;
    background: var(--bg-light);
}

.location-option.reset-option:hover {
    background: var(--border-light);
}

.location-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--male-color);
}

.ethnicity-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--male-color);
}

.custom-option.reset-option {
    justify-content: center;
    font-weight: 600;
    margin-bottom: 8px;
    background: var(--bg-light);
}

.custom-option.reset-option:hover {
    background: var(--border-light);
}

.location-option:hover {
    background: var(--bg-medium);
}

.location-option.selected {
    background: rgba(71, 117, 113, 0.15);
    color: var(--male-color);
    font-weight: 500;
}

/* Custom dropdown for ethnicity filter with flags */
.custom-dropdown {
    position: relative;
    min-width: 200px;
}

.custom-select {
    background: white;
    border: 2px solid var(--border-medium);
    padding: 10px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    height: 44px;
}

.custom-select:hover {
    border-color: var(--male-color);
    background: var(--bg-medium);
}

.custom-select.active {
    border-color: var(--male-color);
    box-shadow: 0 0 0 3px rgba(71, 117, 113, 0.15);
}

.dropdown-arrow {
    margin-left: 8px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.custom-select.active .dropdown-arrow {
    transform: rotate(180deg);
}

.custom-options {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--border-medium);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 350px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.custom-options.active {
    display: block;
}

.custom-option {
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.custom-option.main-option {
    font-weight: 600;
    position: relative;
    padding-right: 30px;
}

.custom-option.main-option .expand-icon {
    position: absolute;
    right: 10px;
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.custom-option.main-option.expanded .expand-icon {
    transform: rotate(180deg);
}

.custom-option.sub-option {
    padding-left: 44px;
    font-size: 0.8rem;
    display: none;
}

.custom-option.sub-option.visible {
    display: flex;
}

.custom-option:hover {
    background: var(--bg-light);
}

.custom-option.selected {
    background: var(--male-color-hover);
    color: white;
}

.option-flag {
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.option-text {
    flex: 1;
}

.option-text.main {
    font-weight: 600;
}

.option-text.sub {
    padding-left: 30px;
    font-weight: 400;
}

/* Specific widths for each filter */
#stateFilter {
    min-width: 75px; /* 40% less than 160px */
}

#yCladeFilter {
    min-width: 75px; /* 40% less than 160px */
}

#mtCladeFilter {
    min-width: 75px; /* 40% less than 160px */
}

.filter-select:hover {
    border-color: var(--male-color);
    background: var(--bg-medium);
}

.filter-select:focus {
    border-color: var(--male-color);
    box-shadow: 0 0 0 3px rgba(71, 117, 113, 0.15);
    outline: none;
}

.sort-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.sort-select {
    background: white;
    border: 2px solid var(--border-medium);
    padding: 10px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s ease;
    height: 44px;
}

.sort-select:hover {
    border-color: var(--male-color);
    background: var(--bg-medium);
}

.sort-select:focus {
    border-color: var(--male-color);
    box-shadow: 0 0 0 3px rgba(71, 117, 113, 0.15);
}

/* Legacy filter buttons - keep for backward compatibility */
.filter-section {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    background: white;
    border: 2px solid var(--border-medium);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-weight: 500;
    transition: background 0.3s ease;
}

.filter-btn:hover {
    background: var(--bg-medium);
    border-color: var(--male-color);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.filter-btn.active,
.filter-btn[aria-pressed="true"] {
    background: var(--male-color);
    color: white;
    border-color: var(--male-color);
    box-shadow: 0 3px 10px rgba(71, 117, 113, 0.3);
    font-weight: 600;
}

/* Feed Content - subtle background */
.feed-content {
    height: 70vh;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-light);
}

.feed-content::-webkit-scrollbar {
    width: 10px;
}

.feed-content::-webkit-scrollbar-track {
    background: var(--border-light);
    border-radius: 10px;
}

.feed-content::-webkit-scrollbar-thumb {
    background: var(--female-color);
    border-radius: 10px;
}

.feed-content::-webkit-scrollbar-thumb:hover {
    background: var(--bg-dark);
}

/* Heritage Result Cards - more depth */
.heritage-result {
    background: var(--bg-white);
    border: 1px solid var(--border-medium);
    border-radius: 12px;
    margin-bottom: 20px;
    padding: 25px;
    box-shadow: 0 3px 12px rgba(21, 25, 25, 0.08);
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.heritage-result::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--male-color), var(--female-color));
}

.heritage-result:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(71, 117, 113, 0.15);
    border-color: var(--male-color);
}

/* Result Header */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--bg-light);
}

.header-flag {
  height: 1.25em;
  vertical-align: middle;
  margin-right: 8px;
  width: auto;
}


/* Family avatar - solid colors matching gender */
.family-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.family-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.family-avatar-initials {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.4rem;
    background: var(--bg-dark);
}

.family-name-english {
    color: var(--text-primary);
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.family-name-native {
    color: var(--male-color);
    font-size: 1.05rem;
    font-style: italic;
    margin-bottom: 10px;
    padding: 6px 12px;
    background: var(--bg-medium);
    border-radius: 6px;
    border-left: 3px solid var(--male-color);
}

.family-name-russian {
    color: var(--male-color);
    font-size: 1.05rem;
    font-style: italic;
    margin-bottom: 10px;
    padding: 6px 12px;
    background: var(--bg-medium);
    border-radius: 6px;
    border-left: 3px solid var(--male-color);
}

.basic-info {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.info-item {
    background: var(--bg-light);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.info-label {
    font-weight: 600;
    color: var(--text-primary);
}

.test-id-date {
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Genetic Data Section - clearer separation */
.genetic-data {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.haplogroup-section {
    background: var(--bg-card);
    padding: 18px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    position: relative;
}

.haplogroup-section.y-dna {
    border-top: 3px solid var(--male-color);
    background: linear-gradient(180deg, var(--bg-medium) 0%, var(--bg-card) 10%);
}

.haplogroup-section.mt-dna {
    border-top: 3px solid var(--female-color);
    background: linear-gradient(180deg, var(--bg-light) 0%, var(--bg-card) 10%);
}

.haplogroup-title {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1.05rem;
    font-weight: 600;
}

.y-dna-title {
    color: var(--male-color);
}

.mt-dna-title {
    color: var(--female-color);
}

.haplogroup-icon {
    margin-right: 8px;
    font-size: 1.2rem;
}

.genetic-marker {
    margin-bottom: 10px;
    padding: 10px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid;
    transition: all 0.2s ease;
}

.y-dna .genetic-marker {
    border-left-color: var(--male-color);
}

.mt-dna .genetic-marker {
    border-left-color: var(--female-color);
}

.genetic-marker:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.marker-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 3px;
    letter-spacing: 0.5px;
}

.marker-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

/* Action Buttons - Solid colors instead of gradients */
.result-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

.action-btn {
    background: var(--bg-dark);
    color: white;
    border: none;
    padding: 8px 10px;
    border-radius: 16px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

.action-btn.y-dna-btn {
    background: var(--male-color);  /* Solid green/teal */
}

.action-btn.mt-dna-btn {
    background: var(--female-color);  /* Solid purple */
}

/* Tree button color variations for Y-DNA (males) */
.action-btn.y-dna-btn.tree-classic {
    background: var(--male-color) !important;  /* Keep original dark teal */
}

.action-btn.y-dna-btn.tree-time {
    background: #20B2AA !important;  /* Light sea green */
}

.action-btn.y-dna-btn.tree-group {
    background: #90EE90 !important;  /* Light green — contrast vs #2c3e50: ~7.1:1 (WCAG AA ✓) */
    color: #2c3e50 !important;
}

/* Tree button color variations for mtDNA (females) */
.action-btn.mt-dna-btn.tree-classic {
    background: var(--female-color) !important;  /* Keep original purple */
}

.action-btn.mt-dna-btn.tree-time {
    background: #87CEEB !important;  /* Light sea blue */
}

.action-btn.mt-dna-btn.tree-group {
    background: #ADD8E6 !important;  /* Light blue — contrast vs #2c3e50: ~6.8:1 (WCAG AA ✓) */
    color: #2c3e50 !important;
}

.action-btn.secondary {
    background: var(--text-secondary);  /* Solid gray */
}

.action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    filter: brightness(1.1);
}

.action-btn.disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background: var(--border-medium) !important;
}

a.action-btn {
    display: inline-block;
    text-decoration: none;
    line-height: 1.2;
}

/* Unified Spinner */
.spinner-container {
  text-align: center;
  padding: 60px;
  color: var(--text-secondary);
}

.spinner {
  border: 4px solid var(--border-light);
  border-top: 4px solid var(--male-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.loading-spinner {
  display: none;
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

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


/* Responsive */
@media (max-width: 768px) {
    .genetic-data {
        grid-template-columns: 1fr;
    }
    
    .result-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .filter-bar {
        flex-direction: column;
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .result-actions {
        grid-template-columns: 1fr;
    }
}

/* Main Container */
.feed-container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--bg-light);
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(21, 25, 25, 0.2);
    overflow: hidden;
}

/* Search Bar */
.search-container {
    position: relative;
    min-width: 180px;
    flex: 1;
    max-width: 240px;
}

.search-input {
    width: 100%;
    padding: 10px 45px 10px 18px;
    font-size: 0.85rem;
    border: 2px solid var(--border-medium);
    border-radius: 20px;
    transition: all 0.3s ease;
    background: var(--bg-light);
    height: 44px;
}

.search-input:focus {
    outline: none;
    border-color: var(--male-color);
    box-shadow: 0 0 0 3px rgba(71, 117, 113, 0.15);
    background: white;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.clear-search-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-secondary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.clear-search-btn:hover {
    background: var(--accent-danger);
    transform: translateY(-50%) scale(1.1);
}

/* Header Section - solid dark teal */
.feed-header {
    background: var(--brand-header);
    color: white;
    padding: 40px 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.feed-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 300;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.feed-header .flag-icon {
    height: 30px;
    width: auto;
    max-width: 45px;
    object-fit: contain;
    display: block;
}

.feed-header p {
    opacity: 0.9;
    font-size: 1.05rem;
    color: var(--bg-medium);
}

.spinner-container h3 {
    margin-bottom: 10px;
}

.spinner-container p {
    color: var(--text-secondary);
}

.retry-btn {
  margin-top: 20px;
  padding: 10px 20px;
  background: var(--accent-warning);
  border: none;
  border-radius: 5px;
  cursor: pointer;
  color: #000;
  font-weight: 500;
  transition: background 0.3s ease, transform 0.1s ease; /* smooth hover + slight click effect */
}

.retry-btn:hover {
  background: var(--accent-warning-hover);
  transform: translateY(-1px); /* subtle lift on hover */
}

.retry-btn:active {
  transform: translateY(0); /* reset on click */
}

/* Optional: dark theme support */
@media (prefers-color-scheme: dark) {
  .retry-btn {
    background: var(--accent-warning);
    color: #000;
  }
  .retry-btn:hover {
    background: var(--accent-warning-hover);
  }
}


.primary-btn {
  background: var(--accent-info);
  color: #fff;
}

.primary-btn:hover {
  filter: brightness(1.05);
}

.danger-btn {
  background: var(--accent-danger);
  color: #fff;
}

.danger-btn:hover {
  background: var(--accent-danger-hover);
}

/* Responsive design for filter dropdowns */
@media (max-width: 1024px) {
    .filter-dropdowns {
        flex-wrap: wrap;
    }
    
    .filter-select {
        min-width: 45%;
    }
}

@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-dropdowns {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-select {
        width: 100%;
        min-width: auto;
    }
    
    .sort-section {
        width: 100%;
        justify-content: space-between;
    }
}
