/* ─────────────────────────────────────────────────────────────────────
   Peptide Wire — pepuniversity.com brand tokens (v9)
   Adds: search bar, health strip, also-covered chips, NEW badge,
   "new since last visit" pill.
   ───────────────────────────────────────────────────────────────────── */

:root {
    --bg-color: #f4f7f6;
    --container-bg: #fff;
    --text-main: #333;
    --text-muted: #7f8c8d;
    --heading-color: #2c3e50;
    --border-color: #eee;
    --primary: #3498db;
    --primary-hover: #2980b9;
    --success: #2ecc71;
    --warning: #f39c12;
    --warning-hover: #d68910;
    --danger: #e74c3c;
    --shadow: 0 4px 15px rgba(0,0,0,0.05);
    --pain-bg: #fff9f0;
    --card-hover: #f8fbff;
}

body.dark-mode {
    --bg-color: #121212;
    --container-bg: #1e1e1e;
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --heading-color: #64b5f6;
    --border-color: #333;
    --primary: #2980b9;
    --primary-hover: #1f618d;
    --success: #27ae60;
    --warning: #d68910;
    --warning-hover: #b9770e;
    --shadow: 0 4px 15px rgba(0,0,0,0.4);
    --pain-bg: #2a241b;
    --card-hover: #252525;
}

* { box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-main); padding: 20px; line-height: 1.6; transition: all 0.3s; margin: 0; overflow-x: hidden; }

.page-container { max-width: 1100px; margin: 0 auto; }

/* Header */
.app-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; flex-wrap: wrap; gap: 15px; }
.logo-container { display: flex; align-items: center; gap: 15px; cursor: pointer; text-decoration: none; color: inherit; }
.logo-img { width: 45px; height: 45px; border-radius: 50%; object-fit: cover; border: 2px solid var(--primary); }
.brand-name { font-size: 18px; font-weight: bold; color: var(--heading-color); }
.theme-btn { background: var(--container-bg); border: 1px solid var(--border-color); color: var(--text-main); padding: 8px 15px; border-radius: 20px; cursor: pointer; font-weight: bold; font-size: 13px; box-shadow: var(--shadow); transition: 0.2s; }
.theme-btn:hover { border-color: var(--primary); }
.back-btn { font-size: 14px; font-weight: bold; color: var(--text-muted); text-decoration: none; transition: 0.2s; padding: 8px 12px; display: inline-flex; align-items: center; }
.back-btn:hover { color: var(--primary); }

