/* MPNN vs TriFlow Comparison Dashboard - CSS */
/* Styled to match TSS Analyzer (Tabler-based) */

:root {
    /* Tabler-inspired color scheme */
    --color-primary: #206bc4;
    --color-primary-hover: #1a569d;
    --color-primary-dark: #154178;
    --color-secondary: #626976;
    --color-success: #2fb344;
    --color-danger: #d63939;
    --color-warning: #f76707;
    --color-info: #4299e1;

    /* Gray scale matching Tabler */
    --color-gray-50: #f8fafc;
    --color-gray-100: #f1f5f9;
    --color-gray-200: #e2e8f0;
    --color-gray-300: #cbd5e1;
    --color-gray-400: #94a3b8;
    --color-gray-500: #64748b;
    --color-gray-600: #475569;
    --color-gray-700: #334155;
    --color-gray-800: #1e293b;
    --color-gray-900: #0f172a;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Border radius matching Tabler */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    /* Tool colors - updated to match Tabler palette */
    --color-mpnn: #206bc4;
    --color-triflow: #7c3aed;
    --color-colabdesign: #2fb344;
    --color-rfd: #f76707;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    min-height: 100vh;
    color: var(--color-gray-700);
    line-height: 1.5;
    font-size: 0.9375rem;
}

/* Navbar - Tabler style */
.navbar {
    background: #ffffff;
    padding: 0 1rem;
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(101, 109, 119, 0.16);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-gray-800);
    text-decoration: none;
}

.nav-brand a:hover {
    color: var(--color-primary);
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-links a {
    color: var(--color-gray-600);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
    display: inline-flex;
    align-items: center;
}

.nav-icon-btn {
    color: var(--color-gray-800) !important;
    padding: 0.5rem !important;
    border-radius: var(--radius-sm);
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out;
}

.nav-icon-btn:hover {
    color: var(--color-gray-900) !important;
    background-color: var(--color-gray-100);
}

.nav-icon-btn svg {
    display: block;
}

.nav-links a:hover {
    color: var(--color-primary);
    background: transparent;
}

.nav-links a.active {
    color: var(--color-primary);
    background: rgba(32, 107, 196, 0.08);
}

/* Container */
.container {
    max-width: 1900px;
    margin: 0 auto;
    padding: 12px 16px;
}

/* Page Header */
.page-header {
    margin-bottom: 12px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-gray-900);
    margin-bottom: 4px;
}

/* Back Link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-gray-500);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 8px;
    transition: color 0.15s ease;
}

.back-link:hover {
    color: var(--color-primary);
}

.page-header .subtitle {
    color: var(--color-gray-500);
    font-size: 0.875rem;
}

/* Stats Grid - Tabler style */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #ffffff;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(101, 109, 119, 0.16);
    text-align: center;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-gray-800);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.8125rem;
    color: var(--color-gray-500);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-card.highlight-cd {
    border-left: 3px solid var(--color-colabdesign);
}

.stat-card.highlight-rfd {
    border-left: 3px solid var(--color-rfd);
}

/* Chart Section - Tabler style */
.chart-section {
    background: #ffffff;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(101, 109, 119, 0.16);
    margin-bottom: 1.5rem;
}

.chart-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-gray-800);
}

.charts-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.chart-container {
    position: relative;
    min-height: 300px;
    max-height: 350px;
    height: 300px;
}

.chart-container.large {
    min-height: 400px;
}

.chart-container h3 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-gray-600);
    margin-bottom: 12px;
}

/* Breakdown Section */
.breakdown-section {
    margin-bottom: 32px;
}

.breakdown-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.breakdown-card {
    background: #ffffff;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(101, 109, 119, 0.16);
}

.breakdown-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-gray-800);
}

.breakdown-stats {
    margin-bottom: 20px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-gray-100);
}

.tool-label {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.tool-label.mpnn {
    background: rgba(32, 107, 196, 0.1);
    color: var(--color-mpnn);
}

.tool-label.triflow {
    background: rgba(124, 58, 237, 0.1);
    color: var(--color-triflow);
}

.breakdown-row .count {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-gray-800);
}

