/* --- CSS VARIABLES --- */
:root {
    --main-purple: #4b00ff;
    --accent-purple: #7c4dff;
    --dark-bg: #0a0a1a;
    --text-gray: #94a3b8;
}

/* --- BASE --- */
body {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    background-color: var(--dark-bg);
}

/* --- NAVBAR --- */
/* dark: top bar matches the antibody-table panel colour (#1c2040),
   mirroring light mode where the bar and the table panels are both white */
.navbar-custom {
    background-color: #1c2040 !important;
    border-bottom: 1px solid rgba(124,77,255,0.38) !important;
    padding: 9px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-custom .navbar-brand {
    font-weight: 800 !important;
    font-size: 24px !important;
    color: #ffffff !important;
    letter-spacing: 0.5px;
    background: none;
    -webkit-text-fill-color: initial;
}

/* Nav links (A4D Server / About) — plain white in dark mode, no blue tint/shadow.
   Overrides Bootstrap's default .nav>li>a:hover (flat #eee background), which
   read as an ugly white box and made a light hover colour unreadable on it. */
.navbar-custom .navbar-nav > li > a {
    color: #ffffff !important;
    text-shadow: none !important;
    border-radius: 6px;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.navbar-custom .navbar-nav > li > a:hover,
.navbar-custom .navbar-nav > li > a:focus {
    background-color: rgba(124,77,255,0.25) !important;
    color: #ffffff !important;
}

/* --- BACKGROUND --- */
.bg-image {
    background: linear-gradient(rgba(10,10,30,0.78), rgba(10,10,26,0.82)),
                url('../img/protein_bg.png');
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
}

/* --- HEADINGS --- */
.title-main {
    color: white;
    font-weight: 800;
    font-size: 50px;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

/* --- STAT TILES (large) --- */
.banner-middle {
    background: linear-gradient(135deg, #232845 0%, #171e38 100%);
    color: white;
    padding: 35px 30px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 22px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 0 1px rgba(124,77,255,0.35);
    border: 1px solid rgba(124,77,255,0.35);
    min-width: 280px;
    text-align: center;
    transition: all 0.3s ease;
}

.banner-middle:hover {
    transform: translateY(-10px);
    border-color: var(--main-purple);
}

/* --- SEARCH BOX --- */
.search-box-custom {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 15px;
    margin: 0 auto 50px auto;
    max-width: 800px;
    display: flex;
    border: 1px solid rgba(255,255,255,0.1);
}

/* --- TABLE WIDTH & LAYOUT --- */

/* 1. Wide container */
.container {
    width: 98% !important;
    max-width: 1800px !important;
}

/* --- TABLE WRAPPER --- */

.table-main-wrapper {
    background-color: #1c2040 !important;
    border-radius: 20px !important;
    padding: 25px !important;
    margin-top: 30px !important;
    border: 1px solid rgba(124,77,255,0.38) !important;
    box-shadow: 0 4px 32px rgba(0,0,0,0.5) !important;
}

.table-main-wrapper h3,
.dataTables_info,
.dataTables_length label {
    color: #ffffff !important;
}

#antibodyTable {
    background-color: transparent !important;
    border-collapse: separate !important;
    border-spacing: 0 8px !important;
    width: 100% !important;
}

/* Header sort arrows */
#antibodyTable thead th {
    color: #94a3b8 !important;
    text-transform: uppercase;
    font-size: 11px !important;
    font-weight: 700 !important;
    padding: 15px 10px !important;
    border: none !important;
    background: transparent !important;
}

/* --- WIDE CONTAINER --- */

body > .container,
.bg-image .container,
div.container {
    width: 97% !important;
    max-width: 1900px !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
}

.table-main-wrapper {
    width: 100% !important;
    overflow: visible !important;
    padding: 28px 28px 20px 28px !important;
}

.table-responsive {
    overflow-x: visible !important;
    border: none !important;
    width: 100% !important;
}

#antibodyTable {
    width: 100% !important;
    table-layout: fixed !important;
}

/* Column widths — proportional to content */
#antibodyTable thead th:nth-child(1)  { width: 9%;  }   /* ID */
#antibodyTable thead th:nth-child(2)  { width: 13%; }   /* Name */
#antibodyTable thead th:nth-child(3)  { width: 8%;  }   /* Target */
#antibodyTable thead th:nth-child(4)  { width: 11%; }   /* Therapeutic Area */
#antibodyTable thead th:nth-child(5)  { width: 8%;  }   /* Clinical Status */
#antibodyTable thead th:nth-child(6)  { width: 7%;  }   /* Isotype */
#antibodyTable thead th:nth-child(7)  { width: 11%; }   /* Company */
#antibodyTable thead th:nth-child(8)  { width: 5%;  }   /* Structures */
#antibodyTable thead th:nth-child(9)  { width: 9%;  }   /* Max Seq */
#antibodyTable thead th:nth-child(10) { width: 9%;  }   /* Avg A4D */
#antibodyTable thead th:nth-child(11) { width: 0;   }   /* hidden */

#antibodyTable thead th,
#antibodyTable tbody td {
    overflow: hidden !important;
    text-overflow: ellipsis;
    white-space: nowrap !important;
}