/* Hero */
.hero-section { text-align: center; padding: 20px 20px 40px 20px; }
.pro-badge { display: inline-block; background: rgba(243, 156, 18, 0.15); border: 1px solid var(--warning); color: var(--warning); font-size: 13px; font-weight: bold; padding: 6px 16px; border-radius: 20px; letter-spacing: 1px; margin-bottom: 25px; text-transform: uppercase; }
.hero-title { font-size: 54px; color: var(--heading-color); font-weight: 900; margin: 0 0 20px 0; line-height: 1.1; }
.hero-subtitle { font-size: 18px; color: var(--text-muted); max-width: 800px; margin: 0 auto; line-height: 1.6; }
.meta-row { display: flex; gap: 12px; justify-content: center; margin-top: 25px; flex-wrap: wrap; }
.meta-pill { background: var(--container-bg); border: 1px solid var(--border-color); color: var(--text-muted); padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); }
.meta-pill-new { background: var(--success); border-color: var(--success); color: #fff; cursor: pointer; user-select: none; transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease; }
.meta-pill-new:hover { filter: brightness(1.08); box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.meta-pill-new:active { transform: translateY(1px); }
.meta-pill-new:focus-visible { outline: 2px solid var(--success); outline-offset: 2px; }
.meta-pill-new::after { content: " ▸"; opacity: 0.85; font-size: 11px; }
.meta-pill-new.meta-pill-active { box-shadow: 0 0 0 2px var(--container-bg), 0 0 0 4px var(--success); }
.meta-pill-new.meta-pill-active::after { content: " ✕"; }
.link-btn { background: none; border: none; color: var(--success); font-weight: 600; cursor: pointer; padding: 0; text-decoration: underline; font-size: inherit; font-family: inherit; }
.link-btn:hover { filter: brightness(1.1); }

/* v9: Health strip */
.health-strip {
    background: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 0 auto 20px;
    max-width: 1100px;
    box-shadow: var(--shadow);
    font-size: 12px;
}
.health-strip-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.health-summary { font-weight: 700; color: var(--text-muted); letter-spacing: 0.3px; }
.health-dots { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; }
.health-dot {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 14px;
    background: rgba(46, 204, 113, 0.10);
    border: 1px solid rgba(46, 204, 113, 0.4);
    color: var(--text-main);
    font-size: 11px; font-weight: 600;
    cursor: help;
}
.health-dot::before {
    content: ''; display: inline-block; width: 8px; height: 8px;
    border-radius: 50%; background: var(--success);
}
.health-dot.health-stale {
    background: rgba(243, 156, 18, 0.10);
    border-color: rgba(243, 156, 18, 0.4);
}
.health-dot.health-stale::before { background: var(--warning); }
.health-dot.health-fail {
    background: rgba(231, 76, 60, 0.10);
    border-color: rgba(231, 76, 60, 0.4);
}
.health-dot.health-fail::before { background: var(--danger); }
.health-dot-name { letter-spacing: 0.2px; }

/* v9: Search bar */
.search-bar { max-width: 720px; margin: 0 auto 20px; padding: 0 10px; }
.search-input {
    width: 100%;
    padding: 12px 18px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--container-bg);
    color: var(--text-main);
    font-size: 15px;
    box-shadow: var(--shadow);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15); }

