/* PhyloWGD - PGDD 2 Theme */
/* Clean, minimal design for iframe embedding */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* PGDD 2 Color Palette */
    --primary-color: #10b981;
    --primary-dark: #047857;
    --primary-light: #34d399;
    --secondary-color: #059669;
    --accent-color: #f39c12;
    --success-color: #27ae60;
    --bg-color: #f6f7fb;
    --bg-white: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --hover-bg: #ecfdf5;
}

body {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
}

.tab-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

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

/* Tab Views */
.tab-view {
    display: none;
}

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

.container-full {
    max-width: 100%;
    padding: 20px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.tagline {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
.main-content {
    padding: 20px 0;
    min-height: calc(100vh - 140px);
}

/* Search Section */
.search-section {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.search-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 15px;
    align-items: center;
}

.search-box {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filter-select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-export {
    padding: 10px 20px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-export:hover {
    background: #229954;
}

/* Statistics Bar */
.stats-bar {
    display: flex;
    gap: 30px;
    background: var(--bg-white);
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 400;
}

.stat-value {
    color: var(--primary-color);
    font-size: 16px;
    font-weight: 700;
}

/* Table */
.table-container {
    background: var(--bg-white);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
}

.data-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
}

.data-table th:hover {
    background: rgba(255,255,255,0.1);
}

.sort-icon {
    font-size: 10px;
    opacity: 0.6;
    margin-left: 4px;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: var(--hover-bg);
}

.data-table td {
    padding: 12px 15px;
    font-size: 13px;
}

.data-table td:first-child {
    font-weight: 500;
    color: var(--text-primary);
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-family {
    background: #e8f4f8;
    color: var(--secondary-color);
}

.badge-wgd {
    background: #fff3cd;
    color: #856404;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-white);
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.btn-page {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-page:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn-page:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.page-info {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 15px 0;
    text-align: center;
    font-size: 12px;
    margin-top: 30px;
}

.footer p {
    opacity: 0.8;
}

/* Responsive */
@media (max-width: 1024px) {
    .search-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .stats-bar {
        flex-wrap: wrap;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .search-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .data-table {
        min-width: 800px;
    }
}

/* Loading State */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

/* Timeline */
.timeline-header {
    background: var(--bg-white);
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timeline-header h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin: 0;
}

.timeline-controls {
    display: flex;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: var(--hover-bg);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.timeline-container {
    background: var(--bg-white);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    height: 600px;
    overflow: hidden;
}

/* Color the timeline navigation slider by geological periods (ICS Official Colors) */
.tl-timenav-slider-background {
    background: linear-gradient(to right, 
        #812B92 0%,      /* Triassic - Purple (ICS) */
        #812B92 20%,     
        #34B2C9 20%,     /* Jurassic - Cyan (ICS) */
        #34B2C9 40%,     
        #7FC64E 40%,     /* Cretaceous - Green (ICS) */
        #7FC64E 65%,     
        #FD9A52 65%,     /* Paleogene - Orange (ICS) */
        #FD9A52 85%,     
        #FFE619 85%,     /* Neogene - Yellow (ICS) */
        #FFE619 100%
    ) !important;
}

/* Style timeline markers with unique colors */
.tl-timemarker {
    border-color: rgba(0, 0, 0, 0.2) !important;
}

.tl-timemarker-content-container {
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 4px;
}

/* Color event headlines to match their background */
.tl-slide .tl-headline {
    color: #2c3e50 !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* Make event slides more vibrant */
.tl-slide-content {
    border-radius: 6px !important;
}

.tl-media-content-container {
    border-radius: 6px !important;
}

/* Tree Placeholder */
.tree-placeholder {
    background: var(--bg-white);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 80px 40px;
    text-align: center;
}

.placeholder-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.tree-placeholder h2 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.tree-placeholder p {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.placeholder-note {
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Period Events Section */
.period-events-section {
    margin-top: 20px;
    background: var(--bg-white);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 20px;
}

.period-events-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.period-events-header h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin: 0;
}

.btn-close {
    padding: 6px 12px;
    background: var(--text-secondary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-close:hover {
    background: var(--text-primary);
}

.period-stats {
    display: flex;
    gap: 30px;
    margin-top: 15px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 4px;
    font-size: 14px;
}

/* WGD tree tab */
#tree-view .container { position: relative; }
.tree-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 10px; }
.tree-toolbar input { flex: 0 1 300px; padding: 7px 10px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 13px; }
.tree-toolbar button { padding: 7px 14px; border: 1px solid var(--primary-color); background: #fff; color: var(--primary-dark); border-radius: 8px; cursor: pointer; font-size: 13px; }
.tree-toolbar button:hover { background: var(--hover-bg); }
.tree-stats { color: var(--text-secondary); font-size: 12px; }
.tree-legend { margin-left: auto; font-size: 12px; color: var(--text-secondary); display: inline-flex; align-items: center; gap: 6px; }
.lg-mark { width: 8px; height: 8px; background: #059669; transform: rotate(45deg); display: inline-block; }
.lg-bar { width: 22px; height: 6px; background: #10b981; opacity: .3; border-radius: 3px; display: inline-block; margin-left: 8px; }
.tree-canvas { position: relative; height: 72vh; overflow: auto; background: #fff; border: 1px solid var(--border-color); border-radius: 12px; }
.tree-loading { padding: 40px; text-align: center; color: var(--text-secondary); }
.wgd-mark { cursor: pointer; }
.wgd-mark:hover, .wgd-mark:focus { fill: #f59e0b; outline: none; }
.tree-tooltip { display: none; position: absolute; z-index: 10; max-width: 320px; background: #111827; color: #fff; font-size: 12px; line-height: 1.45; padding: 8px 10px; border-radius: 8px; pointer-events: none; }
