/* ========================================
   GENERAL PAGE LAYOUT
   ======================================== */
body {
    font-family: 'Segoe UI', 'Inter', Arial, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

/* ========================================
   HEADER
   ======================================== */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2rem;
    background: linear-gradient(135deg, #ffffff 0%, #f9fbfc 100%);
    border-bottom: 2px solid #e0e8eb;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-radius: 8px;
    margin-bottom: 2rem;
}

#title {
    font-size: 2rem;
    font-weight: 700;
    color: #2c5aa0;
    margin: 0;
    letter-spacing: -0.5px;
}

.logo {
    height: 80px;
    width: auto;
    object-fit: contain;
}

/* ========================================
   TAB NAVIGATION
   ======================================== */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e0e8eb;
    margin: 2rem 0 0 0;
    flex-wrap: wrap;
    background-color: white;
    padding: 0.5rem;
    border-radius: 8px 8px 0 0;
}

.tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-radius: 6px;
    background-color: transparent;
    color: #555;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.tab:hover {
    background-color: #f0f4f8;
    color: #2c5aa0;
}

.tab.active {
    background-color: #2c5aa0;
    color: white;
    font-weight: 600;
}

/* ========================================
   TAB CONTENT
   ======================================== */
.tab-content {
    display: none;
    background-color: white;
    padding: 2rem;
    border-radius: 0 8px 8px 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================
   HEADINGS
   ======================================== */
h1 {
    color: #2c5aa0;
    font-size: 2.5em;
    margin-bottom: 0.5em;
}

h2 {
    color: #2c5aa0;
    font-size: 2em;
    margin-bottom: 0.8em;
    border-bottom: 2px solid #e0e8eb;
    padding-bottom: 0.5em;
}

h3 {
    color: #1e3f75;
    font-size: 1.5em;
    margin-bottom: 0.8em;
}

h4 {
    color: #2c5aa0;
    font-size: 1.1em;
    margin-bottom: 1em;
    font-weight: 600;
}

/* ========================================
   FORM STYLING
   ======================================== */
form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

form label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
    position: relative;
}

input[type="text"],
input[type="number"],
select {
    padding: 0.7rem 0.9rem;
    border: 1px solid #d0d8e0;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background-color: #fafbfc;
    width: 100%;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    outline: none;
    border-color: #2c5aa0;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(44, 90, 160, 0.1);
}

/* ========================================
   BUTTONS
   ======================================== */
button[type="submit"],
button[type="reset"],
.download-btn {
    padding: 0.7rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #2c5aa0 0%, #1e3a70 100%);
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button[type="submit"]:hover,
button[type="reset"]:hover,
.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #1e3f75 0%, #142851 100%);
}

button[type="reset"] {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}

.download-btn {
    display: inline-block;
    margin-right: 0.5rem;
}

/* ========================================
   TABLES
   ======================================== */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 2em 0;
    background-color: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

th {
    background-color: #2c5aa0;
    color: white;
    text-align: center;
    padding: 12px 15px;
    font-weight: 600;
    font-size: 0.95rem;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e8eb;
    text-align: center;
}

tr:hover {
    background-color: #f8fafb;
}

/* Table Column Widths - Tab 1 */
#geneTable th:nth-child(1), #geneTable td:nth-child(1) { width: 15%; }
#geneTable th:nth-child(2), #geneTable td:nth-child(2) { width: 8%; }
#geneTable th:nth-child(3), #geneTable td:nth-child(3) { width: 12%; }
#geneTable th:nth-child(4), #geneTable td:nth-child(4) { width: 10%; }
#geneTable th:nth-child(5), #geneTable td:nth-child(5) { width: 12%; }
#geneTable th:nth-child(6), #geneTable td:nth-child(6) { width: 10%; }
#geneTable th:nth-child(7), #geneTable td:nth-child(7) { width: 8%; }
#geneTable th:nth-child(8), #geneTable td:nth-child(8) { width: 8%; }
#geneTable th:nth-child(9), #geneTable td:nth-child(9) { width: 8%; }
#geneTable th:nth-child(10), #geneTable td:nth-child(10) { width: 12%; }
#geneTable th:nth-child(11), #geneTable td:nth-child(11) { width: 7%; }

/* Table Column Widths - Tab 2 */
#enhancerTable th:nth-child(1), #enhancerTable td:nth-child(1) { width: 18%; }
#enhancerTable th:nth-child(2), #enhancerTable td:nth-child(2) { width: 13%; }
#enhancerTable th:nth-child(3), #enhancerTable td:nth-child(3) { width: 15%; }
#enhancerTable th:nth-child(4), #enhancerTable td:nth-child(4) { width: 10%; }
#enhancerTable th:nth-child(5), #enhancerTable td:nth-child(5) { width: 10%; }

/* Table Column Widths - Tab 3 */
#activityClassTable th:nth-child(1), #activityClassTable td:nth-child(1) { width: 30%; }
#activityClassTable th:nth-child(2), #activityClassTable td:nth-child(2) { width: 20%; }
#activityClassTable th:nth-child(3), #activityClassTable td:nth-child(3) { width: 15%; }
#activityClassTable th:nth-child(4), #activityClassTable td:nth-child(4) { width: 20%; }
#activityClassTable th:nth-child(5), #activityClassTable td:nth-child(5) { width: 15%; }

