/* ═══════════════════════════════════════════════════════════
   NEXUS — Network Pharmacology Analysis Platform
   Custom Styles (consistent with InsilicoΣ design system)
   ═══════════════════════════════════════════════════════════ */

:root {
    --nexus-primary: #1565C0;
    --nexus-primary-dark: #0D47A1;
    --nexus-primary-light: #42A5F5;
    --nexus-accent: #00ACC1;
    --nexus-accent-light: #4DD0E1;
    --nexus-gradient-start: #0D47A1;
    --nexus-gradient-mid: #1565C0;
    --nexus-gradient-end: #1E88E5;
    --nexus-success: #2E7D32;
    --nexus-danger: #C62828;
    --nexus-warning: #F57F17;
    --nexus-info: #00838F;
    --nexus-card-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --nexus-card-hover-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    --nexus-radius: 12px;
    --nexus-radius-sm: 8px;
}

/* ─── Hero Section ──────────────────────────────────────── */
.nexus-hero {
    background: linear-gradient(135deg, var(--nexus-gradient-start) 0%, var(--nexus-gradient-mid) 50%, var(--nexus-gradient-end) 100%);
    color: #fff;
    border-radius: var(--nexus-radius);
    padding: 2.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    overflow: hidden;
}

.nexus-hero h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.nexus-hero .hero-subtitle {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.95) !important;
    max-width: 600px;
}

.nexus-hero .hero-icon {
    position: absolute;
    right: 2rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 7rem;
    opacity: 0.12;
}

.nexus-hero .hero-actions .btn {
    border-radius: var(--nexus-radius-sm);
    padding: 0.5rem 1.25rem;
    font-weight: 600;
}

.nexus-hero .btn-light {
    color: var(--nexus-primary-dark);
}

.nexus-hero .btn-outline-light:hover {
    color: var(--nexus-primary-dark);
}

/* ─── Stat Cards ────────────────────────────────────────── */
.nexus-stat-card {
    border: none;
    border-radius: var(--nexus-radius);
    box-shadow: var(--nexus-card-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    overflow: hidden;
    color: #fff;
    position: relative;
}

.nexus-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--nexus-card-hover-shadow);
}

.nexus-stat-card .card-body {
    padding: 1.25rem;
}

.nexus-stat-card .stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.1;
}

.nexus-stat-card .stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
    margin-top: 0.25rem;
}

.nexus-stat-card .stat-icon {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2.5rem;
    opacity: 0.15;
}

/* ─── Action Cards ──────────────────────────────────────── */
.nexus-action-card {
    border: none;
    border-radius: var(--nexus-radius);
    box-shadow: var(--nexus-card-shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.nexus-action-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--nexus-card-hover-shadow);
    color: inherit;
    text-decoration: none;
}

.nexus-action-card .action-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.75rem;
    color: #fff;
}