/* Filter chips */
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 10px 0 40px; padding: 0 10px; }
.chip { background: var(--container-bg); border: 1px solid var(--border-color); color: var(--text-main); padding: 10px 20px; border-radius: 20px; cursor: pointer; font-weight: 700; font-size: 14px; transition: 0.2s; box-shadow: var(--shadow); }
.chip:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.chip-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip-active:hover { color: #fff; background: var(--primary-hover); }
.chip-grey { border-color: var(--warning); color: var(--warning); }
.chip-grey:hover { background: var(--warning); color: #fff; }
.chip-grey.chip-active { background: var(--warning); color: #fff; border-color: var(--warning); }

/* Watchlist banner (grey market) */
.watchlist-banner { background: var(--pain-bg); border: 1px solid rgba(243, 156, 18, 0.4); border-radius: 16px; padding: 30px; margin-bottom: 50px; }
.watchlist-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding-bottom: 15px; border-bottom: 1px dashed rgba(243, 156, 18, 0.3); flex-wrap: wrap; gap: 10px; }
.watchlist-tag { color: var(--warning); font-weight: 900; font-size: 14px; letter-spacing: 1.5px; }
.watchlist-count { color: var(--text-muted); font-size: 13px; font-weight: 600; }

/* Card grid */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-bottom: 40px; }

/* News cards */
.news-card { background: var(--container-bg); border: 1px solid var(--border-color); border-radius: 12px; padding: 22px 22px 18px; text-decoration: none; color: var(--text-main); box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s, background-color 0.3s, border-color 0.2s; display: flex; flex-direction: column; }
.news-card:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); background-color: var(--card-hover); border-color: var(--primary); }
.news-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.news-source { font-size: 12px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; display: inline-flex; align-items: center; gap: 6px; }
.news-date { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.news-title { font-size: 17px; font-weight: 700; color: var(--heading-color); margin: 0 0 10px 0; line-height: 1.35; }
.news-snippet { font-size: 14px; color: var(--text-muted); line-height: 1.55; margin: 0 0 14px 0; flex-grow: 1; }
.news-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--border-color); }
.news-cat { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.cat-grey_market { background: rgba(243, 156, 18, 0.15); color: var(--warning); }
.cat-enforcement { background: rgba(231, 76, 60, 0.18); color: var(--danger); }
.cat-foreign     { background: rgba(26, 188, 156, 0.18); color: #16a085; }
.cat-trials      { background: rgba(52, 152, 219, 0.15); color: var(--primary); }
.cat-regulatory  { background: rgba(231, 76, 60, 0.12); color: var(--danger); }
.cat-research    { background: rgba(46, 204, 113, 0.15); color: var(--success); }
.cat-industry    { background: rgba(155, 89, 182, 0.15); color: #9b59b6; }
.cat-general     { background: rgba(127, 140, 141, 0.15); color: var(--text-muted); }
.news-arrow { color: var(--primary); font-weight: 800; font-size: 18px; }

/* v9: NEW since last visit badge */
.new-badge {
    display: inline-block;
    background: var(--success);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 10px;
    text-transform: uppercase;
    line-height: 1.4;
}

/* v9: Also covered by */
.also-covered {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 6px;
    margin: 0 0 12px 0;
    padding: 8px 0 0;
    border-top: 1px dashed var(--border-color);
    font-size: 11px;
}
.also-label { color: var(--text-muted); font-weight: 600; }
.also-chip {
    background: rgba(52, 152, 219, 0.10);
    color: var(--primary);
    border: 1px solid rgba(52, 152, 219, 0.25);
    padding: 2px 8px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: 0.15s;
}
.also-chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.also-more { color: var(--text-muted); font-size: 11px; font-weight: 600; }

/* Section headers */
.cat-section { margin-bottom: 50px; }
.cat-section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 2px solid var(--border-color); }
.cat-section-title { font-size: 24px; font-weight: 800; color: var(--heading-color); margin: 0; }
.cat-section-count { font-size: 13px; color: var(--text-muted); font-weight: 600; }

/* Sources section */
.sources-section { background: var(--container-bg); border: 1px solid var(--border-color); border-radius: 16px; padding: 40px 30px; margin-top: 60px; box-shadow: var(--shadow); }
.sources-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 25px; margin-bottom: 20px; }
.source-block h4 { color: var(--primary); margin: 0 0 8px 0; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
.source-block p { color: var(--text-muted); font-size: 13px; line-height: 1.6; margin: 0; }
.sources-note { color: var(--text-muted); font-size: 13px; padding-top: 20px; border-top: 1px solid var(--border-color); margin: 0; text-align: center; font-style: italic; }

/* Empty / loading states */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 15px; }

/* Footer */
.footer { text-align: center; font-size: 12px; color: var(--text-muted); padding-top: 20px; border-top: 1px solid var(--border-color); margin-top: 60px; margin-bottom: 20px; line-height: 1.5; }

/* Toast */
.toast-notification { visibility: hidden; min-width: 300px; background-color: var(--container-bg); color: var(--text-main); text-align: center; border-radius: 8px; padding: 16px 24px; position: fixed; z-index: 10001; left: 50%; top: -100px; transform: translateX(-50%); font-size: 15px; font-weight: bold; box-shadow: 0 10px 30px rgba(0,0,0,0.15); border-left: 5px solid var(--success); opacity: 0; transition: opacity 0.4s, top 0.4s; }
.toast-notification.show { visibility: visible; opacity: 1; top: 30px; }

/* Responsive */
@media (max-width: 900px) {
    .hero-title { font-size: 42px; }
    .cat-section-title { font-size: 20px; }
}
@media (max-width: 600px) {
    body { padding: 12px; }
    .app-header { flex-direction: column; gap: 15px; }
    .hero-title { font-size: 32px; }
    .hero-subtitle { font-size: 16px; }
    .watchlist-banner { padding: 20px; }
    .sources-section { padding: 25px 18px; }
    .health-strip { font-size: 11px; padding: 10px 12px; }
    .health-dot-name { display: none; } /* dots only on small screens */
    .health-dot { padding: 4px 8px; }
}
