/* ===== PlasmidNet Dashboard - Custom Styles ===== */

/* --- Reset & Base --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #faf7f2;
    color: #1e293b;
    line-height: 1.6;
}

.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- Header --- */
.header {
    background: linear-gradient(135deg, #ffffff 0%, #f0ebe3 100%);
    border-bottom: 1px solid #e2ddd5;
    padding: 14px 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-img {
    height: 80px;
    width: auto;
    display: block;
}

.header-brand {
    display: flex;
    align-items: baseline;
}

.brand-plasmid {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1e293b;
    letter-spacing: -0.5px;
}

.brand-net {
    font-size: 1.4rem;
    font-weight: 800;
    color: #e74c3c;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 0.85rem;
    color: #64748b;
    margin-left: 14px;
    font-weight: 400;
}

.header-links {
    display: flex;
    gap: 18px;
}

.header-link {
    color: #64748b;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.header-link:hover {
    color: #1e293b;
    background: #f0ebe3;
}

/* --- Main Content --- */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px;
    flex: 1;
    width: 100%;
}

/* --- Stat Cards --- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

/* --- Hero Banner --- */
.hero-banner {
    background: linear-gradient(135deg, #ffffff 0%, #f0ebe3 100%);
    border: 1px solid #e2ddd5;
    border-radius: 16px;
    padding: 28px 36px;
    margin-bottom: 24px;
}

.hero-inner {
    display: flex;
    align-items: center;
    gap: 32px;
}

.hero-logo {
    height: 110px;
    width: auto;
    flex-shrink: 0;
}

.hero-stats {
    flex: 1;
}

.hero-number {
    font-size: 3rem;
    font-weight: 800;
    color: #0d9488;
    margin: 0;
    line-height: 1;
    letter-spacing: -1px;
}

.hero-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 4px 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hero-breakdown {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.hero-tag {
    background: #ffffff;
    border: 1px solid #e2ddd5;
    border-radius: 8px;
    padding: 4px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #1e293b;
}

.hero-plus {
    color: #94a3b8;
    font-size: 1.1rem;
    font-weight: 600;
}

.hero-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hero-about {
    margin-top: 16px;
    border-top: 1px solid #e2ddd5;
    padding-top: 12px;
}

.about-toggle {
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: #0d9488;
    list-style: none;
}

.about-toggle::-webkit-details-marker {
    display: none;
}

.about-toggle::before {
    content: "\25B6  ";
    font-size: 0.7rem;
}

details[open] .about-toggle::before {
    content: "\25BC  ";
}

.about-text {
    margin-top: 12px;
    font-size: 0.88rem;
    color: #475569;
    line-height: 1.7;
    max-width: 900px;
    text-align: justify;
}

.about-text p {
    margin: 0 0 10px 0;
}

.about-text ul {
    margin: 8px 0 12px 20px;
    padding: 0;
}

.about-text li {
    margin-bottom: 4px;
}

@media (max-width: 640px) {
    .hero-inner {
        flex-direction: column;
        text-align: center;
    }
    .hero-logo {
        height: 80px;
    }
    .hero-breakdown, .hero-badges {
        justify-content: center;
    }
}

.stat-card {
    background: #ffffff;
    border: 1px solid #e2ddd5;
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.stat-icon {
    font-size: 2rem;
    opacity: 0.9;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: #64748b;
    margin: 2px 0 0 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* --- Tabs --- */
.tabs-container {
    margin-bottom: 24px;
}

.tab-container {
    border: none !important;
}

.tab-container .tab-list {
    flex-wrap: wrap !important;
}

.tab {
    background: #ffffff !important;
    border: 1px solid #e2ddd5 !important;
    border-radius: 8px 8px 0 0 !important;
    color: #64748b !important;
    font-weight: 500 !important;
    padding: 8px 16px !important;
    font-size: 0.85rem !important;
    margin-right: 3px !important;
    margin-bottom: 3px !important;
    transition: all 0.2s !important;
    white-space: nowrap !important;
}

.tab:hover {
    color: #1e293b !important;
    background: #f0ebe3 !important;
}

.tab--selected {
    background: #f0ebe3 !important;
    color: #0d9488 !important;
    border-bottom: 2px solid #0d9488 !important;
}

/* --- Chart Cards --- */
.chart-card {
    background: #ffffff;
    border: 1px solid #e2ddd5;
    border-radius: 12px;
    padding: 24px;
    transition: box-shadow 0.2s;
}

.chart-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

.chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.chart-subtitle {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0 0 12px 0;
}

/* --- Chart Grids --- */
.chart-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.chart-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.chart-grid-1 {
    margin-bottom: 16px;
}

/* --- Filter / Search --- */
.filter-row {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-top: 12px;
}

.filter-label {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 4px;
    font-weight: 500;
}

.filter-input {
    background: #faf7f2 !important;
    border: 1px solid #e2ddd5 !important;
    border-radius: 8px !important;
    color: #1e293b !important;
    padding: 8px 14px !important;
    font-size: 0.9rem !important;
    width: 240px !important;
    transition: border-color 0.2s !important;
}

.filter-input:focus {
    border-color: #0d9488 !important;
    outline: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, #0d9488, #6366f1);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 9px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: #0d9488;
    border: 1px solid #0d9488;
    border-radius: 8px;
    padding: 8px 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(13, 148, 136, 0.08);
    color: #0d9488;
}

/* --- Lookup --- */
.lookup-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
}

.lookup-input-wide {
    width: 360px !important;
}

.lookup-result {
    margin-top: 20px;
}

/* --- Detail Grid --- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.detail-item {
    background: #faf7f2;
    border: 1px solid #e2ddd5;
    border-radius: 8px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    margin-bottom: 4px;
}

.detail-value {
    font-size: 0.95rem;
    color: #1e293b;
    font-weight: 500;
    word-break: break-all;
}

/* --- Search Results --- */
.search-result {
    margin-top: 16px;
}

.result-count {
    font-size: 1rem;
    color: #10b981;
    font-weight: 600;
    margin-bottom: 12px;
}

/* --- Text Utils --- */
.text-muted {
    color: #64748b;
    font-size: 0.9rem;
}

.text-danger {
    color: #ef4444;
    font-size: 0.9rem;
}

/* --- Footer --- */
.footer {
    background: #ffffff;
    border-top: 1px solid #e2ddd5;
    padding: 18px 32px;
    text-align: center;
}

.footer p {
    color: #94a3b8;
    font-size: 0.8rem;
    margin: 0;
}

/* --- Download Bar --- */
.download-bar {
    background: #f0ebe3;
    border-top: 1px solid #e2ddd5;
    padding: 12px 32px;
}

.download-bar-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.download-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
}

.download-dropdown {
    font-size: 0.85rem;
}

.footer a {
    color: #0d9488;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* --- Loading --- */
._dash-loading {
    background: transparent !important;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .chart-grid-3 {
        grid-template-columns: 1fr;
    }
    .chart-grid-2 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
    .header-content {
        flex-direction: column;
        gap: 12px;
    }
    .header-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    .main-content {
        padding: 16px;
    }
    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-input {
        width: 100% !important;
    }
    .lookup-input-wide {
        width: 100% !important;
    }
    .lookup-row {
        flex-direction: column;
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #faf7f2;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Viewer Components --- */
.viewer-checklist {
    display: flex;
    align-items: center;
    gap: 8px;
}

.viewer-checklist label {
    color: #64748b;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.viewer-checklist input[type="checkbox"] {
    accent-color: #0d9488;
    width: 16px;
    height: 16px;
}

.ring-legend {
    display: flex;
    gap: 20px;
    margin: 16px 0 8px 0;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #64748b;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

.feature-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 16px 0;
}

.badge {
    background: #f0ebe3;
    color: #1e293b;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 20px;
    border: 1px solid #e2ddd5;
}

/* --- Plasmid Map Image --- */
.plasmid-map-img {
    width: 100%;
    max-width: 800px;
    display: block;
    margin: 16px auto;
    border-radius: 8px;
}

/* --- Correlation Section --- */
.section-header {
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.correlation-section {
    margin-bottom: 28px;
}

/* --- Analytics Table --- */
.analytics-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    font-size: 0.9rem;
}

.analytics-table th {
    background: #f0ebe3;
    color: #1e293b;
    font-weight: 600;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid #e2ddd5;
}

.analytics-table td {
    padding: 8px 14px;
    border-bottom: 1px solid #e2ddd5;
    color: #1e293b;
}

.analytics-table tr:hover td {
    background: #faf7f2;
}

/* --- Upload Area --- */
.upload-area {
    border: 2px dashed #e2ddd5;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    color: #64748b;
    font-size: 0.9rem;
    transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover {
    border-color: #0d9488;
    background: #f0fdf4;
}

.correlation-heading {
    font-size: 1.05rem;
    font-weight: 600;
    color: #0d9488;
    margin: 0 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2ddd5;
}

/* --- Plotly overrides --- */
.js-plotly-plot .plotly .modebar {
    top: 4px !important;
    right: 4px !important;
}
