/* 搜索框组件样式 - 从3.html完整抽取，不做任何修改 */

/* 主横幅区域 */
.hero {
    position: relative;
    background: linear-gradient(135deg, #4285f4 0%, #673ab7 100%);
    color: white;
    padding: 80px 0 100px;
    overflow: hidden;
    text-align: center;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.hero-bg-item {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.hero-bg-item.active {
    opacity: 0.15;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 1010px; /* 调整为更合适的宽度 */
    margin: 0 auto;
    transition: max-width 0.4s ease-out;
}

.hero-content.advanced-mode-active {
    max-width: 1010px;
}

.hero h1 {
    font-size: 48px;
    font-weight: 600;
    margin-bottom: 32px;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.search-container {
    max-width: 1010px; /* 调整为更合适的宽度 */
    margin: 0 auto;
    position: relative;
    transition: max-width 0.4s ease-out;
}

.search-container.advanced-mode-active {
    max-width: 1010px;
}

/* 高级检索模式下的资源分类样式 */
.search-container.advanced-mode-active .resource-categories {
    max-width: 1010px;
    justify-content: flex-start;
    padding-left: 0;
    margin-bottom: -2px;
}

/* 高级检索模式下激活标签的特殊处理 */
.search-container.advanced-mode-active .category-item.active {
    border-bottom: 2px solid #ffffff;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08), 0 2px 0 #ffffff;
}

/* 资源类型分类样式 - 大气标签页设计 */
.resource-categories {
    display: flex;
    justify-content: flex-start; /* 保持标签左对齐 */
    align-items: flex-end;
    gap: 0;
    margin-bottom: -2px;
    max-width: 1010px; /* 调整为更合适的宽度 */
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 10;
    padding-left: 0;
}

.category-item {
    padding: 8px 23px 14px 19px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 2px solid transparent;
    border-radius: 8px 8px 0 0;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
    text-align: center;
    position: relative;
    backdrop-filter: blur(15px);
    min-width: 70px;
    box-sizing: border-box;
}

.category-item:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.9);
}

.category-item.active {
    background: white;
    border-color: rgba(255, 255, 255, 0.9);
    color: #4285f4;
    font-weight: 600;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08), 0 2px 0 white;
    z-index: 15;
    border-bottom: 2px solid white;
}

.category-item.active:hover {
    background: white;
    color: #357ae8;
}

/* 搜索框包装器 */
.search-box-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: flex-start; /* 与标签对齐方式保持一致 */
    max-width: 1010px; /* 调整为更合适的宽度 */
    margin: 0 auto;
    padding-left: 0;
}

/* 普通检索框 - 与标签页无缝连接 */
.search-box {
    display: flex;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    transition: box-shadow 0.3s ease;
    border: 2px solid #e0e0e0;
    flex: 1;
    min-height: 60px;
    position: relative;
    z-index: 5;
}

/* 当有激活标签时，调整搜索框左上角 */
.search-container:has(.category-item.active) .search-box {
    border-top-left-radius: 0;
    border-top-color: #ffffff;
}

/* 兼容性回退 */
.search-container.has-active-tab .search-box {
    border-top-left-radius: 0;
    border-top-color: #ffffff;
}

.search-box:hover {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 0 0 2px #4285f4;
}

.search-box.focused {
    box-shadow: 0 8px 32px rgba(66, 133, 244, 0.2), 0 0 0 2px #4285f4;
}

.search-box input {
    flex: 1;
    border: none;
    padding: 18px 24px;
    font-size: 18px;
    color: #333;
    outline: none;
    background: transparent;
    min-height: 20px;
    min-width: 300px; /* 调整为更合适的最小宽度 */
}

.search-box input::placeholder {
    color: #aaa;
}

