/* ── Page layout ───────────────────────────────────────── */
.detail-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/* ── Breadcrumb ────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover { color: var(--accent); }

.breadcrumb-sep { color: var(--text-dim); }

/* ── Drug header ───────────────────────────────────────── */
.drug-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.drug-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.05rem;
    margin-bottom: 0.4rem;
}

.class-badge {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    border: 1px solid var(--border);
    color: var(--accent);
    background: transparent;
}

.drugbank-id {
    font-family: monospace;
    font-size: 0.82rem;
    color: var(--text-dim);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    padding: 0.3rem 0.7rem;
}

/* ── Indication ────────────────────────────────────────── */
.indication {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
    max-width: 800px;
    margin-bottom: 1.75rem;
}
.indication-section {
    margin-bottom: 1.5rem;
}

.indication-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    display: block;
    margin-bottom: 0.4rem;
}

.indication-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.75;
}

.expand-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0;
    margin-left: 0.25rem;
    font-family: inherit;
}

.expand-btn:hover { text-decoration: underline; }
/* ── Stat chips ────────────────────────────────────────── */
.stat-chips {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.stat-chip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    padding: 0.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 90px;
}

.chip-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}

.chip-value.mono {
    font-family: monospace;
    font-size: 1rem;
    padding-top: 0.3rem;
}

.chip-label {
    font-size: 0.68rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Main grid ─────────────────────────────────────────── */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    align-items: stretch;
}




/* ── Viewer card ───────────────────────────────────────── */
.viewer-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.viewer-header {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    flex-shrink: 0;
}

.viewer-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.viewer-pdb {
    font-family: monospace;
    font-size: 0.82rem;
    color: var(--accent);
}

#molstar-viewer {
    flex: 1;
    min-height: 420px;
    background: #05080d;
    overflow: hidden;
    position: relative;
}

.no-structure {
    height: 420px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 0.85rem;
    font-family: monospace;
}

.viewer-controls {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    background: var(--bg);
    flex-shrink: 0;
}

.pdb-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    color: var(--text);
    font-family: monospace;
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    outline: none;
    cursor: pointer;
    flex: 1;
}

/* ── Info column ───────────────────────────────────────── */
.info-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.25rem;
}

.info-card-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    margin-bottom: 0.85rem;
}

.detail-value.accent {
    color: var(--accent);
    text-decoration: none;
}
.detail-value.accent:hover {
    text-decoration: underline;
}

.smiles-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.smiles-string {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-all;
    line-height: 1.6;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    padding: 0.6rem 0.85rem;
}
/* ── Target pills ──────────────────────────────────────── */
.target-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.target-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 2rem;
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.target-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.target-pill.confirmed {
    border-color: rgba(0, 229, 160, 0.3);
}

.target-gene {
    font-family: monospace;
    font-weight: 500;
    color: #00e5a0;
}

.target-uniprot {
    font-size: 0.72rem;
    color: var(--text-dim);
    font-family: monospace;
}

.confirmed-tick { color: #00e5a0; font-size: 0.75rem; }

.pdb-count {
    font-size: 0.68rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 2rem;
    padding: 0.1rem 0.4rem;
    color: var(--text-dim);
}

/* ── Mechanism ─────────────────────────────────────────── */
.mechanism-card {
    min-height: 300px;        /* viewer never smaller than targets + this */
    flex: 1;                  /* grows if mechanism text is longer */
}

.mechanism-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.75;
}

/* ── Details grid ──────────────────────────────────────── */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}
.details-full {
    margin-bottom: 1.5rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.detail-label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.detail-value {
    font-size: 0.875rem;
    color: var(--text);
}

.detail-value.mono {
    font-family: monospace;
    color: var(--accent);
}

.mono { font-family: monospace; }
.dim  { color: var(--text-dim); }

/* ── Section title ─────────────────────────────────────── */
.section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

/* ── Resistance mutations ──────────────────────────────── */
.mutations-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    min-height: 8rem;
    max-height: 22rem;
    overflow-y: auto;
}

.mutation-group {
    margin-bottom: 1.5rem;
}

.mutation-group-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.mutation-gene {
    font-family: monospace;
    font-size: 0.95rem;
    font-weight: 600;
    color: #00e5a0;
}

.mutation-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.mut-chip {
    font-family: monospace;
    font-size: 0.78rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    padding: 0.2rem 0.5rem;
    color: var(--text-muted);
    transition: all 0.15s ease;
    cursor: default;
}
.mut-chip.selected {
    background: rgba(255, 77, 106, 0.15);
    border-color: #ff4d6a;
    color: #ff4d6a;
}

.mut-chip:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.mutations-note {
    font-size: 0.78rem;
    color: var(--text-dim);
    margin-top: 1rem;
}

.mut-chip.on-target {
    border-color: rgba(0, 212, 255, 0.3);
    color: var(--accent);
}

.mut-chip.off-target {
    border-color: rgba(255, 179, 64, 0.3);
    color: var(--amber, #ffb340);
}
.mut-ref-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    background: var(--border);
    color: var(--text-dim);
    border-radius: 50%;
    width: 1rem;
    height: 1rem;
    margin-left: 0.2rem;
    font-family: var(--font-body, sans-serif);
}

.mutation-hint-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.mutation-hint-inline.hidden {
    display: none;
}
/* ── References ────────────────────────────────────────── */
.references-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.pubmed-refs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.pmid-badge {
    font-family: monospace;
    font-size: 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    padding: 0.2rem 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.15s ease;
}

.pmid-badge:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Toast ─────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 5rem;
    left: 50%;
    transform: translateX(-50%) translateY(1rem);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    color: var(--text);
    z-index: 999;
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 480px;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.toast-warning {
    border-color: var(--amber, #ffb340);
    color: var(--amber, #ffb340);
}

.toast.toast-info {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── ADMET section ─────────────────────────────────────── */
.admet-section {
    margin-bottom: 1.5rem;
}

.admet-layout {
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}

.admet-chart-wrap {
    flex-shrink: 0;
    width: 280px;
    height: 280px;
}

.admet-props {
    flex: 1;
    min-width: 220px;
}

.admet-loading {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.admet-error {
    color: var(--text-dim);
    font-size: 0.85rem;
}

.admet-prop-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.admet-prop {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.admet-prop:last-child {
    border-bottom: none;
}

.admet-prop-label {
    color: var(--text-muted);
}

.admet-prop-value {
    color: var(--text);
    font-weight: 500;
}

.admet-rules {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.admet-rule {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.admet-rule-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.admet-note {
    font-size: 0.72rem;
    color: var(--text-dim);
    line-height: 1.4;
}

@media (max-width: 768px) {
    .admet-layout {
        flex-direction: column;
        align-items: center;
    }

    .admet-chart-wrap {
        width: 240px;
        height: 240px;
    }

    .admet-props {
        width: 100%;
    }
}
/* ── Mobile / Tablet ───────────────────────────────────── */
@media (max-width: 900px) {
    .detail-grid    { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .detail-page    { padding: 1.5rem 1rem; }
    .drug-header h1 { font-size: 1.6rem; }
    .stat-chips     { gap: 0.5rem; }
    .stat-chip      { min-width: 75px; padding: 0.6rem 0.85rem; }
    .details-grid   { grid-template-columns: 1fr 1fr; }
    .mechanism-card { min-height: 120px; }
}