/* --- TABLE HEADER STYLES --- */

#antibodyTable thead th {
    padding: 14px 26px 14px 14px !important;
    white-space: nowrap !important;
    position: relative !important;
    vertical-align: middle !important;
    font-size: 12.5px !important;
    letter-spacing: 0.03em !important;
    color: #e2e8f0 !important;
    text-transform: none !important;
    font-weight: 600 !important;
    border: none !important;
    background: transparent !important;
    line-height: 1.3 !important;
}

table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc {
    background-position: right 7px center !important;
    padding-right: 26px !important;
}

table.dataTable thead th.sorting:after       { opacity: 0.3  !important; color: #a78bfa !important; }
table.dataTable thead th.sorting_asc:after,
table.dataTable thead th.sorting_desc:after  { opacity: 1    !important; color: #7c4dff !important; }

/* Info icons */
#antibodyTable thead th .fa-info-circle {
    opacity: 0.55;
    font-size: 11px;
    vertical-align: middle;
    margin-left: 4px;
    cursor: help;
    pointer-events: all !important;
    color: #7c4dff;
    transition: opacity 0.15s, color 0.15s;
}

#antibodyTable thead th .fa-info-circle:hover {
    opacity: 1;
    color: #c4b5fd;
}

/* Separator below header row */
#antibodyTable thead tr {
    border-bottom: 2px solid rgba(124, 77, 255, 0.3) !important;
}


/* --- TABLE ROWS --- */

#antibodyTable tbody tr {
    transition: background-color 0.15s ease, transform 0.12s ease;
    cursor: pointer;
}

#antibodyTable tbody tr td {
    background-color: #1e2a4a !important;
    color: #e2e8f0 !important;
    padding: 13px 12px !important;
    border: none !important;
    vertical-align: middle !important;
    transition: background-color 0.15s ease;
}

#antibodyTable tbody tr td:first-child { border-radius: 8px 0 0 8px !important; }
#antibodyTable tbody tr td:last-child  { border-radius: 0 8px 8px 0 !important; }

#antibodyTable tbody tr:hover td {
    background-color: rgba(95, 0, 255, 0.3) !important;
    color: #ffffff !important;
}

#antibodyTable tbody tr:hover {
    transform: translateX(4px);
}

#antibodyTable tbody tr:hover a.id-link,
#antibodyTable tbody tr:hover a.name-link {
    color: #c4b5fd !important;
}


/* --- HERO TITLE --- */

.title-main {
    background: linear-gradient(125deg, #ffffff 20%, #c4b5fd 70%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px !important;
    filter: drop-shadow(0 0 50px rgba(167,139,250,0.35));
    line-height: 1.1 !important;
}


/* --- SUBTITLE --- */

.index-text {
    color: #f1f5f9 !important;
    font-size: 21px !important;
    font-weight: 700 !important;
    letter-spacing: 0.005em !important;
    margin-bottom: 12px !important;
    opacity: 1 !important;
    text-shadow: 0 2px 20px rgba(0,0,0,0.9) !important;
    text-transform: none;
}

.index-tagline {
    color: #cbd5e0 !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    letter-spacing: 0.02em !important;
    margin-bottom: 44px !important;
    text-shadow: 0 2px 16px rgba(0,0,0,0.9) !important;
}

body.light-theme .index-tagline {
    color: #55507e !important;
    text-shadow: none !important;
}


/* --- STAT TILES --- */

.banner-middle {
    font-size: 15.5px !important;
    line-height: 1.25 !important;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease !important;
}

.banner-middle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -80%;
    width: 45%;
    height: 200%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.06), transparent);
    transform: skewX(-20deg);
    transition: left 0.55s ease;
    pointer-events: none;
}

