/* ================================================================
   嗅觉平台 - 增强型样式 (Olfactory Platform Enhanced Styles)
   ================================================================ */

/* ================================================================
   工具应用展示卡片
   ================================================================ */

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.tool-card {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    border: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}

.tool-card:hover {
    border-color: var(--primary);
    box-shadow: 0 10px 25px rgba(136, 153, 176, 0.15);
    transform: translateY(-8px);
}

.tool-card-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: inline-block;
}

.tool-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.tool-card p {
    color: var(--gray);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.tool-card .btn {
    width: 100%;
}

/* ================================================================
   提交表单样式 (Form Styling)
   ================================================================ */

.form-section {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border-left: 3px solid var(--primary);
}

.form-section h4 {
    margin-bottom: 1.5rem;
    color: var(--dark);
    font-size: 1.125rem;
}

.form-help-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--gray);
}

.form-radio-group,
.form-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-radio-group label,
.form-checkbox-group label {
    display: flex;
    align-items: center;
    margin: 0;
}

.form-radio-group input,
.form-checkbox-group input {
    margin-right: 0.75rem;
    width: auto;
}

/* ================================================================
   结果展示 (Results Display)
   ================================================================ */

.result-card {
    background: white;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.result-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
}

.result-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-pending {
    background: rgba(245, 158, 11, 0.1);
    color: #92400e;
}

.status-running {
    background: rgba(136, 153, 176, 0.15);
    color: #4a5e73;
}

.status-completed {
    background: rgba(136, 153, 176, 0.12);
    color: #4a5e73;
}

.status-failed {
    background: rgba(239, 68, 68, 0.1);
    color: #7f1d1d;
}

.result-content {
    background: #f8fafc;
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.result-content pre {
    margin: 0;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    color: #334155;
    line-height: 1.4;
}

.result-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.result-meta-item {
    padding: 1rem;
    background: #f8fafc;
    border-radius: var(--radius);
}

.result-meta-label {
    display: block;
    font-size: 0.875rem;
    color: var(--gray);
    margin-bottom: 0.25rem;
}

.result-meta-value {
    display: block;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--dark);
}

/* ================================================================
   表格样式增强 (Enhanced Table Styling)
   ================================================================ */

.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
}


/* ================================================================
   列表组件 (List Components)
   ================================================================ */

