/*
 * Site-wide branding, matching the AnalyzeAMR dashboard (amr.rti.org).
 * Loaded last on every page so it overrides each page's own <style> block.
 * Base element styles use :where() (zero specificity) so any page rule still wins;
 * the page-chrome overrides below use normal selectors on purpose.
 *
 * The RTI site uses the commercial "Mont" font for headings; Montserrat is the
 * closest free substitute and is used if Mont isn't installed.
 */
@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700&family=Montserrat:wght@700;800&display=swap');

:root {
    --brand-primary: #008076;
    --brand-primary-dark: #006b62;
    --brand-primary-light: #e6f3f2;
    --brand-accent: #F26730;
    --brand-accent-border: #f79239;
    --brand-accent-soft: #ffe9d5;
    --brand-text: #3c4b64;
    --brand-text-strong: #3e434f;
    --brand-muted: #768192;
    --brand-bg: #ebedef;
    --brand-border: #d8dbe0;
    --brand-radius: 4px;
    --brand-font: Lato, "Helvetica Neue", Arial, Helvetica, sans-serif;
    --brand-heading-font: Mont, Montserrat, Arial, sans-serif;
}

/* ---------- Base ---------- */

body {
    font-family: var(--brand-font);
    color: var(--brand-text);
    background: var(--brand-bg);
}

h1, h2 {
    font-family: var(--brand-heading-font);
    font-weight: 800;
    color: var(--brand-primary);
}

:where(a) { color: var(--brand-primary); }
:where(a:hover) { color: var(--brand-primary-dark); }

:where(input, select, textarea, button) { font-family: inherit; }

:where(input, select, textarea):focus {
    border-color: #80c0bb;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(0, 128, 118, 0.25);
}

:where(button) {
    background: var(--brand-primary);
    color: #fff;
    border: 1px solid var(--brand-primary);
    border-radius: var(--brand-radius);
}

/* ---------- Page header bars: white with a teal bottom rule ---------- */

header, .header, .nav {
    background: #fff;
    color: var(--brand-text);
    border-bottom: 3px solid var(--brand-primary);
    box-shadow: none;
}

header h1, .header h1, .nav h1, .nav h2 {
    font-family: var(--brand-heading-font);
    font-weight: 800;
    color: var(--brand-primary);
}

header p, .header p, header .subtitle {
    color: var(--brand-text);
    opacity: 1;
}

.nav a { color: var(--brand-primary); }
.nav a:hover { color: var(--brand-primary-dark); text-decoration: underline; }

.header::before { display: none; }

.header-badge {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
}

/* Logout / header actions use the RTI orange "accent" button */
.header a.logout,
header .btn-secondary {
    background: var(--brand-accent-soft);
    color: var(--brand-text-strong);
    border: 2px solid var(--brand-accent-border);
    border-radius: var(--brand-radius);
}
.header a.logout:hover,
header .btn-secondary:hover {
    background: #ffd9b8;
}

/* ---------- Containers and cards: flat, thin border ---------- */

.container {
    border-radius: var(--brand-radius);
    box-shadow: none;
}

.main-content, .section, .results-section, .chart-card:not(.dark-chart),
.filter-panel, .config-panel, .species-panel, .query-section {
    border-radius: var(--brand-radius);
    box-shadow: none;
}

.main-content, .results-section, .chart-card:not(.dark-chart) {
    border: 1px solid var(--brand-border);
}

/* ---------- Buttons: square-ish corners like the RTI site ---------- */

.button, .button-primary, .button-secondary, .button-download, .button-generate,
.button-reset, .generate-btn, .workbench-btn, .query-type-btn, .query-button,
.btn, .copy-btn, .delete-btn {
    border-radius: var(--brand-radius);
}

/* ---------- AnalyzeAMR site layout (views/home.html, views/restricted_dashboard.html) ---------- */

body.site-page {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 16.1px;
    line-height: 1.43;
}

.site-header {
    padding: 0 14px;
}

.site-header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 28px;
    min-height: 56px;
    padding: 8px 8px;
    border-bottom: 1px solid var(--brand-border);
}

.site-brand {
    font-family: var(--brand-heading-font);
    font-weight: 800;
    font-size: 22.9px;
    color: var(--brand-primary);
    text-decoration: none;
}
.site-brand:hover { color: var(--brand-primary); }

.site-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 28px;
    margin-right: auto;
}
.site-nav a {
    color: rgba(0, 0, 21, 0.5);
    text-decoration: none;
}
.site-nav a:hover { color: rgba(0, 0, 21, 0.75); text-decoration: none; }
.site-nav a.active { color: var(--brand-primary); }

.site-user {
    display: flex;
    align-items: center;
    gap: 14px;
}
.site-greeting {
    color: var(--brand-primary);
    font-weight: 500;
}

.btn-accent {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--brand-accent-soft);
    color: var(--brand-text-strong);
    border: 2px solid var(--brand-accent-border);
    border-radius: 3.5px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}
