* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f4f7f9;
    color: #333;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-x: hidden;
    overflow-y: hidden;
}

/* Main layout */
.container {
    max-width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar with tree */
.sidebar {
    width: 400px;
    background: white;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    padding: 1rem;
}

.tree-container {
    user-select: none;
}

/* Detail panel */
.detail-panel {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background: #fafafa;
}

.placeholder {
    text-align: center;
    margin-top: 4rem;
    color: #7f8c8d;
}

.placeholder h2 {
    margin-bottom: 1rem;
    color: #34495e;
}

/* Tree node styles */
.tree-node {
    margin: 0.5rem 0;
}

.node-header {
    display: flex;
    align-items: center;
    padding: 0.6rem;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.node-header:hover {
    background: #ecf0f1;
}

.tree-node.selected > .node-header {
    background: #7c3aed;
    color: white;
}

.tree-node.expanded > .node-header {
    background: #faf5ff;
}

.expand-icon {
    margin-right: 0.5rem;
    font-size: 0.8rem;
    color: #7f8c8d;
    transition: transform 0.2s;
}

.node-title {
    flex: 1;
}

.count-badge {
    background: #95a5a6;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tree-node.selected .count-badge {
    background: rgba(255,255,255,0.3);
}

/* System node */
.system-node > .node-header {
    font-weight: 700;
    font-size: 1.1rem;
    color: #2c3e50;
    background: #faf5ff;
}

.system-node > .node-header:hover {
    background: #f3e5f5;
}

/* Category node (therapeutic class level) */
.category-node {
    margin-left: 1rem;
}

.category-node > .node-header {
    font-weight: 600;
    font-size: 0.95rem;
    color: #34495e;
}

.categories-container {
    border-left: 2px solid #e1bee7;
    margin-left: 1rem;
    padding-left: 0.5rem;
}

/* Pharmacologic class node */
.pharma-class-node {
    margin-left: 0.5rem;
}

.pharma-class-node > .node-header {
    font-weight: 500;
    font-size: 0.9rem;
    color: #555;
}

/* Disease/Drug node */
.disease-node,
.drug-node {
    margin-left: 1rem;
}

.disease-node > .node-header,
.drug-node > .node-header {
    font-weight: 500;
    font-size: 0.9rem;
    color: #555;
}

.diseases-container {
    border-left: 2px solid #d5dbdb;
    margin-left: 1rem;
    padding-left: 0.5rem;
}

/* Entity detail styles */
.entity-detail {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 900px;
    margin: 0 auto;
}

.entity-header {
    margin-bottom: 2rem;
    border-bottom: 3px solid #7c3aed;
    padding-bottom: 1rem;
}

.entity-header h2 {
    color: #2c3e50;
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.entity-type-badge {
    display: inline-block;
    background: #95a5a6;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.disease-metadata {
    margin-top: 0.5rem;
}

.badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h3 {
    color: #34495e;
    margin-bottom: 1rem;
    font-size: 1.3rem;
    border-bottom: 2px solid #ecf0f1;
    padding-bottom: 0.5rem;
}

.detail-section h4 {
    color: #555;
    margin: 1rem 0 0.5rem 0;
    font-size: 1.1rem;
}

.detail-section p {
    margin-bottom: 0.75rem;
    line-height: 1.8;
    color: #333;
}

.detail-section ul {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.detail-section li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

.detail-section.important {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 1rem;
    border-radius: 4px;
}

.detail-section.highlight {
    background: #f8e5ff;
    border-left: 4px solid #7c3aed;
    padding: 1rem;
    border-radius: 4px;
}

/* Mechanism preview in cards */
.mechanism-preview {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
}

.drug-features-preview {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 0.25rem;
}

/* Category and disease cards */
.category-list,
.disease-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.category-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.category-card:hover {
    border-color: #7c3aed;
    box-shadow: 0 4px 8px rgba(124, 58, 237, 0.2);
    transform: translateY(-2px);
}

.category-card h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.disease-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-left-width: 4px;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.disease-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.drug-card-mini {
    border-left-color: #7c3aed;
}

.disease-card-content {
    flex: 1;
}

.disease-card h4 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

/* Search results */
.search-results {
    padding: 1rem 0;
}

.search-results h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.search-result {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
}

.search-result:hover {
    background: #f8f9fa;
    border-color: #7c3aed;
}

.search-result h4 {
    margin: 0 0 0.25rem 0;
    color: #2c3e50;
}

.result-type {
    margin: 0;
    font-size: 0.85rem;
    color: #7f8c8d;
}

.no-results {
    text-align: center;
    padding: 2rem;
    color: #7f8c8d;
}

/* Error message */
.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
}

.error-message h2 {
    margin-bottom: 1rem;
}

/* Scrollbar styling */
.sidebar::-webkit-scrollbar,
.detail-panel::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track,
.detail-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.sidebar::-webkit-scrollbar-thumb,
.detail-panel::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.detail-panel::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

header {
    background-color: #ffffff;
    padding: 20px 40px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 220px;
}

.header-left h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
}

.header-left p {
    margin: 0;
    color: #7f8c8d;
    font-size: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.header-static {
    display: flex;
    align-items: center;
    gap: 12px;
}

#header-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.icon-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #3498db;
    background: #ffffff;
    color: #3498db;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.icon-button:hover {
    background-color: #3498db;
    color: #ffffff;
}

.support-button {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #27ae60;
    background: #27ae60;
    color: #ffffff;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

.support-button:hover {
    background-color: #1f8f4e;
    color: #ffffff;
}

.toggle-button {
    padding: 8px 16px;
    border-radius: 6px;
    border: 1px solid #8e44ad;
    background: #ffffff;
    color: #8e44ad;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.toggle-button:hover {
    background-color: #8e44ad;
    color: #ffffff;
}

.header-btn, .compare-view-button {
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.header-btn:hover, .compare-view-button:hover {
    background-color: #2980b9;
}

.compare-view-button {
    background-color: #27ae60;
}
.compare-view-button:hover {
    background-color: #229954;
}

.fade-enter {
    opacity: 0.85;
    transform: translateY(6px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.fade-enter-left {
    opacity: 0.85;
    transform: translateX(-10px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.fade-enter.fade-enter-active {
    opacity: 1;
    transform: translateY(0);
}

.fade-enter-left.fade-enter-active {
    opacity: 1;
    transform: translateX(0);
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(44, 62, 80, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 10;
}

.modal.hidden {
    display: none;
}

.modal-content {
    position: relative;
    max-width: 600px;
    width: 100%;
    background: #ffffff;
    border-radius: 12px;
    padding: 28px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.modal-content h2 {
    margin: 0;
    font-size: 1.6rem;
    color: #2c3e50;
}

.modal-content h3 {
    margin: 12px 0 4px;
    font-size: 1.2rem;
    color: #2c3e50;
}

.modal-content p {
    margin: 0;
    line-height: 1.5;
    color: #4b5b6b;
}

.modal-content ul {
    margin: 0 0 8px 18px;
    padding: 0;
    color: #4b5b6b;
}

.modal-content a {
    color: #3498db;
    font-weight: 600;
    text-decoration: none;
}

.modal-content a:hover {
    text-decoration: underline;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #7f8c8d;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #2c3e50;
}

#info-modal-start {
    align-self: center;
    margin-top: 8px;
}

#column-container, .compare-view-container, #search-view-container {
    display: flex;
    flex-grow: 1;
    overflow-x: auto;
    background-color: #f4f7f9;
    border-top: 1px solid #e0e0e0;
}

#column-container, .compare-view-container {
    flex-direction: row;
    background-color: #ffffff;
}

.cascade-container {
    display: flex;
    flex-direction: row;
    flex-grow: 1;
    overflow: hidden;
    background-color: #f4f7f9;
}

.cascade-nav {
    width: 320px;
    max-width: 360px;
    min-width: 240px;
    background-color: #ffffff;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: background-color 0.2s ease;
}

.cascade-detail {
    flex: 1;
    overflow-y: auto;
    padding: 28px 36px;
}

.cascade-detail h2 {
    margin-top: 0;
    color: #2c3e50;
    font-size: 1.6rem;
}

.cascade-detail-header {
    margin-bottom: 20px;
}

.cascade-detail-header p {
    margin: 8px 0 0;
    color: #4b5b6b;
    line-height: 1.4;
}

.cascade-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cascade-label {
    border: none;
    background-color: #ecf0f1;
    color: #2c3e50;
    padding: 10px 12px;
    border-radius: 6px;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
}

.cascade-label:hover {
    background-color: #d6e4f0;
    transform: translateX(2px);
}

.cascade-item.selected > .cascade-label {
    background-color: #3498db;
    color: #ffffff;
}

.cascade-children {
    margin-left: 12px;
    border-left: 2px solid #e0e0e0;
    padding-left: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cascade-children .cascade-label {
    background-color: #f7f9fb;
}

.cascade-children .cascade-item.selected > .cascade-label {
    background-color: #9b59b6;
    color: #ffffff;
}

.pharma-list .cascade-label {
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
}

.cascade-message {
    padding: 24px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    color: #4b5b6b;
}

.cascade-grid {
    margin-top: 16px;
}

.drug-card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.drug-card-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.drug-card-header-row .drug-name {
    margin-bottom: 0;
}

.expand-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #bdc3c7;
    background: #f8f9fa;
    color: #34495e;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: background-color 0.2s, color 0.2s, transform 0.2s, border-color 0.2s;
    line-height: 1;
}

.expand-btn:hover {
    background: #ecf0f1;
}

.expand-btn[aria-expanded="true"] {
    background: #3498db;
    color: #ffffff;
    border-color: #3498db;
}

.drug-card-extra {
    display: none;
    margin-top: 14px;
    border-top: 1px solid #ecf0f1;
    padding-top: 14px;
}

.drug-card.expanded .drug-card-extra {
    display: block;
}

.drug-card.expanded {
    box-shadow: 0 6px 18px rgba(52, 152, 219, 0.18);
    transform: translateY(-2px);
}

.drug-grid .drug-card.expanded,
.cascade-grid .drug-card.expanded {
    grid-column: 1 / -1;
}

.tag-highlight {
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.35);
    background-color: #fdecea;
    color: #c0392b;
}

#search-view-container {
    flex-direction: column;
    padding: 20px 40px;
    overflow-y: auto;
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.search-header h2 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin: 0;
}

.search-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    gap: 12px;
}

.search-input {
    width: 100%;
    max-width: 600px;
    padding: 15px;
    font-size: 1.2rem;
    border-radius: 8px;
    border: 1px solid #ccc;
    margin-bottom: 0;
}

.search-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.search-options label {
    margin: 0 10px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-options button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.indications-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.indications-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
}

.drug-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.drug-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    border-left: 4px solid #3498db;
    display: flex;
    flex-direction: column;
}

.drug-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    #header-controls {
        justify-content: flex-start;
    }

    .modal-content {
        max-width: 100%;
    }
}

.drug-name {
    font-size: 1.5em;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 15px;
}

.drug-section {
    margin-bottom: 12px;
    padding-top: 12px;
    border-top: 1px solid #ecf0f1;
}

.drug-section:first-of-type {
    border-top: none;
    padding-top: 0;
}

.drug-section-title {
    font-weight: 600;
    color: #34495e;
    margin-bottom: 5px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s;
}

.tag:hover {
    transform: scale(1.05);
}

.tag.system { background-color: #e8f4fd; color: #2980b9; }
.tag.class { background-color: #f0f9e8; color: #27ae60; }
.tag.subclass { background-color: #f3e5f5; color: #8e24aa; }
.tag.mechanism { background-color: #fef9e7; color: #f39c12; }
.tag.indication { background-color: #fdf2e9; color: #e67e22; }
.tag.side-effect { background-color: #fdedec; color: #e74c3c; }
.tag.contraindication { background-color: #fff3cd; color: #856404; }
.tag.interaction { background-color: #e2e3e5; color: #495057; }

.detail-section .tag-container {
    margin-top: 10px;
}

.detail-section .tag {
    margin-bottom: 8px;
}

.interaction-explanation {
    margin-top: 12px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #e2e3e5;
}

.interaction-explanation p {
    margin: 0;
    font-size: 0.9em;
    color: #495057;
    line-height: 1.4;
}

.indications-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.indication-tag {
    background-color: #ecf0f1;
    color: #34495e;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.indication-tag:hover {
    background-color: #bdc3c7;
}

#search-results {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.result-item {
    background-color: #fff;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}

.result-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.result-item h4 {
    margin: 0 0 5px 0;
    color: #3498db;
}

.result-item p {
    margin: 0;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.column {
    position: relative;
    box-sizing: border-box;
    min-width: 240px;
    max-width: 620px;
    width: 320px;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.column.resizing {
    user-select: none;
    cursor: col-resize;
}

.column-resizer {
    position: absolute;
    top: 0;
    right: -4px;
    width: 12px;
    height: 100%;
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.column-resizer::after {
    content: '';
    width: 2px;
    height: 40%;
    background: linear-gradient(to bottom, rgba(149, 165, 166, 0.2), rgba(149, 165, 166, 0.6), rgba(149, 165, 166, 0.2));
    border-radius: 1px;
}

.column-header {
    padding: 10px 15px;
    font-weight: 600;
    background-color: #ecf0f1;
    border-bottom: 1px solid #e0e0e0;
    color: #2c3e50;
    position: sticky;
    top: 0;
    z-index: 1;
}

.column-items {
    overflow-y: auto;
    flex-grow: 1;
}

.column-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.95rem;
    white-space: nowrap;
}

.column-item .tag {
    font-size: 0.85rem;
    padding: 6px 12px;
    margin: 0;
}

.column-item:hover {
    background-color: #f5f5f5;
}

.column-item.selected {
    background-color: #3498db;
    color: white;
    font-weight: 500;
}

.column-item.selected .compare-btn {
    border-color: white;
    color: white;
}

.column-item.selected .compare-btn:hover {
    background-color: rgba(255,255,255,0.2);
}

.compare-btn {
    background-color: transparent;
    border: 1px solid #3498db;
    color: #3498db;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 0.78rem;
    cursor: pointer;
    margin-left: 10px;
    transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-weight: 600;
}

.compare-btn:hover {
    background-color: #3498db;
    color: white;
}

.compare-btn.added {
    background-color: #27ae60;
    border-color: #27ae60;
    color: white;
    box-shadow: 0 0 0 2px rgba(39, 174, 96, 0.25);
}

.detail-view-column {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
}

.compare-view-container .detail-view-column {
    flex-grow: 0;
    flex-shrink: 0;
    width: 450px;
    border-right: 1px solid #e0e0e0;
}

.detail-section {
    margin-bottom: 25px;
}

.detail-section h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

@media (max-width: 900px) {
    header {
        padding: 18px 24px 22px;
    }
}

@media (max-width: 768px) {
    header {
        padding: 16px 16px 20px;
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    #header-controls {
        width: 100%;
        justify-content: flex-start;
    }

    .modal-content {
        max-width: 100%;
        padding: 24px;
    }

    .cascade-container {
        flex-direction: column;
    }

    .cascade-nav {
        width: 100%;
        max-width: none;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }

    .cascade-detail {
        padding: 20px;
    }

    .search-controls {
        align-items: stretch;
    }

    .search-options {
        flex-direction: column;
        align-items: stretch;
    }

    .search-options label {
        margin: 0;
        width: 100%;
        justify-content: flex-start;
    }

    .search-options button {
        margin: 0;
        width: 100%;
    }

    /* Sidebar tree responsive */
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 40vh;
    }

    .category-list,
    .disease-list {
        grid-template-columns: 1fr;
    }

    .entity-detail {
        padding: 1rem;
    }
}

/* Highlighted drug (from deep linking) */
.drug-item.highlighted {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(147, 51, 234, 0.15));
    border-left: 4px solid #7c3aed;
    animation: highlight-pulse 2s ease-in-out;
}

@keyframes highlight-pulse {
    0%, 100% {
        background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(147, 51, 234, 0.15));
    }
    50% {
        background: linear-gradient(135deg, rgba(124, 58, 237, 0.3), rgba(147, 51, 234, 0.3));
    }
}

/* ========================================
   RELATED CONDITIONS SECTION (Cross-linking)
   ======================================== */

.related-conditions {
    margin-top: 3rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(59, 130, 246, 0.05));
    border-left: 4px solid #2563eb;
    border-radius: 8px;
}

.related-conditions h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #1e40af;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.condition-type-group {
    margin-bottom: 2rem;
}

.condition-type-group:last-child {
    margin-bottom: 0;
}

.condition-type-group h4 {
    margin: 0 0 1rem 0;
    color: #374151;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.conditions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.condition-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    text-decoration: none;
    color: #1f2937;
    transition: all 0.2s ease;
    cursor: pointer;
}

.condition-link:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
    transform: translateY(-2px);
}

.condition-link-content {
    flex: 1;
    min-width: 0;
}

.condition-link-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.condition-link-context {
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.4;
}

.condition-priority-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.condition-priority-badge.first-line {
    background-color: #dcfce7;
    color: #166534;
}

.condition-priority-badge.second-line {
    background-color: #dbeafe;
    color: #1e40af;
}

.condition-priority-badge.alternative {
    background-color: #fef3c7;
    color: #92400e;
}

.condition-priority-badge.avoid {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .conditions-grid {
        grid-template-columns: 1fr;
    }

    .related-conditions {
        padding: 1rem;
    }

    .related-conditions h3 {
        font-size: 1.25rem;
    }
}