.list-group {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.list-group-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.list-group-item:last-child {
    border-bottom: none;
}

.list-group-item:hover {
    background: #f8fafc;
}

.list-group-item-title {
    font-weight: 600;
    color: var(--dark);
}

.list-group-item-text {
    font-size: 0.875rem;
    color: var(--gray);
    margin-top: 0.25rem;
}

/* ================================================================
   按钮增强 (Enhanced Buttons)
   ================================================================ */

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(136, 153, 176, 0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #64748b;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #4a5e73;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================================================
   警告和消息 (Alerts and Messages)
   ================================================================ */

.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border-left: 5px solid;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.alert-success {
    background: #f0fdf4;
    border-color: var(--success);
    color: #4a5e73;
}

.alert-danger {
    background: #fef2f2;
    border-color: var(--danger);
    color: #991b1b;
}

.alert-warning {
    background: #fffbeb;
    border-color: var(--warning);
    color: #92400e;
}

.alert-info {
    background: #f0f9ff;
    border-color: var(--info);
    color: #0c4a6e;
}

/* ================================================================
   加载状态 (Loading States)
   ================================================================ */

.spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(136, 153, 176, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-box {
    text-align: center;
    padding: 2rem;
}

.loading-box p {
    margin-top: 1rem;
    color: var(--gray);
}

/* ================================================================
   工具特定样式 (Tool-Specific Styles)
   ================================================================ */

/* TMHMM */
.tmhmm-topology {
    font-family: 'Monaco', monospace;
    background: #f8fafc;
    padding: 1rem;
    border-radius: var(--radius);
    word-break: break-all;
    font-size: 0.875rem;
    border: 1px solid var(--border);
}

.helix-badge {
    background: var(--gradient-primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
}

/* Docking */
.docking-box {
    background: rgba(136, 153, 176, 0.08);
    border: 1px solid rgba(136, 153, 176, 0.2);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.docking-box h4 {
    color: var(--primary);
    margin-top: 0;
}

.affinity-score {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 1rem 0;
}

/* HMMER */
.hmmer-matches {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
}

.match-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.match-row:last-child {
    border-bottom: none;
}

.match-row:hover {
    background: #f8fafc;
}

/* ================================================================
   工具特定配色 (Tool-Specific Colors)
   ================================================================ */

.tool-tmhmm { --tool-color: #5a9a6f; }
.tool-hmmer { --tool-color: #3b82f6; }
.tool-docking { --tool-color: #ec4899; }
.tool-af3 { --tool-color: #10b981; }

/* ================================================================
   响应式设计 (Responsive Design)
   ================================================================ */

@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-meta {
        grid-template-columns: 1fr;
    }

    .match-row {
        grid-template-columns: 1fr;
    }

    .table {
        font-size: 0.875rem;
    }

    .table th,
    .table td {
        padding: 0.5rem;
    }

    .form-section {
        padding: 1.5rem;
    }
}

/* ================================================================
   实用类 (Utility Classes)
   ================================================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-05 { margin-top: 0.25rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mt-6 { margin-top: 2.5rem; }
.mt-8 { margin-top: 3rem; }

.mb-05 { margin-bottom: 0.25rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.mb-6 { margin-bottom: 2.5rem; }

.p-05 { padding: 0.25rem; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
.p-6 { padding: 2.5rem; }

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.gap-05 { gap: 0.25rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 2rem; }

.hidden { display: none !important; }
.visible { display: block !important; }

/* ================================================================
   树形菜单 + 内容区布局
   ================================================================ */

.content-layout {
    display: flex;
    gap: 24px;
    min-height: 500px;
}

.tree-panel {
    width: 280px;
    min-width: 280px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    height: fit-content;
    max-height: 80vh;
    overflow-y: auto;
    position: sticky;
    top: 80px;
}

.tree-title {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--dark);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tree-menu {
    padding: 8px;
}

.tree-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tree-menu .level-1 > li {
    margin-bottom: 6px;
}

.tree-menu .level-2 > li {
    margin-bottom: 3px;
}

.tree-menu .level-3 > li {
    margin-bottom: 2px;
}

.tree-node {
    display: block;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
    border-radius: 4px;
    transition: background 0.15s;
    color: var(--dark);
}

.tree-node:hover {
    background: rgba(136, 153, 176, 0.06);
}

.tree-node.expanded,
.tree-node.active {
    color: var(--primary);
}

.tree-menu .level-2,
.tree-menu .level-3 {
    display: none;
    padding-left: 16px;
}

.tree-species {
    display: block;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 4px;
    transition: background 0.15s;
    color: var(--dark);
}

.tree-species:hover {
    background: rgba(136, 153, 176, 0.06);
}

.tree-species.expanded {
    color: var(--primary);
}

.tree-leaf {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.92rem;
    border-radius: 4px;
    transition: background 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tree-leaf:hover {
    background: rgba(136, 153, 176, 0.08);
}

.tree-leaf.selected {
    background: #dcfce7;
    color: var(--primary-dark);
    font-weight: 500;
}

.tree-leaf i {
    font-style: italic;
    color: var(--gray);
}

.tree-leaf.selected i {
    color: var(--primary);
}

.tree-count {
    font-size: 0.72rem;
    color: var(--gray);
    background: #f1f5f9;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 4px;
}

.content-area {
    flex: 1;
    min-width: 0;
}

.initial-message {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 40px;
}

.intro-content h3 {
    font-size: 1.25rem;
    margin-bottom: 16px;
    color: var(--dark);
}

.intro-content p {
    color: var(--gray);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 12px;
}

.upper-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-bottom: none;
}

.upper-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
}

.upper-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.upper-table td i {
    font-style: italic;
}

.table-wrapper {
    background: white;
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

.lower-table {
    width: 100%;
    border-collapse: collapse;
}

.lower-table th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
}

.lower-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.lower-table tbody tr:hover {
    background: #f8fafc;
}

.lower-table td i {
    font-style: italic;
}

.table-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    gap: 4px;
    border-top: 1px solid var(--border);
}

.table-pagination button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.table-pagination button:hover:not(:disabled) {
    background: #f1f5f9;
}

.table-pagination button:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.table-pagination button.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-numbers {
    display: flex;
    gap: 2px;
}

.detail-btn {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary);
    color: white !important;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.8rem;
}

.detail-btn:hover {
    background: var(--primary-dark);
    text-decoration: none;
}

@media (max-width: 768px) {
    .content-layout {
        flex-direction: column;
    }
    .tree-panel {
        width: 100%;
        min-width: 100%;
        max-height: none;
        position: static;
    }
}
