/**
 * Geniatech Download Search Widget Styles
 * 下载搜索框小部件样式
 */

.geniatech-download-search-wrapper {
    position: relative;
    width: 100%;
}

.geniatech-download-search-container {
    position: relative;
    width: 100%;
}

.geniatech-download-search-form {
    display: flex;
    align-items: stretch;
    width: 100%;
}

.geniatech-download-search-input-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.geniatech-download-search-input {
    width: 100%;
    height: 48px;
    padding: 12px 60px 12px 20px; /* 右侧留出更多空间给红色按钮 */
    border: none; /* 移除边框 */
    border-radius: 25px; /* 圆润的搜索框 */
    background-color: rgba(255, 255, 255, 0.3); /* 半透明白色背景 */
    backdrop-filter: blur(15px); /* 背景模糊效果 */
    -webkit-backdrop-filter: blur(15px); /* Safari支持 */
    color: #ffffff; /* 白色文字 */
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.geniatech-download-search-input:focus {
    background-color: rgba(255, 255, 255, 0.4); /* 聚焦时稍微更不透明 */
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3); /* 白色光晕 */
}

/* 支持不同背景透明度的变体 */
.geniatech-download-search-input.blur-light {
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.geniatech-download-search-input.blur-medium {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.geniatech-download-search-input.blur-heavy {
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

/* 深色背景变体 */
.geniatech-download-search-input.blur-dark {
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

.geniatech-download-search-input.blur-dark::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.geniatech-download-search-input.blur-dark:focus {
    border-color: #007cba;
    background-color: rgba(0, 0, 0, 0.4);
}

.geniatech-download-search-input::placeholder {
    color: rgba(255, 255, 255, 0.8); /* 半透明白色占位符 */
    opacity: 1;
}

/* 清除按钮样式 */
.geniatech-download-search-clear {
    position: absolute;
    right: 100px; /* 调整位置，避免与搜索按钮重叠 */
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6); /* 半透明白色 */
    cursor: pointer;
    padding: 4px;
    font-size: 14px;
    line-height: 1;
    transition: all 0.3s ease;
    z-index: 3; /* 确保在搜索按钮之上 */
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.geniatech-download-search-clear:hover {
    color: #ffffff; /* 悬停时完全白色 */
    background-color: rgba(255, 255, 255, 0.2);
}

.geniatech-download-search-clear:focus {
    outline: none;
}

/* 当显示清除按钮时，调整输入框右内边距 */
.geniatech-download-search-input-wrapper:has(.geniatech-download-search-clear[style*="display: inline"]) .geniatech-download-search-input,
.geniatech-download-search-input-wrapper:has(.geniatech-download-search-clear[style*="display: block"]) .geniatech-download-search-input {
    padding-right: 75px; /* 为搜索按钮和清除按钮留出空间 */
}

/* 搜索按钮样式 - 红色圆形按钮 */
.geniatech-download-search-button {
    position: absolute;
    right: 4px; /* 默认位置，可通过Elementor控制覆盖 */
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px; /* 默认大小，可通过Elementor控制覆盖 */
    height: 40px; /* 默认大小，可通过Elementor控制覆盖 */
    background: linear-gradient(135deg, #dc3545, #c82333); /* 红色渐变背景 */
    border: none;
    color: #ffffff; /* 白色图标 */
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    border-radius: 50%; /* 完全圆形 */
    z-index: 2;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3); /* 红色阴影 */
}

.geniatech-download-search-button:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a); /* 悬停时更深的红色 */
    transform: translateY(-50%) scale(1.05); /* 轻微放大效果 */
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.geniatech-download-search-button:focus {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.3);
}

.geniatech-download-search-button:active {
    transform: translateY(-50%) scale(0.95);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.4);
}

.geniatech-download-search-button i,
.geniatech-download-search-button svg {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #ffffff !important; /* 确保图标是白色 */
    fill: #ffffff !important; /* 确保SVG图标是白色 */
}

/* 确保Elementor图标正确显示 */
.geniatech-download-search-button .e-font-icon-svg {
    fill: #ffffff !important;
    color: #ffffff !important;
}

/* 备用搜索图标 - 如果FontAwesome图标不显示 */
.geniatech-download-search-button::before {
    content: '';
    display: none; /* 默认隐藏 */
}

/* 当没有图标时显示备用图标 */
.geniatech-download-search-button:empty::before,
.geniatech-download-search-button:not(:has(i)):not(:has(svg))::before {
    content: '🔍';
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #ffffff;
}

/* 隐藏搜索按钮文字 */
.geniatech-download-search-button-text {
    display: none;
}

/* 状态信息样式 */
.geniatech-download-search-status {
    margin-top: 8px;
    padding: 8px 12px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 14px;
    color: #666666;
}

.geniatech-download-search-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.geniatech-download-search-loading::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top: 2px solid #007cba;
    border-radius: 50%;
    animation: geniatech-search-spin 1s linear infinite;
}

@keyframes geniatech-search-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .geniatech-download-search-input {
        font-size: 16px; /* 防止iOS缩放 */
        height: 44px;
        padding: 10px 55px 10px 18px; /* 调整移动端内边距 */
    }
    
    /* 移动端按钮尺寸由Elementor控制或使用默认值 */
    
    .geniatech-download-search-button i,
    .geniatech-download-search-button svg {
        font-size: 14px;
        width: 14px;
        height: 14px;
    }
    
    .geniatech-download-search-clear {
        right: 100px;
        width: 18px;
        height: 18px;
        font-size: 12px;
    }
    
    /* 移动端显示清除按钮时的内边距调整 */
    .geniatech-download-search-input-wrapper:has(.geniatech-download-search-clear[style*="display: inline"]) .geniatech-download-search-input,
    .geniatech-download-search-input-wrapper:has(.geniatech-download-search-clear[style*="display: block"]) .geniatech-download-search-input {
        padding-right: 68px;
    }
}