.banner-middle:hover::before { left: 140%; }

.banner-middle:hover {
    transform: translateY(-8px) !important;
    border-color: rgba(124, 77, 255, 0.6) !important;
    box-shadow: 0 20px 40px rgba(95,0,255,0.25), 0 0 0 1px rgba(124,77,255,0.4) !important;
}


/* --- SEARCH BUTTON --- */

.btn-search-new {
    transition: transform 0.1s ease, box-shadow 0.15s ease !important;
}

.btn-search-new:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 22px rgba(95,0,255,0.55) !important;
}

.btn-search-new:active {
    transform: translateY(1px) !important;
    box-shadow: none !important;
}


/* --- ADVANCED SEARCH --- */

.search-section a[onclick="toggleAdvanced()"] {
    color: #a78bfa !important;
    border-bottom-color: rgba(167,139,250,0.5) !important;
    transition: color 0.2s, border-bottom-color 0.2s;
}

.search-section a[onclick="toggleAdvanced()"]:hover {
    color: #e9d5ff !important;
    border-bottom-color: #e9d5ff !important;
}


/* --- DOMAIN BADGES --- */

#antibodyTable tbody span.domain-badge {
    padding: 4px 9px !important;
    border-radius: 5px !important;
    font-size: 9.5px !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: inline-block;
}

.badge-oncology     { background: rgba(74,222,128,0.12)  !important; color: #4ade80 !important; border: 1px solid rgba(74,222,128,0.28)  !important; }
.badge-inflammation { background: rgba(251,113,133,0.12) !important; color: #fb7185 !important; border: 1px solid rgba(251,113,133,0.28) !important; }
.badge-allergy      { background: rgba(251,191,36,0.12)  !important; color: #fbbf24 !important; border: 1px solid rgba(251,191,36,0.28)  !important; }


/* --- BADGE COUNT --- */

#antibodyTable tbody span.badge-count {
    background: linear-gradient(135deg, #5F00FF, #7c4dff) !important;
    color: white !important;
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    font-weight: 700;
    font-size: 12px;
    box-shadow: 0 2px 8px rgba(95,0,255,0.35);
}


/* --- TABLE LINKS --- */

#antibodyTable a.id-link {
    color: #7c4dff !important;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.02em;
}

#antibodyTable a.id-link:hover { color: #c4b5fd !important; text-decoration: underline; }

#antibodyTable a.name-link { color: #f1f5f9 !important; font-weight: 600; text-decoration: none; }
#antibodyTable a.name-link:hover { color: #a78bfa !important; }


/* --- SCORE DIFF --- */

#antibodyTable tbody td.text-danger {
    color: #fb7185 !important;
    font-weight: 600;
}


/* --- PAGINATION --- */

.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_length label {
    color: #94a3b8 !important;
    font-size: 12px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #94a3b8 !important;
    border-radius: 6px !important;
    border: none !important;
    transition: background 0.15s, color 0.15s;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: linear-gradient(135deg, #5F00FF, #7c4dff) !important;
    border-color: transparent !important;
    color: white !important;
    box-shadow: 0 2px 10px rgba(95,0,255,0.4);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: rgba(95,0,255,0.18) !important;
    border-color: transparent !important;
    color: #e2e8f0 !important;
}


/* --- RESET BUTTON --- */

#resetTable {
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}

#resetTable:hover {
    background: #7c4dff !important;
    box-shadow: 0 4px 14px rgba(95,0,255,0.5);
    transform: translateY(-1px);
}

#resetTable:active {
    transform: translateY(1px);
    box-shadow: none;
}


/* --- SCROLLBAR --- */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); }
::-webkit-scrollbar-thumb { background: rgba(95,0,255,0.45); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(95,0,255,0.75); }


