/* ============================================
   COLLAPSIBLE HERITAGE CARDS - Toggle on Click
   Replace your existing heritage card styles
   ============================================ */

/* Heritage Result Cards - Collapsed by Default */
.heritage-result {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    
    /* Collapsed state - thin horizontal strip */
    display: grid;
    grid-template-columns: 50px 1fr auto;
    gap: 15px;
    align-items: center;
    min-height: 60px;
    max-height: 60px;
}

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

/* Expanded state */
.heritage-result.expanded {
    max-height: 500px;
    min-height: auto;
    padding: 20px;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    cursor: default;
}

.heritage-result:hover:not(.expanded) {
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.heritage-result.expanded:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Collapsed View - Single Line Summary */
.result-summary {
    display: flex;
    align-items: center;
    gap: 15px;
    grid-column: 1 / -1;
}

.heritage-result.expanded .result-summary {
    display: none;
}

.summary-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

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

.summary-avatar-initials {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.summary-content {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    font-size: 0.85rem;
    color: #2c3e50;
    flex-wrap: wrap;
}

.summary-name {
    font-weight: 600;
    font-size: 0.95rem;
    flex: 0 0 14%;  /* Name takes 14% */
}

.summary-info {
    display: flex;
    gap: 15px;
    flex-wrap: nowrap;
}

.summary-item {
    display: flex;
    gap: 12px;
    white-space: nowrap;
    margin-left: 1%;  /* Small gap to reach 15% total */
}

.summary-label {
    color: #7f8c8d;
    font-weight: 500;
}

.summary-value {
    color: #2c3e50;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Fixed widths for alignment */
.summary-item:nth-child(1) .summary-value {
    min-width: 16ch;  /* Village: 16 characters */
    max-width: 16ch;
}

.summary-item:nth-child(2) .summary-value {
    min-width: 9ch;  /* Ethnicity: 8.8 characters */
    max-width: 9ch;
}

.summary-item:nth-child(3) .summary-value {
    min-width: 4.5ch;   /* Y-DNA: 4.5 characters */
    max-width: 4.5ch;
}

.summary-item:nth-child(4) .summary-value {
    min-width: 4.5ch;   /* mtDNA: 4.5 characters */
    max-width: 4.5ch;
}

.summary-item:nth-child(5) .summary-value {
    min-width: 13ch;  /* Date: "Jun 25, 2024" */
    max-width: 13ch;
}

.expand-icon {
    color: #7f8c8d;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.new-badge {
    height: 2.8em;  /* Matches text line height 1.2em x 2.333 */
    width: auto;
    margin-left: 30px;
    flex-shrink: 0;
    background: var(--bg-white);
    border-radius: 50%;  /* Optional: make it circular */
    padding: 2px;  /* Optional: add padding around image */
}

.heritage-result.expanded .expand-icon {
    transform: rotate(180deg);
}

/* Expanded View - Full Details */
.result-details {
    display: none;
}

.heritage-result.expanded .result-details {
    display: block;
}

/* Result Header */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f8f9fa;
    gap: 20px;
}

.family-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
}

.family-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
    border: 2px solid #fff;
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.family-names {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.family-name-english {
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 600;
    white-space: nowrap;
}

.family-name-circassian {
    color: #34495e;
    font-size: 1rem;
    font-style: italic;
    padding: 3px 10px;
    background: linear-gradient(135deg, #f8f9fa, #ecf0f1);
    border-radius: 6px;
    border-left: 4px solid var(--male-color);
    white-space: nowrap;
}

.basic-info {
    display: flex;
    flex-wrap: nowrap;
    gap: 15px;
    margin-left: auto;
}

.info-item {
    background: #f8f9fa;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.85rem;
    color: #5d6d7e;
}

.info-label {
    font-weight: 600;
    color: #2c3e50;
}

.test-id-date {
    text-align: right;
    color: #7f8c8d;
    font-size: 0.85rem;
}

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

.haplogroup-section {
    background: linear-gradient(135deg, #f8f9fa, #ecf0f1);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #d1d9e6;
    position: relative;
}

.haplogroup-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 3px;
}

.haplogroup-section.y-dna::before {
    background: var(--male-color);
}

.haplogroup-section.mt-dna::before {
    background: var(--female-color);
}

.haplogroup-title {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
}

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

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

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

.genetic-marker {
    margin-bottom: 10px;
    padding: 8px;
    background: white;
    border-radius: 6px;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.genetic-marker:last-child {
    margin-bottom: 0;
}

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

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

.marker-label {
    font-size: 0.75rem;
    color: #7f8c8d;
    text-transform: uppercase;
    font-weight: 600;
    white-space: nowrap;
    min-width: 110px;
}

.marker-value {
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 500;
    font-family: 'Courier New', monospace;
}

/* Action Buttons */
.result-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #ecf0f1;
}

.action-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
}

.action-btn.heritage {
    background: linear-gradient(135deg, var(--male-color), var(--female-color));
}

.action-btn.secondary {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

.action-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.action-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Feed Container - centered and responsive */
.feed-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto; /* centers it */
    padding: 0 16px; /* adds breathing room on small screens */
    box-sizing: border-box;
}

/* Responsive */
@media (max-width: 768px) {
    .genetic-data {
        grid-template-columns: 1fr;
    }
    
    .result-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .summary-content {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}