.btn-accent:hover { background: #ffd9b8; color: var(--brand-text-strong); }
.btn-accent svg { width: 14px; height: 14px; }

.site-breadcrumb {
    display: flex;
    gap: 8px;
    padding: 10.5px 22px;
    text-transform: uppercase;
    font-size: 14px;
    color: var(--brand-muted);
}
.site-breadcrumb a { color: var(--brand-primary); text-decoration: none; }
.site-breadcrumb .sep { color: var(--brand-muted); }

.site-main {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 30px 40px;
}

.page-title {
    font-family: var(--brand-heading-font);
    font-weight: 800;
    font-size: 28px;
    color: var(--brand-primary);
    margin: 0 0 21px;
}

/* Home: intro text beside the count tiles */
.home-intro-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 30px;
    align-items: start;
}
.home-intro { margin: 0; font-size: 1.2em; line-height: 1.5; }

.count-tiles {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 30px;
}
.count-tile {
    min-height: 180px;
    padding: 14px;
    border: 3px solid;
    border-radius: 8px;
    background-repeat: no-repeat;
    background-position: 100% 100%;
    color: var(--brand-text-strong);
    font-size: 17.5px;
    font-weight: 600;
    overflow: hidden;
}
.count-tile .count { display: block; }
.tile-orange { background-color: #f9ad6b; border-color: #F26730; background-image: url('/images/organism.svg'); }
.tile-teal   { background-color: #7fc2bd; border-color: #008076; background-image: url('/images/species.svg'); }
.tile-gray   { background-color: #b5b9bc; border-color: #3e434f; background-image: url('/images/isolate.svg'); }

.count-tile-link { display: block; text-decoration: none; }
.count-tile-link:hover .count-tile,
.count-tile-link:focus-visible .count-tile { filter: brightness(1.05); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); }

/* Organisms / species category lists (views/list.html) */
.list-card {
    background: #fff;
    border: 1px solid var(--brand-border);
    border-radius: 3.5px;
}
.list-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 6px;
    padding: 10.5px 17.5px;
    border-bottom: 1px solid var(--brand-border);
}
.list-filter-btn {
    padding: 7px 14px;
    min-width: 42px;
    background: #fff;
    color: var(--brand-text-strong);
    border: 1px solid var(--brand-text-strong);
    border-radius: 3.5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.list-filter-btn:hover:not(:disabled) { background: var(--brand-text-strong); color: #fff; }
.list-filter-btn.active { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.list-filter-btn:disabled { opacity: 0.35; cursor: default; }
.list-body { padding: 17.5px; }
.list-section h2 {
    margin: 0 0 14px;
    padding: 0 5px;
    background: var(--brand-bg);
    color: var(--brand-text);
    font-family: var(--brand-heading-font);
    font-size: 24px;
    font-weight: 400;
}
.list-section ul {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px 30px;
    margin: 0 0 14px;
    padding: 0 0 0 28px;
    list-style: none;
}
.list-empty { margin: 0; color: var(--brand-muted); }
@media (max-width: 767px) {
    .list-section ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Home: one card per visualization page */
.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    margin: 56px 0;
}
.feature-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--brand-border);
    border-radius: 3.5px;
    color: #212529;
}
.feature-card-body {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    flex: 1;
}
.feature-icon {
    flex-shrink: 0;
    display: flex;
    padding: 14px;
    border-radius: 8px;
    color: #fff;
}
.feature-icon svg { width: 18px; height: 18px; }
.icon-orange { background-image: linear-gradient(135deg, #f26730, rgba(247, 146, 57, 0.75)); }
.icon-green  { background-image: linear-gradient(135deg, #00665e, #20c997); }
.icon-gray   { background-image: linear-gradient(135deg, #3e434f, #b5b9bc); }
.icon-teal   { background-image: linear-gradient(135deg, #008076, #7fc2bd); }
.icon-blue   { background-image: linear-gradient(135deg, #0065bd, #70c7af); }
.feature-title { color: var(--brand-primary); font-weight: 700; }
.feature-desc {
    color: var(--brand-muted);
    font-size: 12.9px;
    font-weight: 700;
    text-transform: uppercase;
}
.feature-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 14px;
    border-top: 1px solid var(--brand-border);
    color: var(--brand-primary);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}
.feature-link:hover { color: var(--brand-primary-dark); background: var(--brand-primary-light); }
.feature-link svg { width: 14px; height: 14px; }

@media (max-width: 991px) {
    .home-intro-row { grid-template-columns: 1fr; }
}
@media (max-width: 575px) {
    .site-main { padding: 20px 16px 32px; }
    .count-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .feature-cards { gap: 16px; margin: 32px 0; }
}

/* ---------- Footer ---------- */

footer.site-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: auto;
    padding: 14px 21px;
    background-color: var(--brand-primary-light);
    border-top: 1px solid var(--brand-border);
    color: var(--brand-text);
    font-family: var(--brand-font);
    font-size: 16.1px;
    font-weight: 400;
    line-height: 1.43;
    text-align: center;
}

footer.site-footer .footer-logo {
    height: 50px;
    width: auto;
}

footer.site-footer .footer-funding {
    color: var(--brand-primary);
}

footer.site-footer .footer-funding .footer-logo {
    display: inline;
    vertical-align: middle;
    margin-left: 4px;
}

@media (min-width: 768px) {
    footer.site-footer {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}
