﻿/* ==================== BASE STYLES ==================== */

/* Root and Typography */
html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin: 0;
    color: white;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* ==================== BACKGROUND STYLES ==================== */

/* Crypto GIF Background */
.crypto-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('/images/bg/crypto.gif');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 1;
    z-index: -1;
    mix-blend-mode: unset;
}

/* ==================== ANIMATIONS ==================== */

/* Gradient Flow Animation */
@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Spinner Animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Fade In Up Animation */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Node Pulse Animation */
@keyframes nodePulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }

    50% {
        transform: scale(1.03);
        box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }
}

/* Slide In Up Animation */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slide Out Down Animation */
@keyframes slideOutDown {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* Loading Skeleton Animation */
@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Connection Line Animation */
@keyframes connect {
    from {
        stroke-dashoffset: 100;
    }

    to {
        stroke-dashoffset: 0;
    }
}

/* ==================== REUSABLE COMPONENTS ==================== */

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: rgba(0, 0, 0, 0.8);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 5px;
    vertical-align: middle;
}

/* Animations Utility Classes */
.animate-spin {
    animation: spin 0.6s linear infinite;
}

.animate-fade-in-up {
    animation: fade-in-up 0.8s ease-out;
}

.node-pulse {
    animation: nodePulse 1.5s ease-in-out infinite;
}

.slide-in-up {
    animation: slideInUp 0.3s ease-out forwards;
}

.slide-out-down {
    animation: slideOutDown 0.3s ease-in forwards;
}

.connecting-line {
    stroke-dasharray: 5;
    animation: connect 1s linear infinite;
}

/* Buttons */
.btn {
    cursor: pointer;
    transition: all 0.2s ease;
}

    .btn:hover {
        opacity: 0.9;
    }

    /* Focus States */
    .btn:focus,
    .btn:active:focus,
    .btn-link.nav-link:focus,
    .form-control:focus,
    .form-check-input:focus {
        box-shadow: 0 0 0 0.1rem #ecfdf5, 0 0 0 0.25rem #10b981;
    }

/* Bottom Navigation */
nav {
    backdrop-filter: blur(5px);
    border-top: 1px solid rgba(255,255,255,0.1);
    z-index: 30;
}

/* ==================== GENEALOGY TREE STYLES ==================== */

/* Mobile Container */
.genealogy-mobile-container {
    max-width: 390px;
    margin: 0 auto;
    padding: 0 12px 80px 12px;
}

/* Hide Scrollbar Utility */
.hide-scrollbar {
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

    .hide-scrollbar::-webkit-scrollbar {
        display: none;
    }

/* Mobile Touch Optimizations */
.mobile-node {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

/* Mobile Node Card */
.mobile-node-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

    .mobile-node-card:active {
        transform: scale(0.97);
        background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
    }

    .mobile-node-card:hover {
        box-shadow: 0 12px 40px rgba(59, 130, 246, 0.2);
    }

/* Expand/Collapse Buttons */
.genealogy-expand-btn {
    width: 36px;
    height: 36px;
    border-radius: 18px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
    transition: all 0.2s ease;
}

    .genealogy-expand-btn:active {
        transform: scale(0.9);
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.6);
    }

.genealogy-collapse-btn {
    width: 36px;
    height: 36px;
    border-radius: 18px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    transition: all 0.2s ease;
}

    .genealogy-collapse-btn:active {
        transform: scale(0.9);
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.6);
    }

/* Connection Lines */
.mobile-connector,
.tree-connector-vertical {
    position: absolute;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), transparent);
}

.tree-connector-vertical {
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
}

.tree-connector-horizontal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
}

/* Children Container */
.children-container-mobile {
    margin-top: 20px;
    position: relative;
    padding-left: 20px;
}

    .children-container-mobile::before {
        content: '';
        position: absolute;
        left: 10px;
        top: 0;
        bottom: 0;
        width: 2px;
        background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.1) 100%);
        border-radius: 1px;
    }

/* Mobile Tooltip */
#mobileTooltip {
    backdrop-filter: blur(20px);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95) 0%, rgba(139, 92, 246, 0.95) 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Search Input */
.genealogy-search {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

    .genealogy-search:focus {
        background: rgba(255, 255, 255, 0.12);
        border-color: rgba(59, 130, 246, 0.6);
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

/* Status Indicators */
.status-indicator-active {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.status-indicator-inactive {
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Avatar Circles */
.genealogy-avatar {
    width: 48px;
    height: 48px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
}

.genealogy-avatar-active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.3) 0%, rgba(34, 197, 94, 0.15) 100%);
    border-color: rgba(16, 185, 129, 0.5);
}

.genealogy-avatar-inactive {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(96, 165, 250, 0.15) 100%);
    border-color: rgba(59, 130, 246, 0.5);
}

/* Path Breadcrumb */
.path-breadcrumb {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
}

/* Typography Utilities */
.genealogy-text-xs {
    font-size: 11px;
}

.genealogy-text-sm {
    font-size: 13px;
}

