/* Import Google Fonts: Montserrat for Titles, Roboto for Body */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');

/* Basic Page Layout */
html {
    position: relative;
    min-height: 100%;
}

body {
    color: #4d4d4d; /* Grey content text */
    background-color: #EEEEEE; /* Beige background from your palette */
    font-family: "Roboto", sans-serif;
    font-size: 18px;
    line-height: 1.55;
    margin: 0;
    padding-bottom: 80px; /* Space for the footer */
}

/* Typography with Montserrat for Titles */
h1, h2, h3, h4, .navbar-brand {
    font-family: "Montserrat", sans-serif;
    font-weight: 700;
    color: #404f7c; /* Dark blue */
    margin-top: 18px;
}

/* Links */
a {
    color: #404f7c;
    text-decoration: none;
    transition: 0.2s;
}

a:hover {
    color: #85dafa; /* Light blue on hover */
    text-decoration: underline;
}

/* Main Container */
.page-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 12px;
}

/* MCAtlas Card Styling */
.card {
    border: 1px solid #e6e6e6;
    border-radius: 12px;
    padding: 14px 16px;
    background: #ffffff;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.card h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
}

/* Two-column Grid */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: stretch;
}

/* Callouts */
.callout {
    margin-top: 10px;
    padding: 10px 12px;
    border-left: 4px solid #404f7c; /* Dark blue border */
    background: #f7f9ff;
    border-radius: 8px;
}

.muted {
    color: #666666;
    font-size: 13px;
}

.hr-soft {
    border: 0;
    border-top: 1px solid #efefef;
    margin: 20px 0;
}

/* Search Bar & Autocomplete Styling */
.search-container {
    margin: 40px auto;
    max-width: 800px;
    position: relative;
}

#microbe-search {
    width: 100%;
    padding: 15px;
    font-size: 20px;
    font-family: "Roboto", sans-serif;
    border: 2px solid #404f7c;
    border-radius: 8px;
    outline: none;
    box-sizing: border-box;
}

#search-results {
    position: absolute;
    width: 100%;
    background: white;
    border: 1px solid #e6e6e6;
    border-top: none;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #efefef;
    text-align: left;
    font-size: 16px;
}

.result-item:hover {
    background: #f7f9ff;
    color: #404f7c;
}

/* Passport Badge Styling */
.badge-id {
    background: #e6e6e6;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 13px;
    color: #4d4d4d;
    cursor: pointer;
    display: inline-block;
}

.badge-id:hover {
    background: #dcdcdc;
}

/* Navigation Bar */
.navbar {
    background-color: #404f7c;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    color: white !important;
    font-size: 24px;
    margin: 0;
    text-decoration: none;
}

/* Footer */
footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 40px;
    background-color: #393E46;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copyright {
    font-size: 14px;
    color: #EEEEEE;
}

/* Pro-style Global Logo Control */
.logo-container {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 40px;
}

.logo-main {
    max-width: 350px;
    width: 80%;
    height: auto;
    transition: transform 0.3s ease;
}

/* Subtle pro touch: slight hover effect */
.logo-main:hover {
    transform: scale(1.02);
}

/* Highlight state for keyboard navigation */
.result-item.selected {
    background-color: #f1f3f4;
    outline: none;
}

/* Anchor the container */
.google-search-container {
    position: relative;
    margin: 20px auto 40px auto;
    max-width: 600px;
    text-align: left;
}

/* Fix the dropdown width and behavior */
#search-results {
    position: absolute;
    top: 100%; /* Sits exactly below the input */
    left: 0;
    right: 0;   /* Forces it to match the width of the container */
    background: white;
    border: 1px solid #dfe1e5;
    border-top: none;
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    border-radius: 0 0 24px 24px;
    box-shadow: 0 4px 6px rgba(32,33,36,0.1);
    /* Prevent the box from expanding */
    box-sizing: border-box; 
}

.result-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Keeps long names from breaking the box */
}

.result-item.selected {
    background-color: #f1f3f4;
}