@media (max-width: 480px) {
    .geniatech-download-search-input {
        height: 40px;
        padding: 8px 50px 8px 16px;
        border-radius: 20px;
    }
    
    /* 移动端按钮尺寸由Elementor控制或使用默认值 */
    
    .geniatech-download-search-button i,
    .geniatech-download-search-button svg {
        font-size: 12px;
        width: 12px;
        height: 12px;
    }
    
    .geniatech-download-search-clear {
        right: 100px;
        width: 16px;
        height: 16px;
        font-size: 10px;
    }
}

/* 高对比度模式支持 */
@media (prefers-contrast: high) {
    .geniatech-download-search-input {
        border-width: 2px;
    }
    
    .geniatech-download-search-button {
        border-width: 2px;
    }
}

/* 减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
    .geniatech-download-search-input,
    .geniatech-download-search-button,
    .geniatech-download-search-clear {
        transition: none;
    }
    
    .geniatech-download-search-loading::before {
        animation: none;
    }
    
    .geniatech-download-search-button:active {
        transform: none;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .geniatech-download-search-input {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #ffffff;
    }
    
    .geniatech-download-search-input::placeholder {
        color: #a0aec0;
    }
    
    .geniatech-download-search-status {
        background-color: #2d3748;
        color: #e2e8f0;
    }
}

/* 焦点可见性增强 */
.geniatech-download-search-input:focus-visible,
.geniatech-download-search-button:focus-visible,
.geniatech-download-search-clear:focus-visible {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* 禁用状态 */
.geniatech-download-search-input:disabled,
.geniatech-download-search-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.geniatech-download-search-button:disabled:hover {
    background-color: #007cba;
    border-color: #007cba;
    transform: none;
}

/* 加载状态 */
.geniatech-download-search-wrapper.loading .geniatech-download-search-button {
    pointer-events: none;
    opacity: 0.7;
}

.geniatech-download-search-wrapper.loading .geniatech-download-search-input {
    pointer-events: none;
}

/* 错误状态 */
.geniatech-download-search-wrapper.error .geniatech-download-search-input {
    border-color: #e53e3e;
    box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.1);
}

.geniatech-download-search-wrapper.error .geniatech-download-search-status {
    background-color: #fed7d7;
    color: #c53030;
    border-left: 4px solid #e53e3e;
}

/* 成功状态 */
.geniatech-download-search-wrapper.success .geniatech-download-search-input {
    border-color: #38a169;
    box-shadow: 0 0 0 2px rgba(56, 161, 105, 0.1);
}

.geniatech-download-search-wrapper.success .geniatech-download-search-status {
    background-color: #c6f6d5;
    color: #2f855a;
    border-left: 4px solid #38a169;
}

/* RTL支持 */
[dir="rtl"] .geniatech-download-search-clear {
    right: auto;
    left: 12px;
}

[dir="rtl"] .geniatech-download-search-input-wrapper:has(.geniatech-download-search-clear[style*="display: inline"]) .geniatech-download-search-input,
[dir="rtl"] .geniatech-download-search-input-wrapper:has(.geniatech-download-search-clear[style*="display: block"]) .geniatech-download-search-input {
    padding-right: 16px;
    padding-left: 40px;
}

/* 搜索筛选相关样式 */
.geniatech-download-center.geniatech-search-active .geniatech-download-table-row,
.geniatech-download-center.geniatech-search-active .geniatech-download-list-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.geniatech-download-center.geniatech-search-active .geniatech-download-table-row:not([style*="display: none"]),
.geniatech-download-center.geniatech-search-active .geniatech-download-list-item:not([style*="display: none"]) {
    opacity: 1;
    transform: translateY(0);
}

.geniatech-download-center.geniatech-search-active .geniatech-download-table-row[style*="display: none"],
.geniatech-download-center.geniatech-search-active .geniatech-download-list-item[style*="display: none"] {
    opacity: 0;
    transform: translateY(-10px);
}

/* 无结果消息样式 */
.geniatech-download-no-results {
    text-align: center;
    padding: 40px 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
    color: #666666;
}

.geniatech-download-no-results p {
    margin: 0 0 10px 0;
    font-size: 16px;
}

.geniatech-download-no-results p:last-child {
    margin-bottom: 0;
    font-size: 14px;
}

.geniatech-download-no-results .geniatech-clear-search {
    color: #007cba;
    text-decoration: none;
    font-weight: 500;
}

.geniatech-download-no-results .geniatech-clear-search:hover {
    color: #005a87;
    text-decoration: underline;
}

/* 搜索高亮效果 */
.geniatech-search-highlight {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 500;
}

/* 搜索状态指示器 */
.geniatech-download-center.geniatech-search-active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #007cba, #005a87);
    border-radius: 2px;
    z-index: 1;
}

/* 表格搜索状态 */
.geniatech-download-center.geniatech-search-active .geniatech-download-table {
    position: relative;
}

/* 列表搜索状态 */
.geniatech-download-center.geniatech-search-active .geniatech-download-list {
    position: relative;
}

/* 打印样式 */
@media print {
    .geniatech-download-search-wrapper {
        display: none;
    }
}