/* --- TABLE SECTION HEADER --- */

.table-main-wrapper h3 {
    color: #f1f5f9 !important;
    font-weight: 700 !important;
}

.table-main-wrapper h3 small {
    color: #64748b !important;
    font-size: 13px !important;
}


/* --- RESPONSIVE --- */

/* Tablet (≤ 1024px) */
@media (max-width: 1024px) {
    body > .container,
    .bg-image .container,
    div.container {
        width: 99% !important;
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    .title-main {
        font-size: 38px !important;
    }

    .index-text {
        font-size: 17px !important;
    }

    .banner-middle {
        font-size: 12.5px !important;
        min-width: 200px;
        padding: 24px 20px !important;
    }
}

/* Mobile / small laptop (≤ 768px) */
@media (max-width: 768px) {
    .title-main {
        font-size: 28px !important;
    }

    .index-text {
        font-size: 13.5px !important;
        letter-spacing: 0.01em !important;
    }

    /* Stack banner tiles vertically */
    .bg-image .container > div[style*="display: flex"][style*="justify-content: center"] {
        flex-direction: column !important;
        align-items: center !important;
        gap: 12px !important;
    }

    .banner-middle {
        width: 90% !important;
        min-width: unset !important;
        font-size: 11.5px !important;
        padding: 18px 16px !important;
    }

    .search-box-custom {
        flex-direction: column !important;
        gap: 8px !important;
        padding: 12px !important;
    }

    .search-box-custom input,
    .search-box-custom button {
        width: 100% !important;
        border-radius: 10px !important;
    }

    /* Table horizontal scroll on small screens */
    .table-responsive {
        overflow-x: auto !important;
    }

    #antibodyTable {
        table-layout: auto !important;
        min-width: 900px;
    }

    .table-main-wrapper {
        padding: 16px !important;
    }
}


/* =====================================================================
   THEME TOGGLE BUTTON
   ===================================================================== */

/* ---- PILL THEME TOGGLE ---- */
.theme-toggle-btn {
    /* lives inside the sticky navbar, anchored just below its bottom edge —
       this keeps it clear of nav links on every screen width/zoom without
       needing to reserve space in the nav itself */
    position: absolute;
    top: calc(100% + 10px);
    right: 20px;
    z-index: 999;
    background: rgba(20,16,40,0.75);
    border: 1px solid rgba(124,77,255,0.35);
    border-radius: 30px;
    padding: 4px 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 2px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.35);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}
.theme-toggle-btn:hover {
    border-color: rgba(124,77,255,0.6);
    box-shadow: 0 4px 16px rgba(95,0,255,0.25);
}
.theme-toggle-btn:focus { outline: none; }

.toggle-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background 0.25s, color 0.25s;
    color: #6b7280;
}