.nexus-action-card h5 {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.nexus-action-card p {
    color: #6c757d;
    font-size: 0.875rem;
}

/* ─── Cards (General) ───────────────────────────────────── */
.nexus-card {
    border: none;
    border-radius: var(--nexus-radius);
    box-shadow: var(--nexus-card-shadow);
    margin-bottom: 1.5rem;
    transition: box-shadow 0.3s;
}

.nexus-card .card-header {
    background: #fff;
    border-bottom: 2px solid var(--nexus-primary);
    font-weight: 600;
    border-radius: var(--nexus-radius) var(--nexus-radius) 0 0 !important;
    padding: 1rem 1.25rem;
}

.nexus-card .card-body {
    padding: 1.25rem;
}

/* ─── Status Badges ─────────────────────────────────────── */
.badge.bg-pending {
    background-color: var(--nexus-warning) !important;
    color: #000;
}

.badge.bg-processing {
    background: linear-gradient(135deg, #0288D1, #03A9F4) !important;
    color: #fff;
}

.badge.bg-completed {
    background-color: var(--nexus-success) !important;
    color: #fff;
}

.badge.bg-failed {
    background-color: var(--nexus-danger) !important;
    color: #fff;
}

.badge.bg-cancelled {
    background-color: #78909C !important;
    color: #fff;
}

/* ─── Upload Area ───────────────────────────────────────── */
.nexus-upload-area {
    border: 2px dashed #b0bec5;
    border-radius: var(--nexus-radius);
    padding: 2.5rem 2rem;
    text-align: center;
    transition: all 0.3s;
    background: #fafbfc;
    cursor: pointer;
}

.nexus-upload-area:hover {
    border-color: var(--nexus-primary);
    background: #e3f2fd;
}

.nexus-upload-area.dragover {
    border-color: var(--nexus-primary);
    background: #bbdefb;
    transform: scale(1.01);
}

.nexus-upload-area .upload-icon {
    font-size: 3rem;
    color: var(--nexus-primary-light);
    margin-bottom: 1rem;
}

.nexus-upload-area .upload-text {
    font-size: 1.1rem;
    color: #455a64;
    margin-bottom: 0.5rem;
}

.nexus-upload-area .upload-hint {
    font-size: 0.85rem;
    color: #607D8B;
}

.nexus-upload-area .file-selected {
    color: var(--nexus-success);
    font-weight: 600;
}

/* ─── Config Panel (Accordion) ──────────────────────────── */
.nexus-config-panel .accordion-button {
    font-weight: 600;
    color: var(--nexus-primary-dark);
    background: #e3f2fd;
}

.nexus-config-panel .accordion-button:not(.collapsed) {
    background: #bbdefb;
    color: var(--nexus-primary-dark);
    box-shadow: none;
}

.nexus-config-panel .accordion-body {
    background: #fafbfc;
}

/* ─── Progress Card ─────────────────────────────────────── */
.nexus-progress-card {
    border: none;
    border-radius: var(--nexus-radius);
    box-shadow: var(--nexus-card-shadow);
    border-left: 5px solid var(--nexus-primary);
    overflow: hidden;
}

.nexus-progress-card .progress {
    height: 28px;
    border-radius: var(--nexus-radius-sm);
    background: #e3f2fd;
}

.nexus-progress-card .progress-bar {
    font-weight: 600;
    font-size: 0.85rem;
    transition: width 0.6s ease;
}

/* ─── Quality Gauge ─────────────────────────────────────── */
.nexus-quality-gauge {
    text-align: center;
}

.nexus-quality-gauge .gauge-ring {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    position: relative;
}

.nexus-quality-gauge .gauge-ring::before {
    content: '';
    position: absolute;
    top: 6px; right: 6px; bottom: 6px; left: 6px;
    border-radius: 50%;
    background: #fff;
}

.nexus-quality-gauge .gauge-value {
    position: relative;
    z-index: 1;
    font-size: 1.75rem;
    font-weight: 700;
}

.nexus-quality-gauge .gauge-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #78909c;
}

.gauge-excellent { background: conic-gradient(var(--nexus-success) calc(var(--score) * 1%), #e0e0e0 0); }
.gauge-good { background: conic-gradient(#43A047 calc(var(--score) * 1%), #e0e0e0 0); }
.gauge-fair { background: conic-gradient(var(--nexus-warning) calc(var(--score) * 1%), #e0e0e0 0); }
.gauge-poor { background: conic-gradient(var(--nexus-danger) calc(var(--score) * 1%), #e0e0e0 0); }

/* ─── Quality Metric Cards ──────────────────────────────── */
.nexus-metric-card {
    border: 1px solid #e0e0e0;
    border-radius: var(--nexus-radius-sm);
    padding: 1rem;
    text-align: center;
    transition: all 0.3s;
}

.nexus-metric-card:hover {
    border-color: var(--nexus-primary-light);
    background: #e3f2fd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.nexus-metric-card .metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--nexus-primary);
}

.nexus-metric-card .metric-label {
    font-size: 0.78rem;
    color: #78909c;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ─── Results Tabs ──────────────────────────────────────── */
.nexus-tabs .nav-link {
    border: none;
    color: #546e7a;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.nexus-tabs .nav-link:hover {
    color: var(--nexus-primary);
    border-bottom-color: #bbdefb;
}

.nexus-tabs .nav-link.active {
    color: var(--nexus-primary);
    border-bottom-color: var(--nexus-primary);
    background: transparent;
}

.nexus-tabs .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #e3f2fd;
    color: var(--nexus-primary);
    border-radius: 10px;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    min-width: 22px;
    height: 20px;
    margin-left: 0.35rem;
}

.nexus-tabs .nav-link.active .tab-count {
    background: var(--nexus-primary);
    color: #fff;
}

/* ─── Figure Gallery ────────────────────────────────────── */
.nexus-figure-card {
    border: none;
    border-radius: var(--nexus-radius);
    box-shadow: var(--nexus-card-shadow);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.nexus-figure-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--nexus-card-hover-shadow);
}

.nexus-figure-card img {
    cursor: pointer;
    transition: transform 0.3s;
    background: #f5f5f5;
}

.nexus-figure-card img:hover {
    transform: scale(1.02);
}

.nexus-figure-card .card-footer {
    background: #fff;
    border-top: 1px solid #eee;
    padding: 0.75rem 1rem;
}

/* ─── Lightbox ──────────────────────────────────────────── */
.nexus-lightbox {
    position: fixed;
    top: 0; right: 0; bottom: 0; left: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.nexus-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.nexus-lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.nexus-lightbox .lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    background: none;
    border: none;
}

.nexus-lightbox .lightbox-close:hover {
    opacity: 1;
}

.nexus-lightbox .lightbox-caption {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0, 0, 0, 0.6);
    padding: 0.5rem 1.25rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* ─── Timeline (Analysis Detail) ────────────────────────── */
.nexus-timeline {
    position: relative;
    padding-left: 2rem;
}

.nexus-timeline::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e0e0e0;
}

.nexus-timeline-item {
    position: relative;
    margin-bottom: 1.25rem;
    padding-left: 1rem;
}

.nexus-timeline-item::before {
    content: '';
    position: absolute;
    left: -1.55rem;
    top: 0.35rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--nexus-primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--nexus-primary);
}

.nexus-timeline-item.completed::before { background: var(--nexus-success); box-shadow: 0 0 0 2px var(--nexus-success); }
.nexus-timeline-item.failed::before { background: var(--nexus-danger); box-shadow: 0 0 0 2px var(--nexus-danger); }
.nexus-timeline-item.cancelled::before { background: #78909C; box-shadow: 0 0 0 2px #78909C; }

.nexus-timeline-item .timeline-time {
    font-size: 0.78rem;
    color: #607D8B;
}

.nexus-timeline-item .timeline-label {
    font-weight: 600;
    color: #37474f;
}

/* ─── Example Items ─────────────────────────────────────── */
.nexus-example-item {
    border: 1px solid #e0e0e0;
    border-radius: var(--nexus-radius-sm);
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.nexus-example-item:hover {
    background: #e3f2fd;
    border-color: var(--nexus-primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.nexus-example-item .example-name {
    font-weight: 700;
    color: var(--nexus-primary);
    font-size: 0.95rem;
}

.nexus-example-item .example-desc {
    font-size: 0.8rem;
    color: #78909c;
}

/* ─── Citation Box ──────────────────────────────────────── */
.nexus-citation {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 1px solid #bbdefb;
    border-radius: var(--nexus-radius-sm);
    padding: 1rem 1.25rem;
}

.nexus-citation .cite-icon {
    color: var(--nexus-primary);
    font-size: 1.5rem;
    opacity: 0.8;
}

/* ─── Table Enhancements ────────────────────────────────── */
.nexus-table {
    border-collapse: separate;
    border-spacing: 0;
}

.nexus-table thead th {
    background: #f5f7fa;
    border-bottom: 2px solid var(--nexus-primary);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #546e7a;
    padding: 0.85rem 1rem;
}

.nexus-table tbody tr {
    transition: background 0.15s;
}

.nexus-table tbody tr:hover {
    background: #e3f2fd;
}

.nexus-table td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #eceff1;
}

/* ─── Empty State ───────────────────────────────────────── */
.nexus-empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.nexus-empty-state .empty-icon {
    font-size: 4rem;
    color: #78909C;
    margin-bottom: 1rem;
}

.nexus-empty-state h5 {
    color: #546e7a;
    margin-bottom: 0.5rem;
}

.nexus-empty-state p {
    color: #607D8B;
    margin-bottom: 1.5rem;
}

/* ─── Filter Bar ────────────────────────────────────────── */
.nexus-filter-bar {
    background: #f5f7fa;
    border-radius: var(--nexus-radius);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

/* ─── Workflow Steps (About page) ───────────────────────── */
.nexus-workflow-step {
    display: flex;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.nexus-workflow-step .step-number {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
}

.nexus-workflow-step .step-content {
    margin-left: 1rem;
}

.nexus-workflow-step .step-content h6 {
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.nexus-workflow-step .step-content p {
    color: #6c757d;
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* ─── Feature Box ───────────────────────────────────────── */
.nexus-feature-box {
    border: 1px solid #e0e0e0;
    border-radius: var(--nexus-radius-sm);
    padding: 1.25rem;
    height: 100%;
    transition: all 0.3s;
}

.nexus-feature-box:hover {
    transform: translateY(-5px);
    box-shadow: var(--nexus-card-hover-shadow);
    border-color: var(--nexus-primary-light);
}

.nexus-feature-box .feature-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn-nexus {
    background: linear-gradient(135deg, var(--nexus-primary) 0%, var(--nexus-primary-light) 100%);
    border: none;
    color: #fff;
    border-radius: var(--nexus-radius-sm);
    font-weight: 600;
    transition: all 0.3s;
}

.btn-nexus:hover {
    background: linear-gradient(135deg, var(--nexus-primary-dark) 0%, var(--nexus-primary) 100%);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.3);
}

/* ─── Pulse Animation ───────────────────────────────────── */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.4rem;
}

.status-dot.processing {
    background: #0288D1;
    animation: pulse 1.2s infinite;
}

.status-dot.completed { background: var(--nexus-success); }
.status-dot.failed { background: var(--nexus-danger); }
.status-dot.pending { background: var(--nexus-warning); animation: pulse 2s infinite; }
.status-dot.cancelled { background: #78909C; }

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .nexus-hero {
        padding: 1.5rem;
        border-radius: var(--nexus-radius-sm);
    }
    .nexus-hero h1 { font-size: 1.5rem; }
    .nexus-hero .hero-icon { display: none; }

    .nexus-stat-card .stat-value { font-size: 1.75rem; }

    .nexus-action-card .action-icon { width: 56px; height: 56px; font-size: 1.4rem; }

    .nexus-quality-gauge .gauge-ring { width: 90px; height: 90px; }
    .nexus-quality-gauge .gauge-value { font-size: 1.3rem; }
}

@media (max-width: 480px) {
    .nexus-hero { padding: 1rem; }
    .nexus-hero h1 { font-size: 1.25rem; }
    .nexus-stat-card .stat-value { font-size: 1.5rem; }
}