.search-btn {
    background: linear-gradient(135deg, #ea4335, #d93025);
    color: white;
    border: none;
    padding: 18px 28px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 0 8px 8px 0;
    min-width: 122px;
    justify-content: center;
}

.search-btn:hover {
    background: linear-gradient(135deg, #d93025, #b71c1c);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 16px rgba(234, 67, 53, 0.3);
}

/* 高级检索容器 - 替换原检索框 */
.advanced-search-container {
    display: none;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 8px;
    padding: 28px 32px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.8);
    animation: slideDown 0.3s ease-out;
    max-width: 1200px;
    margin: 0 auto;
    backdrop-filter: blur(10px);
}

/* 当有激活标签时，高级检索容器也要调整左上角 */
.search-container:has(.category-item.active) .advanced-search-container {
    border-top-left-radius: 0;
    border-top: 1px solid #ffffff;
}

/* 兼容性回退 */
.search-container.has-active-tab .advanced-search-container {
    border-top-left-radius: 0;
    border-top: 1px solid #ffffff;
}

.advanced-search-container.active {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.advanced-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(66, 133, 244, 0.1);
    position: relative;
}

/* 添加装饰性元素 */
.advanced-search-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #4285f4, transparent);
    border-radius: 1px;
}

.advanced-search-title {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #4285f4, #673ab7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 10px;
}

.advanced-search-title i {
    background: linear-gradient(135deg, #4285f4, #673ab7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-advanced-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.close-advanced-btn:hover {
    background: #ea4335;
    color: white;
    transform: scale(1.05) rotate(90deg);
    box-shadow: 0 4px 12px rgba(234, 67, 53, 0.3);
}

.advanced-condition-row {
    display: grid;
    grid-template-columns: 100px 150px 1fr 80px;
    gap: 16px;
    align-items: center;
    margin-bottom: 8px;
    padding: 14px 20px;
    background: transparent;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

/* 添加微妙的分割线 */
.advanced-condition-row::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 20px;
    right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(66, 133, 244, 0.1) 20%, rgba(66, 133, 244, 0.1) 80%, transparent);
    opacity: 0.6;
}

/* 最后一行不显示分割线 */
.advanced-condition-row:last-child::after {
    display: none;
}

/* 添加微妙的背景效果 */
.advanced-condition-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.02), rgba(103, 58, 183, 0.02));
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.advanced-condition-row.first-row {
    grid-template-columns: 150px 1fr 80px;
    margin-top: 4px;
}

/* 第一行的特殊样式 */
.advanced-condition-row.first-row::before {
    background: linear-gradient(135deg, rgba(66, 133, 244, 0.03), rgba(103, 58, 183, 0.03));
}

.advanced-condition-row:hover {
    border-color: rgba(66, 133, 244, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 12px rgba(66, 133, 244, 0.06);
}

.advanced-condition-row:hover::before {
    opacity: 1;
}

.advanced-condition-row:hover::after {
    background: linear-gradient(90deg, transparent, rgba(66, 133, 244, 0.2) 20%, rgba(66, 133, 244, 0.2) 80%, transparent);
    opacity: 1;
}

.advanced-condition-row select {
    padding: 8px 12px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 400;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.advanced-condition-row select:hover {
    border-color: #4285f4;
    box-shadow: 0 1px 4px rgba(66, 133, 244, 0.1);
}

.advanced-condition-row select:focus {
    border-color: #4285f4;
    background: white;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1);
    outline: none;
}

.advanced-condition-row input {
    padding: 8px 12px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: all 0.2s ease;
}

.advanced-condition-row input:hover {
    border-color: #4285f4;
    box-shadow: 0 1px 4px rgba(66, 133, 244, 0.1);
}

.advanced-condition-row input:focus {
    border-color: #4285f4;
    background: white;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1);
    outline: none;
}

.condition-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.add-condition, .remove-condition {
    width: 28px;
    height: 28px;
    border: 1px solid;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    font-weight: normal;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.add-condition {
    color: #4285f4;
    border-color: #4285f4;
}

.add-condition:hover:not(:disabled) {
    background: #4285f4;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(66, 133, 244, 0.3);
}

.add-condition:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.remove-condition {
    color: #ea4335;
    border-color: #ea4335;
}

.remove-condition:hover {
    background: #ea4335;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(234, 67, 53, 0.3);
}

.advanced-search-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    /*margin-top: 20px;*/
    padding-top: 16px;
    border-top: 1px solid rgba(66, 133, 244, 0.1);
}

