﻿/* ==========================================================================
   1. 基础布局与背景 (Medical Search Section)
   ========================================================================== */
html, body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 42%, #ecfeff 100%);
}

.medical-search-section {
    position: relative;
    overflow: hidden;
    padding: 60px 0 80px;
    min-height: 80vh;
    background: linear-gradient( to bottom, #eef2ff 0%, #f6f8ff 38%, #fbfcfe 72%, #ffffff 100% );
}

/* ==========================================================================
   2. 搜索框与一级选项卡 (Search & Tabs)
   ========================================================================== */
.search-wrapper {
    max-width: 800px;
    margin: 0 auto 20px;
    position: relative;
}

.search-input-group {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid #333;
    border-radius: 30px;
    padding: 5px 5px 5px 20px;
    overflow: hidden;
}

    .search-input-group input {
        border: none;
        flex: 1;
        outline: none;
        font-size: 16px;
        color: #666;
    }

.go-search-btn {
    background-color: #ff4953;
    color: white;
    border: none;
    border-radius: 25px;
    padding: 8px 35px;
    font-size: 16px;
    cursor: pointer;
    transition: opacity 0.3s;
}

    .go-search-btn:hover {
        opacity: 0.9;
    }

.medical-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: -1px;
}

.tab-item {
    padding: 15px 30px;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 12px 12px 0 0;
    transition: all 0.3s;
    user-select: none;
}

    .tab-item.active {
        background-color: #fff;
        color: #333;
        font-weight: bold;
        box-shadow: 0 -4px 10px rgba(0,0,0,0.02);
    }

    .tab-item:active {
        transform: scale(0.95);
    }

/* ==========================================================================
   3. 二级页签区域 (Sub-tags with Right Toggle & Fade)
   ========================================================================== */
/* 外层容器：横向排列布局 */
.sub-tag-wrapper {
    display: flex;
    position: relative;
    padding: 10px 0;
    margin-bottom: 20px;
    border-bottom: 1px dashed #eee;
    align-items: flex-start;
}

/* 1. 调整左侧内部容器 */
.sub-tag-inner {
    flex: 1;
    position: relative;
    overflow: hidden;
}
    /* 2. 底部渐隐遮罩：仅在有折叠需求且未展开时显示 */
    .sub-tag-inner::after {
        content: "";
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 40px; /* 遮罩高度，稍微覆盖第二行 */
        background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 1) 100%);
        pointer-events: none; /* 必须设置，否则遮罩会挡住标签点击 */
        opacity: 0;
        transition: opacity 0.3s ease;
        z-index: 1;
    }
/* 当检测到需要折叠时（has-toggle）且未展开时，显示遮罩 */
.sub-tag-wrapper.has-toggle:not(.is-expanded) .sub-tag-inner::after {
    opacity: 1;
}
/* 3. 标签容器：微调高度到 92px */
.sub-tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    max-height: 92px; /* 增加到 92px，确保两行文字显示完整不被切边 */
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 5px 0;
}

/* 展开后的高度 */
.sub-tag-wrapper.is-expanded .sub-tag-container {
    max-height: 1000px;
}
/* 独立标签样式 */
.sub-tag {
    display: inline-block;
    padding: 6px 16px;
    background-color: #f5f5f5;
    color: #666;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

    .sub-tag:hover {
        background-color: #e9ecef;
        color: #9d0c1e;
    }

    .sub-tag.active {
        background-color: #9d0c1e !important;
        color: #ffffff !important;
        border-color: #9d0c1e;
        box-shadow: 0 2px 5px rgba(157, 12, 30, 0.2);
    }

/* 4. 右侧按钮：确保垂直对齐第一行 */
.tag-toggle-right {
    position: relative;
    flex-shrink: 0;
    width: 85px;
    height: 38px; /* 匹配单行标签高度 */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #9d0c1e;
    font-size: 14px;
    font-weight: bold;
    background: #fff;
    z-index: 2;
}

    /* 核心：横向渐隐遮罩 (由左往右：透明 -> 白色) */
    .tag-toggle-right::before {
        content: "";
        position: absolute;
        top: 0;
        left: -40px; /* 遮罩向左延伸 */
        width: 40px;
        height: 100%;
        background: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
        pointer-events: none;
    }

/* 展开后可选择隐藏遮罩 */
.sub-tag-wrapper.is-expanded .tag-toggle-right::before {
    opacity: 0;
}

/* 按钮内部图标旋转 */
.tag-toggle-right i {
    margin-left: 5px;
    transition: transform 0.3s;
    display: inline-block;
    border: solid #9d0c1e;
    border-width: 0 2px 2px 0;
    padding: 3px;
    transform: rotate(45deg); /* 下箭头 */
}

.sub-tag-wrapper.is-expanded .tag-toggle-right i {
    transform: rotate(-135deg); /* 上箭头 */
}

/* ==========================================================================
   4. 内容列表与动画 (Disease List)
   ========================================================================== */
.content-card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 30px;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: 0 12px 32px rgba(0,0,0,0.06);
    border: 1px solid rgba(255,255,255,0.65);
}

.disease-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.disease-item {
    margin-bottom: 14px;
    animation: fadeInUp 0.4s ease forwards;
}

.disease-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border-radius: 16px;
    background: #fff;
    text-decoration: none;
    border: 1px solid #eef0f4;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    transition: all 0.25s ease;
}

    .disease-link:hover {
        transform: translateY(-2px);
        box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
        border-color: rgba(138, 116, 255, 0.18);
    }

.disease-cover {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    object-fit: cover;
    background: #f3f4f6;
}

.disease-title {
    font-size: 15px;
    font-weight: 600;
    color: #222;
    margin-bottom: 4px;
}

.disease-time {
    font-size: 12px;
    color: #8b8f98;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   5. 分页组件样式 (Pagination)
   ========================================================================== */
.p-container {
    margin-top: 40px;
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
}

.p-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    color: #1a4f8e;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .p-btn.active {
        background: #9d0c1e;
        border-color: #9d0c1e;
        color: #fff;
        cursor: default;
    }

    .p-btn.disabled {
        color: #ccc;
        border-color: #e0e0e0;
        cursor: not-allowed;
        pointer-events: none;
    }

.p-ellipsis {
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: default;
    width: auto;
    padding: 0 4px;
}

/* ==========================================================================
   6. 加载状态 (Loading)
   ========================================================================== */
.loading-state .spinner {
    width: 35px;
    height: 35px;
    border: 3px solid rgba(0, 123, 255, 0.1);
    border-top-color: #ff4953;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   7. 选项卡面板切换
   ========================================================================== */
.tab-pane {
    display: none;
    opacity: 0;
    transform: translateY(10px);
}

    .tab-pane.active {
        display: block;
        opacity: 1;
        transform: translateY(0);
        transition: all 0.4s ease;
    }