/* Pathobiont horizontal list styling */
.pb-container { display: flex; gap: 8px; flex-wrap: wrap; }
.pb-item { padding: 4px 10px; border-radius: 3px; font-weight: bold; font-size: 10px; text-transform: uppercase; background: #f0f0f0; color: #aaa; border: 1px solid #eee; }
/* Bright blue for the active 'yes' selection */
.pb-active-yes { background: #007bff; color: #fff; border-color: #0056b3; }
/* Standard black or neutral for other active selections */
.eg-active-other { background: #333; color: #fff; border-color: #000; }

/* New lines: CSS for the evidence level hover tooltip */
.ev-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    border-bottom: 1px dotted #888;
}

.ev-tooltip .ev-tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #fff;
    color: #333;
    text-align: left;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    position: absolute;
    z-index: 10;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s;
}

/* Ensure the span class looks correct inside the popup */
.ev-tooltip .ev-tooltiptext .dict-term {
    font-weight: 800;
    font-size: 13px;
    color: #000;
    display: block;
}

.ev-tooltip:hover .ev-tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* ── Responsive breakpoints ──────────────────────────────────────── */

/* Navbar: stack brand + links on small screens */
@media (max-width: 600px) {
    .navbar {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .navbar-brand {
        font-size: 20px;
    }
}

/* Two-column grid: collapse to single column */
@media (max-width: 700px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Search: tighten top margin and font size on mobile */
@media (max-width: 600px) {
    .google-search-container {
        margin-top: 30px !important;
    }
    #microbe-search {
        font-size: 16px;
        padding: 12px;
    }
}

/* ── Result cards (search results and Pathway page) ── */
.sr-section { margin-top: 34px; }
.sr-section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; color: #404f7c; margin: 0 0 4px; }
.sr-note { font-size: 13px; color: #777; margin: 0 0 12px; }
/* Taxa table: same look as the /passports table */
.sr-table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 600px; }
.sr-table thead tr { background-color: #f8f9fa; border-bottom: 2px solid #eee; text-align: left; }
.sr-table th { text-align: left; padding: 12px 15px; }
.sr-table td { padding: 12px 15px; vertical-align: top; }
.sr-table tr.sr-row { border-bottom: 1px solid #eee; cursor: pointer; transition: background-color 0.2s ease; }
.sr-table tr.sr-row:hover { background-color: #fcfcfc; }
.sr-table tr.sr-row:last-child { border-bottom: none; }
.sr-count { font-size: 13px; color: #666; text-align: right; margin-bottom: 14px; }
.sr-sub { font-size: 11px; color: #999; margin-top: 3px; }
.sr-grade { display: inline-block; padding: 1px 7px; border-radius: 3px; font-size: 11px; font-weight: 800; }
.sr-E3 { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.sr-E2 { background: #fef3c7; color: #92400e; border: 1px solid #fbbf24; }
.sr-E1 { background: #f3f4f6; color: #6b7280; border: 1px solid #d1d5db; }
.sr-dir { white-space: nowrap; color: #444; }
.sr-dir span { margin-right: 8px; }
.sr-taxon { margin-bottom: 22px; }
.sr-taxon-head { margin: 0 0 8px; }
.sr-taxon-head .sr-name { font-size: 16px; }
.sr-taxon-head .sr-sub { margin-left: 8px; }
.sr-assoc { display: flex; gap: 14px; align-items: flex-start; background: #fafafa; border: 1px solid #eee; border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; }
.sr-assoc .sr-grade { flex-shrink: 0; width: 30px; text-align: center; padding: 6px 0; }
.sr-assoc-body { flex: 1; min-width: 0; }
.sr-assoc-text { font-size: 14px; font-weight: 600; color: #222; line-height: 1.45; }
.sr-assoc-pmid { font-size: 12px; color: #888; margin-top: 4px; font-weight: 700; }
.sr-assoc-refs { margin-top: 6px; font-size: 13px; color: #444; display: flex; flex-wrap: wrap; row-gap: 6px; }   /* tags wrap onto new lines */
.sr-ref { margin-right: 12px; white-space: nowrap; }
.sr-ref-id { display: inline-block; padding: 1px 5px; border-radius: 3px; font-size: 11px; font-weight: 700; font-family: monospace; text-decoration: none; }
.sr-ref-mesh { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.sr-ref-kegg { background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; }
.sr-group { margin-top: 30px; }
.sr-group h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 1.5px; color: #404f7c; margin: 0 0 12px; }
.sr-group h3 .sr-sub { text-transform: none; letter-spacing: 0; margin-left: 6px; }
.sr-rel { flex-shrink: 0; display: inline-block; padding: 6px 0; width: 70px; text-align: center; border-radius: 3px; font-size: 10px; font-weight: 800; text-transform: uppercase; background: #eef0f8; color: #404f7c; border: 1px solid #c8cde8; }
.sr-quote { font-size: 13px; color: #555; font-style: italic; margin-top: 4px; line-height: 1.45; }
.sr-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 22px 0 0; border-bottom: 2px solid #d8dbe6; }
.sr-tab { background: none; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px; padding: 8px 12px; font: inherit; font-size: 14px; font-weight: 600; color: #666; cursor: pointer; }
.sr-tab:hover { color: #404f7c; }
.sr-tab.active { color: #404f7c; border-bottom-color: #404f7c; }
.sr-tab-n { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 10px; font-size: 11px; background: #eef0f8; color: #404f7c; border: 1px solid #c8cde8; }

/* Shared display elements, used on every page */
/* Taxon name: italic bold; black where the name is the page or row subject, navy where it links to a passport */
.taxon-name { font-style: italic; font-weight: 700; color: #000; }
.table-row-link:hover .taxon-name, .passport-card:hover .taxon-name { text-decoration: underline; }
.taxon-link, a.taxon-link { font-style: italic; font-weight: 700; color: #404f7c; text-decoration: none; cursor: pointer; }
.taxon-link:hover, a:hover .taxon-link, .sr-row:hover .taxon-link, .cooc-chip:hover .taxon-link { color: #404f7c; text-decoration: underline; }
/* Taxon rank: grey pill, value capitalised */
.badge-rank { display: inline-block; background: #f0f0f0; color: #4d4d4d; padding: 2px 8px; border-radius: 4px; font-size: 12px; font-weight: 400; font-style: normal; line-height: 1.4; text-transform: capitalize; white-space: nowrap; }
/* Passport ID shown as text */
.passport-id { font-family: monospace; font-size: 11px; color: #888; font-weight: 400; white-space: nowrap; }
/* PubMed links */
a.pmid-link { color: #007bff; font-size: 12px; font-weight: 400; text-decoration: none; }
a.pmid-link:hover { color: #007bff; text-decoration: underline; }

/* Top-level page title (About, Passports, Pathways, Literature, Glossary) */
h1.page-title { font-size: 28px; color: #404f7c; margin: 0 0 10px; }

/* Pathobiont badge: YES blue, CD dark grey, NO grey; nothing is shown for not stated */
.pc-pathobiont-yes { display: inline-block; white-space: nowrap; padding: 2px 8px; border-radius: 3px; font-size: 10px; font-weight: 700; font-style: normal; text-transform: uppercase; background: #007bff; color: #fff; }
.pc-pathobiont-other { display: inline-block; white-space: nowrap; padding: 2px 8px; border-radius: 3px; font-size: 10px; font-weight: 700; font-style: normal; text-transform: uppercase; background: #f3f4f6; color: #6b7280; border: 1px solid #d1d5db; }
.pc-pathobiont-context { display: inline-block; white-space: nowrap; padding: 2px 8px; border-radius: 3px; font-size: 10px; font-weight: 700; font-style: normal; text-transform: uppercase; background: #4b5563; color: #fff; }

/* Clinical role pills: navy by default (commensal), one colour per role; class role-<role, lowercase, non-letters as '-'> */
.role-pill { display: inline-block; margin: 2px 4px 2px 0; padding: 3px 9px; border-radius: 12px; font-size: 11px; font-weight: 600; font-style: normal; line-height: 1.3; white-space: nowrap; background: #f0f4ff; color: #404f7c; border: 1px solid #d0d8f0; }
.pc-role-pill { display: inline-block; padding: 2px 7px; border-radius: 3px; font-size: 10px; font-style: normal; background: #f0f4ff; color: #404f7c; border: 1px solid #d0d8f0; }
.role-pill.role-opportunistic-pathogen, .pc-role-pill.role-opportunistic-pathogen { background: #fdecec; color: #9b1c1c; border-color: #f5b5b5; }
.role-pill.role-protective-commensal, .pc-role-pill.role-protective-commensal { background: #e3f4f1; color: #115e59; border-color: #a3d9d1; }
.role-pill.role-probiotic-candidate, .pc-role-pill.role-probiotic-candidate { background: #f3ebfb; color: #6b2fa0; border-color: #d6bdf0; }
.role-pill.role-coloniser, .pc-role-pill.role-coloniser { background: #f6f0e6; color: #7a5a2f; border-color: #e2d1b6; }

/* Lineage crumbs, separated by ' › ' */
.lineage-crumb { color: #888; font-size: 13px; }
.lineage-sep { color: #ccc; font-size: 12px; }

/* "Expert reviewed" mark (site_config.php expert_icon) */
.xr-icon { display: inline-flex; width: 16.8px; height: 16.8px; color: #db2777; vertical-align: middle; cursor: default; flex-shrink: 0; }
.xr-icon svg { width: 100%; height: 100%; fill: currentColor; }
.xr-sup-wrap { position: relative; display: inline-flex; align-self: flex-start; flex-shrink: 0; }
.xr-sup { position: absolute; top: -9px; right: -10px; width: 15.4px; height: 15.4px; background: #fff; border-radius: 50%; }
