/** * 搜索功能样式文件 * 包含拟态风格设计和动画效果 */ /* 新闻搜索模块样式 */ .news-search-section { position: relative; /* background-image: url('../images/search-bg.webp'); */ background-size: cover; background-position: center; background-repeat: no-repeat; padding: 80px 0; height: 400px; margin: 0; overflow: hidden; } .news-search-section::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #f7f7f7; z-index: 1; } .news-search-section .search-container { position: relative; z-index: 2; max-width: 1200px; margin: 0 auto; padding: 0 20px; text-align: center; margin-top: 65px; } .search-header { margin-bottom: 40px; } .search-title { color: #ffffff; font-size: 48px; font-weight: 600; margin: 0; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3); letter-spacing: 2px; } .search-form-wrapper { display: flex; justify-content: center; align-items: center; } .news-search-form { width: 100%; max-width: 800px; } .search-controls { display: flex; align-items: center; gap: 0; background: rgba(255, 255, 255, 0.95); border-radius: 50px; padding: 8px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.2); } /* 分类选择器样式 */ .category-selector { position: relative; flex: 0 0 180px; } .category-dropdown { width: 100%; height: 50px; border: none; background: transparent; padding: 0 40px 0 20px; font-size: 16px; color: #666; outline: none; cursor: pointer; appearance: none; -webkit-appearance: none; -moz-appearance: none; border-radius: 25px; transition: all 0.3s ease; } .category-dropdown:focus { color: #333; } /* 搜索输入框样式 */ .news-search-form .search-input-wrapper { position: relative; flex: 1; margin: 0 8px; } .news-search-form .search-input { width: 100%; height: 50px; border: none; background: transparent; padding: 0 20px; font-size: 16px; color: #333; outline: none; border-radius: 25px; transition: all 0.3s ease; } .news-search-form .search-input::placeholder { color: #999; font-weight: 400; } .news-search-form .search-input:focus { background: rgba(255, 255, 255, 0.1); } /* 搜索建议样式 */ .search-suggestions { position: absolute; top: 100%; left: 0; right: 0; background: white; border-radius: 15px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); max-height: 300px; overflow-y: auto; z-index: 1000; display: none; margin-top: 8px; } .search-suggestions.show { display: block; } .suggestion-item { padding: 12px 20px; cursor: pointer; border-bottom: 1px solid #f0f0f0; transition: all 0.2s ease; color: #333; font-size: 14px; } .suggestion-item:hover, .suggestion-item.active { background: #f8f9fa; color: #007bff; } .suggestion-item:last-child { border-bottom: none; } /* 搜索按钮样式 */ .search-button { flex: 0 0 50px; height: 50px; background: linear-gradient(135deg, #007bff, #0056b3); border: none; border-radius: 25px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3); } .search-button:hover { background: linear-gradient(135deg, #0056b3, #004085); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4); } .search-button:active { transform: translateY(0); } .search-button svg { width: 20px; height: 20px; } /* 响应式设计 */ @media (max-width: 768px) { .news-search-section { padding: 60px 0; } .search-title { font-size: 32px; margin-bottom: 30px; } .search-controls { flex-direction: column; gap: 12px; padding: 20px; border-radius: 25px; } .category-selector, .news-search-form .search-input-wrapper { flex: none; width: 100%; margin: 0; } .category-dropdown, .news-search-form .search-input { height: 48px; text-align: center; } .search-button { flex: none; width: 100%; height: 48px; border-radius: 24px; } } @media (max-width: 480px) { .news-search-section { padding: 40px 0; } .news-search-section .search-container { padding: 0 15px; } .search-title { font-size: 28px; letter-spacing: 1px; } .search-controls { padding: 15px; } .news-search-section .search-container { padding: 0 !important; } } @media (min-width: 769px) and (max-width: 1024px) { .search-title { font-size: 42px; } .search-controls { max-width: 700px; margin: 0 auto; } .category-selector { flex: 0 0 160px; } } /* 搜索按钮样式 */ .nav-search { position: relative; display: flex; align-items: center; flex-shrink: 0; } .search-toggle { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: rgba(0, 0, 0, 0.05); border: none; border-radius: 8px; cursor: pointer; margin-left: 15px; padding: 0; transition: all 0.3s ease; } .search-toggle:hover { background: rgba(0, 0, 0, 0.1); transform: scale(1.05); } .search-icon { width: 20px; height: 20px; stroke: #333; fill: none; transition: stroke 0.3s ease; } .search-toggle:hover .search-icon { stroke: #007bff; } /* 搜索框弹出层 */ .search-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(10px); z-index: 100000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); } .search-overlay.active { opacity: 1; visibility: visible; } /* 搜索容器 */ .search-container { position: relative; width: 100%; height: 100%; transform: translateY(-50px) scale(0.9); transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); display: flex; align-items: center; justify-content: center; } .search-overlay.active .search-container { transform: translateY(0) scale(1); } /* 拟态风格搜索框 */ .search-box { background: #f0f0f0; border-radius: 25px; padding: 40px; position: relative; width: 90%; max-width: 800px; } .search-form { display: flex; flex-direction: column; gap: 20px; } /* 搜索输入区域 */ .search-input-wrapper { position: relative; display: flex; align-items: center; background: #f0f0f0; border-radius: 50px; padding: 0 20px; border: 1px solid #ddd; transition: all 0.3s ease; } .search-input-wrapper:focus-within { border-color: #0073aa; } .search-input-icon { color: #999; margin-right: 15px; flex-shrink: 0; } .search-input { flex: 1; border: none; background: transparent; padding: 20px 0; font-size: 18px; color: #333; outline: none; font-family: inherit; } .search-input::placeholder { color: #999; font-weight: 400; } .search-close { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: none; border-radius: 50%; background: #e6e6e6; cursor: pointer; color: #666; transition: all 0.3s ease; margin-left: 10px; } .search-close:hover { background: #ddd; color: #333; } .search-close:active { background: linear-gradient(145deg, #d1d1d1, #e6e6e6); box-shadow: inset 2px 2px 4px #bebebe, inset -2px -2px 4px #ffffff; transform: scale(0.95); } /* 搜索提交按钮 */ .search-submit { align-self: center; padding: 18px 50px; border: none; border-radius: 50px; background: #007bff; color: white; font-size: 18px; font-weight: 600; cursor: pointer; transition: all 0.3s ease; min-width: 140px; box-shadow: 8px 8px 16px #bebebe, -8px -8px 16px #ffffff; } .search-submit:hover { background: #0056b3; } .search-submit:active { background: #004085; } /* 响应式设计 */ @media (max-width: 768px) { .nav-search { position: relative; z-index: 10001; } .search-toggle { width: 40px; height: 40px; background: rgba(255, 255, 255, 0.1); border-radius: 8px; backdrop-filter: blur(10px); } .search-toggle:hover { background: rgba(255, 255, 255, 0.2); } .search-toggle .search-icon { stroke: #fff; } .search-toggle:hover .search-icon { stroke: #007bff; } .search-container { width: 100%; height: 100%; padding: 20px; } .search-box { padding: 25px; border-radius: 20px; width: 100%; max-width: none; } .search-input-wrapper { padding: 0 15px; } .search-input { padding: 15px 0; font-size: 14px; } .search-submit { padding: 12px 30px; font-size: 14px; } } @media (max-width: 480px) { .search-box { padding: 15px; } .search-form { gap: 15px; } .search-input-wrapper { padding: 0 12px; } .search-input { padding: 12px 0; } .search-submit { padding: 10px 25px; min-width: 100px; } } /* 搜索按钮激活状态 */ .search-toggle.active { background-color: rgba(255, 255, 255, 0.1); } /* 搜索结果提示 */ .search-suggestions { position: absolute; top: 100%; left: 0; right: 0; background: #f0f0f0; border-radius: 0 0 20px 20px; border: 1px solid #ddd; border-top: none; max-height: 200px; overflow-y: auto; z-index: 10; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.3s ease; } .search-suggestions.show { opacity: 1; visibility: visible; transform: translateY(0); } .search-suggestion-item { padding: 12px 20px; cursor: pointer; transition: background-color 0.2s ease; border-bottom: 1px solid rgba(0, 0, 0, 0.05); } .search-suggestion-item:hover { background: rgba(0, 123, 255, 0.1); } .search-suggestion-item:last-child { border-bottom: none; } /* 无障碍访问 */ @media (prefers-reduced-motion: reduce) { .search-overlay, .search-container, .search-toggle, .search-close, .search-submit { transition: none; } .search-toggle.active { animation: none; } } /* 高对比度模式 */ @media (prefers-contrast: high) { .search-toggle { border: 2px solid #000; } .search-box { border: 2px solid #000; } .search-input-wrapper { border: 1px solid #666; } } /* 震动动画效果 */ @keyframes shake { 0%, 100% { transform: translateX(0); } 10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); } 20%, 40%, 60%, 80% { transform: translateX(10px); } } .search-input.shake { animation: shake 0.6s ease-in-out; } /* 新闻搜索模块样式 */ .news-search-section { /* background: url('../images/search-bg.webp') center/cover no-repeat; */ padding: 80px 0; position: relative; overflow: hidden; } .news-search-section::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background:#f7f7f7; z-index: 1; } .news-search-section .search-container { position: relative; z-index: 2; max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; flex-direction: column; align-items: center; gap: 40px; margin-top: 65px; } /* 搜索标题样式 */ .search-header { text-align: center; margin-bottom: 0; } .search-title { font-size: 48px; font-weight: 700; color: white; margin: 0; text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5); letter-spacing: 2px; } /* 搜索表单包装器 */ .search-form-wrapper { width: 100%; max-width: 800px; margin: 0; } .news-search-form { width: 100%; } .news-search-form .search-controls { display: flex; align-items: center; gap: 0; background: rgba(255, 255, 255, 0.95); border-radius: 50px; padding: 8px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.2); } /* 响应式设计 */ @media (max-width: 768px) { .news-search-section { padding: 60px 0; } .search-title { font-size: 32px; margin-bottom: 30px; } .news-search-form .search-controls { flex-direction: column; gap: 12px; padding: 20px; border-radius: 25px; } .category-selector, .news-search-form .search-input-wrapper { flex: none; width: 100%; margin: 0; } .category-dropdown, .news-search-form .search-input { height: 48px; text-align: center; } .search-button { flex: none; width: 100%; height: 48px; border-radius: 24px; } }