.btn-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
    color: var(--text-secondary);
}

.btn-sm.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* --- Help Page Layout --- */
.doc-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    background-color: var(--bg-color);
    position: relative;
    height: calc(100vh - 60px); /* Adjust based on header height */
}

/* Sidebar */
.doc-sidebar {
    width: 280px; /* Slightly wider for better readability */
    background: #ffffff; /* Clean white */
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
    transition: all 0.3s ease;
}

.doc-sidebar-header {
    height: 60px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #f9fafb; /* Slight contrast for header */
}

.doc-nav-menu {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column; /* Ensure vertical stacking */
}

.doc-nav-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    padding: 0 24px;
    margin-bottom: 8px;
    margin-top: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.doc-nav-section-title:first-child {
    margin-top: 0;
}

.doc-nav-item {
    padding: 10px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
    border-right: 3px solid transparent; /* Right border indicator for modern feel */
}

.doc-nav-item:hover {
    background-color: #f3f4f6;
    color: var(--text-main);
}

.doc-nav-item.active {
    background-color: #ecfdf5;
    color: var(--primary-color);
    border-right-color: var(--primary-color);
    font-weight: 600;
}

.doc-nav-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    opacity: 0.8;
}

/* --- Seed Detailed Info Grid --- */
.detailed-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.info-section {
    background: #f9fafb;
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.info-section-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 4px 0;
}

.info-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.info-value {
    color: var(--text-main);
    font-weight: 600;
    text-align: center;
    max-width: 100%;
    word-break: break-all;
}

/* --- Seed Layout Adjustments --- */
.seed-layout {
    display: flex;
    height: calc(100vh - 100px);
    gap: 0;
    overflow: hidden;
}

.seed-category-sidebar {
    width: 220px;
    border-right: 1px solid var(--border-color);
    background: white;
    display: flex;
    flex-direction: column;
}

.seed-sidebar {
    width: 550px;
    border-right: 1px solid var(--border-color);
    background: #fcfcfc;
    display: flex;
    flex-direction: column;
}

#germplasm-sidebar {
    width: 300px;
}

.seed-detail {
    flex: 1;
    background: white;
    padding: 25px;
    overflow-y: auto;
}

/* --- Print Styles --- */
@media print {
    header, nav, .seed-category-sidebar, .seed-sidebar, .modal-footer, .close-btn, #print-btn {
        display: none !important;
    }
    body, main, .view-container, .seed-layout, .seed-detail, .modal, .modal-overlay {
        display: block !important;
        position: static !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        background: white !important;
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    .modal-body {
        max-height: none !important;
        overflow: visible !important;
    }
    .detailed-info-grid {
        display: block !important;
    }
    .info-section {
        break-inside: avoid;
        margin-bottom: 20px;
        border: 1px solid #eee !important;
    }
}

/* Main Content Area */
.doc-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px 60px;
    scroll-behavior: smooth;
    background-color: var(--bg-color);
    position: relative; /* Ensure offsetTop calculation is relative to this container */
}

.doc-wrapper {
    max-width: 960px; /* Optimal reading width */
    margin: 0 auto;
}

.doc-header {
    margin-bottom: 50px;
    text-align: left; /* Ensure left alignment */
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 30px;
}

.doc-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 16px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.doc-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 16px 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.doc-subtitle {
    color: var(--text-secondary);
    font-size: 1.15rem;
    line-height: 1.6;
    margin: 0;
    max-width: 800px;
}

/* Cards & Sections */
.doc-section-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 32px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.doc-section-title {
    padding: 16px 24px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-main);
}

/* Tables */
.doc-table { 
    width: 100%; 
    border-collapse: collapse; 
    table-layout: fixed; /* Prevents squeeze but requires widths or careful content */
}

/* Responsive table layout */
@media (max-width: 768px) {
    .doc-table { table-layout: auto; }
}

.doc-table th {
    background: #f9fafb;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.doc-table td {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-main);
}

.doc-table tr:last-child td {
    border-bottom: none;
}

.type-cn { font-weight: 700; font-size: 0.95rem; display: block; color: var(--text-main); margin-bottom: 4px; }
.type-en { font-size: 0.8rem; color: var(--text-secondary); font-family: 'Inter'; font-weight: 500; }

.value-box { 
    background: #f0fdf4; 
    padding: 12px; 
    border-radius: 8px; 
    font-size: 0.85rem; 
    color: #166534; 
    border: 1px solid #dcfce7;
    /* border-left: 3px solid var(--primary-color); Removed for cleaner look */
}

/* Visuals Grid */
.doc-visual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.doc-visual-card {
    background: white;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.2s ease;
}

.doc-visual-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.doc-visual-img-placeholder {
    height: 160px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    border-bottom: 1px solid var(--border-color);
}

.doc-visual-content {
    padding: 20px;
}

.doc-visual-title {
    font-weight: 700;
    margin-bottom: 8px;
    font-size: 1rem;
    color: var(--text-main);
}

.doc-visual-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Code Block */
.doc-code-block {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    margin: 16px 0;
    line-height: 1.6;
    border: 1px solid #0f172a;
}

.doc-inline-code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    color: #0f172a;
    font-size: 0.9em;
    border: 1px solid #e2e8f0;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .doc-content { padding: 32px; }
}

@media (max-width: 768px) {
    .doc-container { flex-direction: column; height: auto; overflow: auto; }
    .doc-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border-color); height: auto; }
    .doc-nav-menu { display: flex; overflow-x: auto; padding: 10px; white-space: nowrap; }
    .doc-nav-section-title { display: none; }
    .doc-nav-item { padding: 8px 16px; border-left: none; border-bottom: 2px solid transparent; border-radius: 6px; margin-right: 8px; }
    .doc-nav-item.active { border-bottom-color: var(--primary-color); border-left-color: transparent; }
    .doc-content { padding: 24px 16px; overflow: visible; }
    .doc-title { font-size: 1.75rem; }
    .doc-table { font-size: 0.85rem; }
    .doc-table th, .doc-table td { padding: 12px; }
}