.advanced-execute-btn, .switch-simple-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.advanced-execute-btn {
    background: #4285f4;
    color: white;
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.3);
}

.advanced-execute-btn:hover {
    background: #357ae8;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.4);
}

.switch-simple-btn {
    background: white;
    color: #666;
    border: 2px solid #e0e0e0;
}

.switch-simple-btn:hover {
    background: #f5f5f5;
    border-color: #4285f4;
    color: #4285f4;
}

.reset-advanced-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0f2f5;
    color: #666;
    border: 2px solid #e0e0e0;
}

.reset-advanced-btn:hover {
    background: #e0e0e0;
    color: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 高级检索按钮样式 */
.advanced-search-btn-wrapper {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.advanced-search-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    padding: 0;
    transition: color 0.3s ease, opacity 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    background: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.advanced-search-link:hover {
    color: white;
    opacity: 1;
    transform: none;
}

.advanced-search-link i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

/* 当高级检索激活时，箭头向上旋转 */
.advanced-search-link.active i {
    transform: rotate(180deg);
}

/* 字段选择框的特殊样式 */
.condition-field {
    font-weight: 600;
    color: #4285f4;
}

/* 检索词输入框的特殊样式 */
.condition-term {
    font-weight: 500;
  /*  color: #c0392b;*/
}

/* Ensure dropdown doesn't get clipped by container */
.advanced-search-container {
    overflow: visible;
}

/* Chosen.js 自定义样式 */
.chosen-container {
    font-size: 14px;
    position: relative;
}

.chosen-container-single .chosen-single {
    height: 34px;
    line-height: 32px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    background: white;
    box-shadow: none;
    position: relative;
    padding-right: 30px;
}

.chosen-container-single .chosen-single:hover {
    border-color: #4285f4;
    background: white;
}

.chosen-container-active.chosen-with-drop {
    z-index: 1000;
}

.chosen-container-active.chosen-with-drop .chosen-single {
    border-color: #4285f4;
    background: white;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.1);
}

/* Fix arrow display and centering */
.chosen-container-single .chosen-single div {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.chosen-container-single .chosen-single div b {
    display: block;
    width: 100%;
    height: 100%;
    background: none;
    position: relative;
}

/* Create a better looking arrow using CSS */
.chosen-container-single .chosen-single div b::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 6px;
    height: 6px;
    border-right: 2px solid #666;
    border-bottom: 2px solid #666;
    transition: transform 0.2s ease;
}

/* Rotate arrow when dropdown is open */
.chosen-container-active .chosen-single div b::after {
    transform: translate(-50%, -50%) rotate(-135deg);
}

.chosen-drop {
    border: 1px solid #4285f4;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1001 !important;
    margin-top: 2px;
}

.chosen-results li.highlighted {
    background: #e3f2fd;
    color: #1976d2;
}

/* 下拉框内容居左对齐 */
.chosen-results {
    text-align: left;
}

.chosen-results li {
    text-align: left;
    padding-left: 12px;
}

/* Advanced search conditions z-index fixes */
.advanced-condition-row .chosen-container {
    position: relative;
    z-index: 10;
}

.advanced-condition-row .chosen-container-active {
    z-index: 1000;
}

.advanced-condition-row .chosen-drop {
    z-index: 1001;
}

/* When a condition row has an active dropdown, boost its z-index */
.advanced-condition-row:has(.chosen-container-active) {
    z-index: 999 !important;
}

/* Fallback for browsers that don't support :has() */
.advanced-condition-row.dropdown-active {
    z-index: 999 !important;
}

/* Remove transition effects that cause visual jumping */
.advanced-condition-row.dropdown-active {
    transition: none !important;
}

/* 响应式设计 - 移动端适配 */
@media (max-width: 768px) {
    /* 主横幅区域移动端适配 */
    .hero {
        padding: 60px 0 80px;
    }

    .hero h1 {
        font-size: 32px;
        margin-bottom: 24px;
    }

    /* 搜索容器移动端适配 */
    .search-container {
        max-width: 100%;
        padding: 0 16px;
    }

    .search-container.advanced-mode-active {
        max-width: 100%;
    }

    /* 资源分类移动端适配 */
    .resource-categories {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin-bottom: 16px;
        padding: 0 16px;
    }

    .category-item {
        padding: 10px 16px 12px 16px;
        font-size: 14px;
        min-width: auto;
        flex: 1;
        max-width: calc(50% - 4px);
    }

    /* 搜索框移动端适配 */
    .search-box-wrapper {
        flex-direction: column;
        gap: 12px;
        padding: 0 16px;
    }

    .search-box {
        flex-direction: column;
        min-height: auto;
        border-radius: 12px;
        width: 100%;
    }

    .search-box input {
        padding: 16px 20px;
        font-size: 16px;
        border-bottom: 1px solid #e0e0e0;
    }

    .search-btn {
        border-radius: 0 0 12px 12px;
        padding: 16px 20px;
        font-size: 16px;
        min-width: auto;
    }

    /* 高级检索容器移动端适配 */
    .advanced-search-container {
        margin: 0 16px;
        padding: 20px 16px;
        border-radius: 12px;
        max-width: calc(100% - 32px);
    }

    /* 高级检索头部移动端适配 */
    .advanced-search-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }

    .advanced-search-title {
        font-size: 18px;
    }

    .close-advanced-btn {
        align-self: flex-end;
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    /* 高级检索条件行移动端适配 */
    .advanced-condition-row {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px;
        margin-bottom: 12px;
        border: 1px solid rgba(66, 133, 244, 0.1);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.8);
    }

    .advanced-condition-row.first-row {
        grid-template-columns: 1fr;
    }

    .advanced-condition-row select,
    .advanced-condition-row input {
        width: 100%;
        padding: 12px 16px;
        font-size: 16px;
        border-radius: 8px;
    }

    /* 条件操作按钮移动端适配 */
    .condition-actions {
        justify-content: center;
        gap: 16px;
        margin-top: 8px;
    }

    .add-condition, .remove-condition {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    /* 高级检索操作按钮移动端适配 */
    .advanced-search-actions {
        flex-direction: column;
        gap: 12px;
        /*margin-top: 24px;*/
        padding-top: 20px;
    }

    .advanced-execute-btn,
    .switch-simple-btn,
    .reset-advanced-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
        justify-content: center;
    }

    /* 高级检索按钮移动端适配 */
    .advanced-search-btn-wrapper {
        margin-top: 16px;
        justify-content: center;
    }

    .advanced-search-link {
        font-size: 15px;
        padding: 8px 16px;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 20px;
        backdrop-filter: blur(10px);
    }

    /* Chosen.js 移动端适配 */
    .chosen-container-single .chosen-single {
        height: 44px;
        line-height: 42px;
        padding: 0 16px;
        font-size: 16px;
    }

    .chosen-drop {
        border-radius: 8px;
        margin-top: 4px;
    }

    .chosen-results li {
        padding: 12px 16px;
        font-size: 16px;
    }

    /* 移除装饰性伪元素在移动端 */
    .advanced-condition-row::before,
    .advanced-condition-row::after {
        display: none;
    }
}

/* 小屏幕设备进一步优化 */
@media (max-width: 480px) {
    .hero {
        padding: 40px 0 60px;
    }

    .hero h1 {
        font-size: 28px;
        margin-bottom: 20px;
    }

    .category-item {
        max-width: 100%;
        margin-bottom: 8px;
    }

    .search-container,
    .search-container.advanced-mode-active {
        padding: 0 12px;
    }

    .advanced-search-container {
        margin: 0 12px;
        padding: 16px 12px;
        max-width: calc(100% - 24px);
    }

    .advanced-condition-row {
        padding: 12px;
    }

    .advanced-search-title {
        font-size: 16px;
    }
}


.advanced-search-year-range {
    color: #0a0a0a;

    .chosen-container .chosen-drop .chosen-results {
        max-height: 150px;
        overflow-y: auto;
    }

    .block-title {
        text-align: left;
        border-bottom: 1px solid rgba(66, 133, 244, 0.1);
    }

    .year-range {
        display: flex;
        align-items: center;
        gap: 1rem;
        padding: 14px 20px;
    }

    .year-body {
        width: 150px;
    }
}