.genealogy-text-md {
    font-size: 15px;
}

.genealogy-text-lg {
    font-size: 17px;
}

/* Loading Skeleton */
.genealogy-skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 25%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0.05) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
}

/* Empty State */
.genealogy-empty-state {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
}

/* Highlight Effect */
.genealogy-highlight {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.3) 0%, rgba(251, 191, 36, 0.2) 100%);
    border: 2px solid rgba(245, 158, 11, 0.5);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

/* Scroll to Top Button */
.genealogy-scroll-top {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.9) 0%, rgba(139, 92, 246, 0.9) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 40;
    backdrop-filter: blur(10px);
}

/* Accessibility Improvements */
.genealogy-expand-btn:focus-visible,
.genealogy-collapse-btn:focus-visible,
.mobile-node-card:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* ==================== LEGACY GENEALOGY STYLES (Deprecated) ==================== */

/* These styles are kept for backward compatibility but should be migrated to mobile styles */
.gene-node {
    text-align: center;
    margin: 20px;
}

.children {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.node {
    cursor: pointer;
    padding: 8px;
}

    .node img {
        width: 40px;
    }

.active {
    color: green;
}

.inactive {
    color: blue;
}

.genealogy-tooltip {
    position: fixed;
    background: white/20;
    border: 0px solid #ddd;
    border-radius: 2px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 2px;
    z-index: 1000;
    min-width: 50px;
    max-width: 80px;
    pointer-events: none;
}

.tooltip-header {
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
    padding-bottom: 8px;
}

    .tooltip-header h4 {
        margin: 0;
        color: #333;
        font-size: 16px;
    }

.tooltip-content {
    font-size: 14px;
}

.tooltip-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    padding: 3px 0;
}

.tooltip-label {
    font-weight: 600;
    color: #555;
}

.tooltip-value {
    color: #333;
    text-align: right;
}

.status-active {
    color: #28a745;
    font-weight: bold;
}

.status-inactive {
    color: #dc3545;
    font-weight: bold;
}

.genealogy-container {
    position: relative;
    min-height: 500px;
}

/* ==================== RESPONSIVE BREAKPOINTS ==================== */

/* Extra Small Devices */
@media (max-width: 320px) {
    .genealogy-mobile-container {
        padding: 0 8px 70px 8px;
    }

    .mobile-node-card {
        padding: 10px;
    }

    .genealogy-avatar {
        width: 40px;
        height: 40px;
    }
}

/* Height Adjustments */
@media (max-height: 670px) {
    .genealogy-mobile-container {
        padding-bottom: 100px;
    }
}

/* Landscape Mode */
@media (orientation: landscape) and (max-height: 500px) {
    .genealogy-mobile-container {
        max-height: 250px;
        overflow-y: auto;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .mobile-node-card {
        background: linear-gradient(145deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.2));
    }

    .genealogy-search {
        background: rgba(0, 0, 0, 0.2);
    }
}

/* Print Styles */
@media print {
    .mobile-node-card {
        background: white;
        color: black;
        border: 1px solid #ddd;
    }

    #mobileTooltip,
    .genealogy-scroll-top,
    .genealogy-expand-btn,
    .genealogy-collapse-btn {
        display: none !important;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .node-pulse,
    .slide-in-up,
    .slide-out-down {
        animation: none;
    }

    .mobile-node-card:active {
        transform: none;
    }

    .connecting-line {
        animation: none;
    }

    .genealogy-skeleton {
        animation: none;
    }
}


/* Mobile Genealogy Tree Styles */
.mobile-genealogy-node {
    position: relative;
}

.children-container {
    position: relative;
    padding-left: 20px;
}

    .children-container::before {
        content: '';
        position: absolute;
        left: 8px;
        top: 0;
        bottom: 0;
        width: 2px;
        background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 50%, transparent 100%);
    }

/* Touch-friendly button sizes */
.expand-btn, .collapse-btn {
    min-width: 40px;
    min-height: 40px;
}

/* Mobile optimizations */
@media (max-width: 320px) {
    .mobile-node-card {
        padding: 12px !important;
    }

    .expand-btn, .collapse-btn {
        min-width: 36px;
        min-height: 36px;
    }
}

/* Loading animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.children-container > * {
    animation: fadeIn 0.3s ease-out;
}

.gene-node {
    margin-left: 20px;
}

.node {
    padding: 5px;
    border: 1px solid #ccc;
    display: inline-block;
    margin-bottom: 5px;
}

    .node.active {
        background-color: #c8e6c9;
    }

    .node.inactive {
        background-color: #bbdefb;
    }

.children {
    margin-left: 30px;
}

<style >
.node-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 6px;
    transition: all 0.2s ease;
}

.node-card.active {
    border-left: 3px solid #10b981;
}

.node-card.inactive {
    border-left: 3px solid #3b82f6;
}

.node-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.children {
    border-left: 1px dashed rgba(255, 255, 255, 0.2);
    padding-left: 6px;
}

</style >

