/* Custom styles for GEvol Results Webserver */

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Tree container styling */
.tree-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    min-height: 600px;
    overflow: hidden;
    border: 1px solid #e9ecef;
    position: relative;
}

/* D3 Tree specific styles */
.node circle {
    fill: #fff;
    stroke: steelblue;
    stroke-width: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.node circle:hover {
    fill: #4ecdc4;
    stroke: #26a69a;
    stroke-width: 3px;
}

.node text {
    font: 12px sans-serif;
    cursor: pointer;
    user-select: none;
}

/* Orthogonal tree branch styling */
.link {
    fill: none;
    stroke: #999;
    stroke-width: 2px;
    stroke-linejoin: round;
    stroke-linecap: round;
    transition: stroke-width 0.3s ease, stroke 0.3s ease;
}

.link:hover {
    stroke: #333;
    stroke-width: 3px;
}

/* Branch length labels for orthogonal layout */
.branch-length {
    font-size: 10px;
    font-family: monospace;
    fill: #666;
    pointer-events: none;
}

/* Highlighted nodes */
.node.selected circle {
    fill: #ff6b6b;
    stroke: #ff5252;
    stroke-width: 3px;
}

.node.highlighted circle {
    fill: #4ecdc4;
    stroke: #26a69a;
    stroke-width: 3px;
}

/* Tree navigation controls */
.tree-controls {
    margin-bottom: 15px;
}

.tree-controls .btn {
    margin-right: 10px;
}

/* Card enhancements */
.card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: none;
    border-radius: 10px;
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px 10px 0 0 !important;
}

/* Node page specific styles */
.display-6 {
    font-weight: 300;
}

/* Table enhancements */
.table th {
    border-top: none;
    font-weight: 600;
}

.table-dark th {
    background-color: #495057;
    border-color: #495057;
}

/* Badge styling */
.badge {
    font-size: 0.75em;
}

/* Button enhancements */
.btn-outline-primary:hover,
.btn-outline-secondary:hover,
.btn-outline-success:hover,
.btn-outline-warning:hover,
.btn-outline-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* Navbar brand enhancement */
.navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
}

/* Tree loading states */
.tree-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400px;
    color: #6c757d;
}

.tree-loading i {
    font-size: 2rem;
    margin-right: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tree-container {
        padding: 10px;
        min-height: 400px;
    }
    
    .display-6 {
        font-size: 1.75rem;
    }
    
    .card-body .row .col-4 {
        margin-bottom: 10px;
    }
}

/* Animation for tree rendering */
.node {
    transition: all 0.3s ease;
}

.link {
    transition: all 0.3s ease;
}

/* Tooltip styling for tree nodes */
.tree-tooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
}

/* Loading spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Success/error message styling */
.alert {
    border-radius: 8px;
    border: none;
}

.alert-success {
    background-color: #d1ecf1;
    color: #0c5460;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

/* Data table enhancements */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    margin-top: 10px;
}

/* Custom scrollbar for tree container */
.tree-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.tree-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.tree-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.tree-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* DomRates specific styles */
.color-indicator {
    width: 12px;
    height: 12px;
    display: inline-block;
    margin-right: 8px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.1);
}

#domRatesPieChart {
    max-height: 300px;
}

#modalDomRatesPieChart {
    max-height: 200px;
}

.alert-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

/* Modal enhancements for DomRates */
.modal-xl .modal-body {
    padding: 1.5rem;
}

.modal-body h6 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

/* DomRates Events Table Styling */
.form-check-inline {
    margin-right: 0.75rem;
}

.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check-label.small {
    font-size: 0.875rem;
    font-weight: 500;
}

#eventsDataTable {
    font-size: 0.875rem;
}

#eventsDataTable th {
    background-color: #343a40;
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.75rem 0.5rem;
}

#eventsDataTable td {
    padding: 0.5rem;
    vertical-align: middle;
}

#eventsDataTable tbody tr:hover {
    background-color: #f8f9fa;
}

/* Custom DataTable styling */
.dataTables_wrapper .dataTables_length select {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.dataTables_wrapper .dataTables_filter input {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.875rem;
    color: #6c757d;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Filter section styling */
.filter-section {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
}

/* Search input styling */
.form-control-sm {
    font-size: 0.875rem;
}

/* Responsive adjustments for events table */
@media (max-width: 768px) {
    .form-check-inline {
        display: block;
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    #eventsDataTable th,
    #eventsDataTable td {
        padding: 0.25rem;
        font-size: 0.75rem;
    }
}

/* Pfam link styling */
.pfam-link {
    color: #0066cc;
    text-decoration: none;
    font-weight: 500;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    font-family: monospace;
    font-size: 0.875rem;
    display: inline-block;
    margin: 0.125rem;
    transition: all 0.2s ease;
}

.pfam-link:hover {
    color: #004499;
    background-color: #e9ecef;
    border-color: #adb5bd;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pfam-link:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Arrangement cell styling */
#eventsDataTable td:nth-child(3),
#eventsDataTable td:nth-child(4) {
    line-height: 1.5;
    word-break: break-word;
}

/* Tab styling for analysis sections */
#analysisTabsNav .nav-link {
    color: #495057;
    border: 1px solid transparent;
    border-top-left-radius: 0.375rem;
    border-top-right-radius: 0.375rem;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    transition: all 0.3s ease;
}

#analysisTabsNav .nav-link:hover {
    color: #0056b3;
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

#analysisTabsNav .nav-link.active {
    color: #fff;
    background-color: #0d6efd;
    border-color: #0d6efd;
    box-shadow: 0 2px 4px rgba(13, 110, 253, 0.25);
}