/* dark mode: moon active */
.toggle-icon.t-moon { background: rgba(124,77,255,0.4); color: #e9d5ff; }
.toggle-icon.t-sun  { background: transparent; color: #6b7280; }

/* light mode: sun active */
body.light-theme .toggle-icon.t-moon { background: transparent; color: #9ca3af; }
body.light-theme .toggle-icon.t-sun  { background: rgba(124,77,255,0.2); color: #7c3aed; }

body.light-theme .theme-toggle-btn {
    background: rgba(255,255,255,0.9);
    border-color: rgba(124,77,255,0.3);
    box-shadow: 0 2px 10px rgba(124,77,255,0.12);
}
body.light-theme .theme-toggle-btn:hover {
    border-color: rgba(124,77,255,0.55);
    box-shadow: 0 4px 16px rgba(124,77,255,0.18);
}


/* =====================================================================
   LIGHT THEME
   ===================================================================== */

body.light-theme { background-color: #f0f2f8; color: #1e1b4b; }

body.light-theme .navbar-custom {
    background-color: rgba(255,255,255,0.97) !important;
    border-bottom: 1px solid rgba(124,77,255,0.2) !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
body.light-theme .navbar-custom .navbar-brand { color: #3730a3 !important; }
body.light-theme .navbar-custom .navbar-nav > li > a { color: #4c1d95 !important; }
body.light-theme .navbar-custom .navbar-nav > li > a:hover { color: #7c3aed !important; }

body.light-theme .bg-image {
    background: linear-gradient(rgba(240,238,255,0.84), rgba(235,233,255,0.90)),
                url('../img/protein_bg.png');
}

body.light-theme .title-main {
    background: linear-gradient(125deg, #3730a3 20%, #7c3aed 70%, #a855f7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: none;
}

body.light-theme .index-text {
    color: #4c1d95 !important;
    text-shadow: none !important;
}

body.light-theme .banner-middle {
    background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
    color: #3730a3;
    border: 1px solid rgba(124,77,255,0.3);
    box-shadow: 0 8px 32px rgba(124,77,255,0.12), 0 0 0 1px rgba(124,77,255,0.2);
}
body.light-theme .banner-middle:hover {
    border-color: rgba(124,77,255,0.6) !important;
    box-shadow: 0 20px 40px rgba(124,77,255,0.2), 0 0 0 1px rgba(124,77,255,0.35) !important;
}
body.light-theme .banner-middle span { color: #3730a3 !important; }

body.light-theme .search-box-custom {
    background: rgba(124,77,255,0.07);
    border: 1px solid rgba(124,77,255,0.2);
}
body.light-theme .search-box-custom input { background: #fff !important; color: #1e1b4b !important; }

body.light-theme .table-main-wrapper {
    background-color: #ffffff !important;
    border: 1px solid rgba(124,77,255,0.28) !important;
    box-shadow: 0 4px 32px rgba(124,77,255,0.1) !important;
}
body.light-theme .table-main-wrapper h3 { color: #3730a3 !important; }
body.light-theme .table-main-wrapper h3 small { color: #6b7280 !important; }

body.light-theme .dataTables_wrapper .dataTables_info,
body.light-theme .dataTables_wrapper .dataTables_length label { color: #4b5563 !important; }
body.light-theme .dataTables_wrapper .dataTables_paginate .paginate_button { color: #4b5563 !important; }
body.light-theme .dataTables_wrapper .dataTables_paginate .paginate_button:hover { color: #3730a3 !important; background: rgba(124,77,255,0.1) !important; }

body.light-theme #antibodyTable thead th { color: #3730a3 !important; }
body.light-theme #antibodyTable thead tr { border-bottom: 2px solid rgba(124,77,255,0.2) !important; }
body.light-theme #antibodyTable tbody tr td { background-color: #f5f3ff !important; color: #1e1b4b !important; }
body.light-theme #antibodyTable tbody tr:hover td { background-color: rgba(124,77,255,0.12) !important; color: #3730a3 !important; }
body.light-theme #antibodyTable a.id-link { color: #7c3aed !important; }
body.light-theme #antibodyTable a.id-link:hover { color: #4c1d95 !important; }
body.light-theme #antibodyTable a.name-link { color: #1e1b4b !important; }
body.light-theme #antibodyTable a.name-link:hover { color: #7c3aed !important; }
body.light-theme #antibodyTable tbody td.text-danger { color: #dc2626 !important; }

body.light-theme ::-webkit-scrollbar-track { background: rgba(124,77,255,0.05); }
body.light-theme ::-webkit-scrollbar-thumb { background: rgba(124,77,255,0.35); }

/* form controls */
body.light-theme .form-control {
    background-color: #ffffff !important;
    color: #1e1b4b !important;
    border-color: rgba(124,77,255,0.25) !important;
}
body.light-theme .form-control::placeholder { color: #9ca3af !important; }

/* advanced search toggle link */
body.light-theme .search-section > div > a[onclick="toggleAdvanced()"] {
    color: #4c1d95 !important;
    border-bottom-color: rgba(76,29,149,0.4) !important;
}

/* advanced panel */
body.light-theme #advancedPanel {
    background: rgba(240,237,255,0.97) !important;
    border-color: rgba(124,77,255,0.25) !important;
    color: #1e1b4b !important;
}
body.light-theme #advancedPanel label { color: #4b5563 !important; }
body.light-theme #advancedPanel #scoreVal,
body.light-theme #advancedPanel #structVal,
body.light-theme #advancedPanel #seqIdVal { color: #7c3aed !important; }