﻿/** * Copyright (c) 2026 DNA Genics, S.L. All rights reserved.
 * 
 * Haplogroup Sample Drawer - Shared styles for mtDNA and Y-DNA ancient sample detail drawers.
 * Follows Modal Animation Standards: slide-up on mobile, slide-in from right on desktop.
 */

/* ========================================
   DRAWER CONTAINER & BACKDROP
   ======================================== */

.haplo-drawer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    visibility: hidden;
    pointer-events: none;
}

.haplo-drawer.open {
    visibility: visible;
    pointer-events: auto;
}

.haplo-drawer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.haplo-drawer.open .haplo-drawer-backdrop {
    opacity: 1;
}

/* ========================================
   DRAWER PANEL - DESKTOP (Slide from Right)
   ======================================== */

.haplo-drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 50vw;
    max-width: 600px;
    height: 100vh;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 50%, #0f0f1a 100%);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px 0 0 16px;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.4);
}

.haplo-drawer.open .haplo-drawer-panel {
    transform: translateX(0);
}

/* ========================================
   DRAWER PANEL - MOBILE (Slide from Bottom)
   ======================================== */

@media (max-width: 768px) {
    .haplo-drawer-backdrop {
        background: rgba(0, 0, 0, 0.3);
    }

    .haplo-drawer-panel {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: none;
        height: 90vh;
        border-radius: 24px 24px 0 0;
        border-left: none;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        transform: translateY(100%);
        padding-bottom: env(safe-area-inset-bottom, 20px);
    }

    .haplo-drawer.open .haplo-drawer-panel {
        transform: translateY(0);
    }
}

/* ========================================
   DRAWER HEADER
   ======================================== */

.haplo-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.haplo-drawer-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.haplo-drawer-title i {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
}

.haplo-drawer-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.haplo-drawer-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.4);
}

/* Mobile drag handle */
@media (max-width: 768px) {
    .haplo-drawer-header::before {
        content: '';
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 2px;
    }

    .haplo-drawer-header {
        padding-top: 28px;
        position: relative;
    }
}

/* ========================================
   DRAWER BODY
   ======================================== */

.haplo-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.haplo-drawer-body::-webkit-scrollbar {
    width: 6px;
}

.haplo-drawer-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.haplo-drawer-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* ========================================
   DRAWER CONTENT SECTIONS
   ======================================== */

.haplo-drawer-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Portrait Section */
.haplo-drawer-portrait {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.haplo-drawer-portrait-img {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
}

.haplo-drawer-portrait-info {
    flex: 1;
}

.haplo-drawer-sample-id {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 4px;
}

.haplo-drawer-sample-name {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 8px;
}

.haplo-drawer-sex-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.haplo-drawer-sex-badge.male {
    background: rgba(30, 64, 175, 0.3);
    color: #93c5fd;
    border: 1px solid rgba(30, 64, 175, 0.5);
}

.haplo-drawer-sex-badge.female {
    background: rgba(157, 23, 77, 0.3);
    color: #f9a8d4;
    border: 1px solid rgba(157, 23, 77, 0.5);
}

/* Section Cards */
.haplo-drawer-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 16px;
}

.haplo-drawer-section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.haplo-drawer-section-title i {
    font-size: 0.9rem;
}

/* Data Rows */
.haplo-drawer-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.haplo-drawer-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.haplo-drawer-row:first-of-type {
    padding-top: 0;
}

.haplo-drawer-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
}

.haplo-drawer-value {
    font-size: 0.9rem;
    color: #ffffff;
    text-align: right;
    word-break: break-word;
}

/* Haplogroup Display */
.haplo-drawer-haplogroup {
    display: inline-block;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 1rem;
    font-weight: 600;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    color: #ffffff;
}

/* Match Type Badges */
.haplo-drawer-match-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.haplo-drawer-match-badge.exact {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.haplo-drawer-match-badge.base {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.haplo-drawer-match-badge.subclade {
    background: rgba(139, 92, 246, 0.2);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.4);
}

.haplo-drawer-match-badge.parent {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.haplo-drawer-match-badge.close {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
    border: 1px solid rgba(236, 72, 153, 0.4);
}

.haplo-drawer-match-badge.related {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.4);
}

/* Publication Link */
.haplo-drawer-publication-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #60a5fa;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.haplo-drawer-publication-link:hover {
    color: #93c5fd;
    text-decoration: underline;
}

.haplo-drawer-publication-link i {
    font-size: 0.85rem;
}

/* Description Block */
.haplo-drawer-description {
    font-size: 0.9rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

/* Coordinates */
.haplo-drawer-coords {
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Empty State */
.haplo-drawer-empty {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.5);
}

.haplo-drawer-empty i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.haplo-drawer-empty p {
    font-size: 1rem;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .haplo-drawer {
        display: none !important;
    }
}