.metrics-preview h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-gray-600);
    margin-bottom: 8px;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.875rem;
}

/* Quick Links */
.quick-links {
    margin-top: 32px;
}

.quick-links h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.link-card {
    background: #ffffff;
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(101, 109, 119, 0.16);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.link-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(32, 107, 196, 0.1);
}

.link-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.link-card h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-gray-800);
}

.link-card p {
    font-size: 0.875rem;
    color: var(--color-gray-500);
}

/* Buttons - Tabler style */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4375rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    cursor: pointer;
    border: 1px solid transparent;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
    text-decoration: none;
    gap: 0.25rem;
    white-space: nowrap;
    user-select: none;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-primary {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    color: #ffffff;
}

.btn-secondary {
    background: #ffffff;
    color: var(--color-gray-700);
    border-color: var(--color-gray-300);
}

.btn-secondary:hover {
    background: var(--color-gray-100);
    border-color: var(--color-gray-400);
    color: var(--color-gray-800);
}

.btn-ghost {
    background: transparent;
    color: var(--color-gray-600);
    border-color: transparent;
}

.btn-ghost:hover {
    background: var(--color-gray-100);
    color: var(--color-gray-800);
}

.btn.active {
    background: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

/* Filters - Tabler style */
.filters-section, .filters-panel {
    background: #ffffff;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(101, 109, 119, 0.16);
    margin-bottom: 1.5rem;
}

.filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-group select,
.filter-group input[type="text"],
.form-select,
.form-control {
    padding: 0.4375rem 0.75rem;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    min-width: 150px;
    background-color: #ffffff;
    color: var(--color-gray-700);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.filter-group select:focus,
.filter-group input:focus,
.form-select:focus,
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(32, 107, 196, 0.25);
}

.range-filter {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.range-filter input[type="range"] {
    width: 100px;
}

.filters-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.results-count {
    color: var(--color-gray-500);
    font-size: 0.875rem;
    margin-left: auto;
}

/* Tables - Tabler style */
.table-section {
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid rgba(101, 109, 119, 0.16);
    overflow: hidden;
}

.table-wrapper {
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--color-gray-100);
}

.data-table th {
    background: var(--color-gray-50);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--color-gray-600);
}

.data-table th.sortable {
    cursor: pointer;
}

.data-table th.sortable:hover {
    background: var(--color-gray-100);
}

.header-group.cd {
    background: rgba(47, 179, 68, 0.1);
    color: var(--color-colabdesign);
}

.header-group.rfd {
    background: rgba(247, 103, 7, 0.1);
    color: var(--color-rfd);
}

.subheader th {
    font-size: 0.7rem;
    padding: 8px 16px;
}

.subheader th.cd {
    background: rgba(47, 179, 68, 0.05);
}

.subheader th.rfd {
    background: rgba(247, 103, 7, 0.05);
}

.data-table tbody tr:hover {
    background: var(--color-gray-50);
}

.target-id a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.target-id a:hover {
    text-decoration: underline;
}

.rate-cell {
    width: 120px;
}

.rate-bar {
    height: 8px;
    background: var(--color-gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 4px;
}

.rate-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.rate-fill.mpnn {
    background: var(--color-primary);
}

.rate-fill.triflow {
    background: var(--color-triflow);
}

.rate-fill.colabdesign {
    background: var(--color-colabdesign);
}

.rate-fill.rfd {
    background: var(--color-rfd);
}

.rate-value {
    font-size: 0.75rem;
    color: var(--color-gray-600);
}

.no-data {
    color: var(--color-gray-400);
}

.actions-cell {
    display: flex;
    gap: 8px;
}

/* Summary Bar - Tabler style */
.summary-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid rgba(101, 109, 119, 0.16);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.summary-divider {
    color: var(--color-gray-300);
}

/* Design Grid */
.designs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.designs-grid.list-view {
    grid-template-columns: 1fr;
}

.design-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid rgba(101, 109, 119, 0.16);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.design-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(32, 107, 196, 0.1);
}

.card-header {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    background: var(--color-gray-50);
}