/* ========================================
   INFO BOXES
   ======================================== */
.info-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.info-box {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafb 100%);
    border: 1px solid #e0e8eb;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    transition: all 0.3s ease;
    cursor: pointer;
}

.info-box:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(44, 90, 160, 0.15);
    border-color: #2c5aa0;
}

.info-box h4 {
    color: #2c5aa0;
    margin-top: 0;
}

.info-box p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: #555;
}

/* ========================================
   LISTS & LINKS
   ======================================== */
ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

ul li {
    margin: 0.5rem 0;
    line-height: 1.8;
}

a {
    color: #2c5aa0;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #1e3f75;
    text-decoration: underline;
}

/* ========================================
   PAGE DESCRIPTION
   ======================================== */
#description {
    font-size: 1.1rem;
    color: #555;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    background-color: #f8fafb;
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid #2c5aa0;
}

/* ========================================
   CHART CONTAINER
   ======================================== */
.chart-container {
    margin: 2rem 0;
    padding: 1.5rem;
    background-color: #f8fafb;
    border-radius: 8px;
    border: 1px solid #e0e8eb;
}

.chart-container h4 {
    margin-top: 0;
    color: #2c5aa0;
}

/* ========================================
   AUTOCOMPLETE
   ======================================== */
.autocomplete-suggestions {
    position: absolute;
    background: white;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
    width: calc(100% - 2px);
    margin-top: -1px;
}

.autocomplete-suggestions.active {
    display: block;
}

.autocomplete-suggestion {
    padding: 0.7rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.autocomplete-suggestion:last-child {
    border-bottom: none;
}

.autocomplete-suggestion:hover,
.autocomplete-suggestion.selected {
    background-color: #e8f4f8;
}

.autocomplete-suggestion .gene-symbol {
    font-weight: 600;
    color: #2c5aa0;
}

.autocomplete-suggestion .gene-id {
    font-size: 0.85em;
    color: #666;
    margin-left: 0.5rem;
}

.autocomplete-loading,
.autocomplete-no-results {
    padding: 0.7rem 1rem;
    text-align: center;
    color: #666;
}

.autocomplete-no-results {
    color: #999;
}

#gene_symbol.autocomplete-active {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* ========================================
   DATATABLES CUSTOMIZATION
   ======================================== */
.dataTables_wrapper .dataTables_paginate {
    margin-top: 1rem !important;
    text-align: center;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 0.5rem 0.8rem !important;
    margin: 0 0.2rem !important;
    border: 1px solid #d0d8e0 !important;
    border-radius: 4px !important;
    background-color: white !important;
    color: #2c5aa0 !important;
    cursor: pointer !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background-color: #f0f4f8 !important;
    border-color: #2c5aa0 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background-color: #2c5aa0 !important;
    color: white !important;
    border-color: #2c5aa0 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_info {
    margin-top: 1rem;
    color: #555;
    font-size: 0.9rem;
}

.dataTables_wrapper .dataTables_scroll {
    margin-bottom: 1rem;
}

.dataTables_wrapper .dataTables_scrollBody {
    border-bottom: 1px solid #e0e8eb !important;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    #title {
        font-size: 1.5rem;
    }

    .logo {
        height: 60px;
    }

    .tabs {
        gap: 0.25rem;
    }

    .tab {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .tab-content {
        padding: 1.5rem;
    }

    .info-boxes {
        grid-template-columns: 1fr;
    }

    button[type="submit"],
    button[type="reset"],
    .download-btn {
        width: 100%;
        margin: 0.25rem 0;
    }
}

/* ========================================
   VISUALIZATION LAYOUT
   ======================================== */
.viz-grid {
    display: grid;
    gap: 1.5rem;
    margin-top: 2rem;
}

.viz-grid.two-up {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.chart-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #dbe7f3;
    border-radius: 12px;
    padding: 1rem 1rem 0.5rem 1rem;
    box-shadow: 0 4px 14px rgba(44, 90, 160, 0.08);
}

.chart-card.full-width {
    grid-column: 1 / -1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2rem 0;
}

.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    border: 1px solid #dbe7f3;
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 4px 14px rgba(44, 90, 160, 0.08);
}

.stat-label {
    font-size: 0.9rem;
    color: #5b6b7a;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.stat-value {
    font-size: 1.5rem;
    color: #1e3f75;
    font-weight: 700;
}

/* ========================================
   TABLE ALIGNMENT
   ======================================== */
table,
th,
td {
    text-align: center;
    vertical-align: middle;
}

/* keep merged cells vertically centered */
#geneTable td[rowspan],
#geneTable th[rowspan] {
    vertical-align: middle;
}

/* ========================================
   CONSISTENT FORM CONTROL SIZING
   ======================================== */
input[type="text"],
input[type="number"],
select {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    min-height: 44px;
    height: 44px;
}

form label {
    width: 100%;
}

/* make gene info table centered and tidy */
#geneInfo td,
#geneInfo th {
    text-align: center;
    vertical-align: middle;
}