#analysisTabsNav .nav-link i {
    opacity: 0.8;
}

#analysisTabsNav .nav-link.active i {
    opacity: 1;
}

/* Tab content styling */
.tab-content {
    background: transparent;
    border: none;
    padding: 0;
}

.tab-pane {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tab-pane.active {
    opacity: 1;
}

/* Venn diagram icon for OrthoFinder3 tab */
.venn-diagram-icon {
    position: relative;
    display: inline-block;
    width: 16px;
    height: 12px;
}

.venn-circle-1,
.venn-circle-2 {
    position: absolute;
    font-size: 10px;
    top: 0;
}

.venn-circle-1 {
    left: 0;
    color: #0d6efd;
}

.venn-circle-2 {
    left: 6px;
    color: #6f42c1;
}

/* Active tab styling for Venn diagram */
#analysisTabsNav .nav-link.active .venn-circle-1 {
    color: rgba(255, 255, 255, 0.9);
}

#analysisTabsNav .nav-link.active .venn-circle-2 {
    color: rgba(255, 255, 255, 0.7);
}

/* Quality Assessment specific styles */
.missing-cdas-container {
    max-height: 400px;
    overflow-y: auto;
}

.missing-cdas-container .pfam-link {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 500;
    padding: 2px 4px;
    border-radius: 3px;
    background-color: rgba(13, 110, 253, 0.1);
    transition: all 0.2s ease;
}

.missing-cdas-container .pfam-link:hover {
    text-decoration: none;
    color: #fff;
    background-color: #0d6efd;
    transform: scale(1.05);
}

.qa-stats-card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.15s ease-in-out;
}

.qa-stats-card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.completeness-good {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.completeness-warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14);
    color: white;
}

.completeness-poor {
    background: linear-gradient(135deg, #dc3545, #e83e8c);
    color: white;
}

/* Progress bar custom styling for QA */
.qa-progress {
    height: 1.5rem;
    border-radius: 0.5rem;
    background-color: #e9ecef;
}

.qa-progress .progress-bar {
    border-radius: 0.5rem;
    transition: width 0.6s ease;
}

/* Missing CDA item styling */
.missing-cda-item {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    transition: all 0.2s ease;
}

.missing-cda-item:hover {
    border-color: #adb5bd;
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Quality Assessment badges */
.qa-badge-excellent {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
}

.qa-badge-good {
    background: linear-gradient(45deg, #17a2b8, #20c997);
    color: white;
}

.qa-badge-warning {
    background: linear-gradient(45deg, #ffc107, #fd7e14);
    color: white;
}

.qa-badge-poor {
    background: linear-gradient(45deg, #dc3545, #e83e8c);
    color: white;
}

/* Completeness cards */
.completeness-metric {
    background: white;
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.completeness-metric::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.completeness-metric:hover::before {
    animation: shimmer 1.5s ease-in-out;
}

@keyframes shimmer {
    0% { opacity: 0; transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    50% { opacity: 1; }
    100% { opacity: 0; transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.completeness-metric.excellent {
    border-color: #28a745;
    background: linear-gradient(135deg, #d4edda, #ffffff);
}

.completeness-metric.good {
    border-color: #17a2b8;
    background: linear-gradient(135deg, #d1ecf1, #ffffff);
}

.completeness-metric.warning {
    border-color: #ffc107;
    background: linear-gradient(135deg, #fff3cd, #ffffff);
}

.completeness-metric.poor {
    border-color: #dc3545;
    background: linear-gradient(135deg, #f8d7da, #ffffff);
}

/* Support value styling for phylogenetic trees */
.support-value {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    stroke-width: 2px;
    paint-order: stroke fill;
}

/* Active button styling for support value toggles */
.btn.active {
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

#tbeToggle.active {
    background-color: #d32f2f !important;
    border-color: #d32f2f !important;
    color: white !important;
}

#fbpToggle.active {
    background-color: #1976d2 !important;
    border-color: #1976d2 !important;
    color: white !important;
}