.pipeline-badge, .tool-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.pipeline-badge.colabdesign {
    background: rgba(47, 179, 68, 0.1);
    color: var(--color-colabdesign);
}

.pipeline-badge.rfd {
    background: rgba(247, 103, 7, 0.1);
    color: var(--color-rfd);
}

.tool-badge.mpnn {
    background: rgba(32, 107, 196, 0.1);
    color: var(--color-mpnn);
}

.tool-badge.triflow {
    background: rgba(124, 58, 237, 0.1);
    color: var(--color-triflow);
}

.card-body {
    padding: 16px;
}

.design-id {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-gray-800);
    margin-bottom: 4px;
    word-break: break-all;
}

.target-link {
    font-size: 0.75rem;
    color: var(--color-gray-500);
}

.card-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--color-gray-100);
    border-top: 1px solid var(--color-gray-100);
}

.card-metrics .metric {
    background: white;
    padding: 8px;
    text-align: center;
}

.metric-label {
    font-size: 0.65rem;
    color: var(--color-gray-500);
    text-transform: uppercase;
}

.metric-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-gray-800);
}

.metric-value.good {
    color: var(--color-success);
}

.metric-value.medium {
    color: var(--color-warning);
}

.metric-value.poor {
    color: var(--color-danger);
}

/* Sort Section */
.sort-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-controls label {
    font-size: 0.875rem;
    color: var(--color-gray-600);
}

.sort-controls select {
    padding: 6px 12px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.view-controls {
    display: flex;
    gap: 4px;
}

/* Pagination - Tabler style */
.pagination-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: #ffffff;
    border-radius: var(--radius-md);
    border: 1px solid rgba(101, 109, 119, 0.16);
}

#pageInfo {
    color: var(--color-gray-600);
    font-size: 0.875rem;
}

/* Modal - Tabler style */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(24, 36, 51, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #ffffff;
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(101, 109, 119, 0.16);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-gray-500);
    z-index: 10;
}

.modal-close:hover {
    color: var(--color-gray-800);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 80vh;
}

.modal-left {
    padding: 24px;
    background: var(--color-gray-50);
    display: flex;
    flex-direction: column;
}

.modal-right {
    padding: 24px;
    overflow-y: auto;
}

.modal-right h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    word-break: break-all;
}

.info-section {
    margin-bottom: 24px;
}

.info-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-gray-600);
    margin-bottom: 12px;
    text-transform: uppercase;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.info-item {
    font-size: 0.875rem;
}

.info-item span:first-child {
    color: var(--color-gray-500);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Structure Viewer */
.structure-viewer-container {
    flex: 1;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 400px;
}

.structure-canvas {
    width: 100%;
    height: 100%;
    cursor: grab;
}

.structure-canvas:active {
    cursor: grabbing;
}

/* Modal Molstar Viewer */
.modal-molstar-container {
    flex: 1;
    background: #f9f9f9;
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 450px;
    position: relative;
}

.modal-molstar-container .no-structure {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--color-gray-500);
    font-size: 0.9rem;
}

.viewer-controls {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 0.75rem;
    color: var(--color-gray-600);
}

/* Loading */
.loading-spinner {
    text-align: center;
    padding: 48px;
    color: var(--color-gray-500);
}

.no-results {
    text-align: center;
    padding: 48px;
    color: var(--color-gray-500);
    grid-column: 1 / -1;
}

.error {
    text-align: center;
    padding: 48px;
    color: var(--color-danger);
    grid-column: 1 / -1;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--color-gray-500);
    font-size: 0.875rem;
}

/* Distribution Controls */
.distribution-controls {
    margin-bottom: 16px;
}

.distribution-controls label {
    font-size: 0.875rem;
    color: var(--color-gray-600);
    margin-right: 8px;
}

.distribution-controls select {
    padding: 6px 12px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-sm);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 12px;
    }

    .nav-links {
        margin-top: 12px;
        gap: 12px;
    }

    .modal-body {
        grid-template-columns: 1fr;
    }

    .charts-row {
        grid-template-columns: 1fr;
    }

    .card-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}
