.search-box-container {
background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
padding: 40px 20px;
border-radius: 20px;
max-width: 600px;
margin: 0 auto;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
}
.search-box-demo {
background: white;
border-radius: 15px;
padding: 30px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.03);
}
.search-header {
text-align: center;
margin-bottom: 30px;
}
.search-header h2 {
margin: 0 0 10px 0;
color: #333;
font-size: 2rem;
font-weight: 700;
}
.search-header p {
color: #666;
font-size: 1.1rem;
margin: 0;
}
.search-wrapper {
position: relative;
}
.search-box {
position: relative;
display: flex;
align-items: center;
background: #f8fafc;
border: 2px solid #e2e8f0;
border-radius: 12px;
padding: 5px;
transition: all 0.3s ease;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}
.search-box:focus-within {
border-color: #667eea;
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
background: white;
}
.search-box.focused {
border-radius: 12px 12px 0 0;
}
.search-icon {
font-size: 1.3rem;
color: #999;
padding: 0 15px;
transition: color 0.3s ease;
}
.search-box:focus-within .search-icon {
color: #667eea;
}
.search-input {
flex: 1;
padding: 15px 0;
border: none;
background: transparent;
font-size: 1.1rem;
color: #333;
outline: none;
}
.search-input::placeholder {
color: #999;
}
.search-input:focus::placeholder {
color: #cbd5e1;
}
.clear-btn {
width: 36px;
height: 36px;
border: none;
background: #f1f5f9;
color: #999;
border-radius: 50%;
font-size: 1.2rem;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
margin: 0 5px;
opacity: 0;
visibility: hidden;
transform: scale(0.8);
}
.search-input:not(:placeholder-shown) + .clear-btn,
.search-input:focus + .clear-btn {
opacity: 1;
visibility: visible;
transform: scale(1);
}
.clear-btn:hover {
background: #e2e8f0;
color: #666;
transform: scale(1.1);
}
.search-btn {
padding: 15px 25px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 10px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
margin-left: 5px;
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.search-btn:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}
.suggestions-dropdown {
position: absolute;
top: 100%;
left: 0;
right: 0;
background: white;
border: 2px solid #e2e8f0;
border-top: none;
border-radius: 0 0 12px 12px;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
opacity: 0;
visibility: hidden;
transform: translateY(-10px);
transition: all 0.3s ease;
z-index: 100;
max-height: 300px;
overflow-y: auto;
}
.search-box.focused + .suggestions-dropdown {
opacity: 1;
visibility: visible;
transform: translateY(0);
}
.suggestion-group {
padding: 15px 0;
border-bottom: 1px solid #f1f5f9;
}
.suggestion-group:last-child {
border-bottom: none;
}
.group-title {
padding: 0 20px 10px;
color: #667eea;
font-size: 0.85rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
}
.suggestion-item {
display: flex;
align-items: center;
gap: 15px;
padding: 12px 20px;
cursor: pointer;
transition: all 0.2s ease;
}
.suggestion-item:hover {
background: #f8fafc;
}
.suggestion-item.active {
background: #667eea;
color: white;
}
.suggestion-icon {
font-size: 1.2rem;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
}
.suggestion-text {
font-size: 1rem;
font-weight: 500;
}
.suggestion-item.active .suggestion-text {
color: white;
}
.recent-search {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 20px;
border-bottom: 1px solid #f1f5f9;
}
.recent-search:last-child {
border-bottom: none;
}
.remove-search {
background: none;
border: none;
color: #999;
cursor: pointer;
font-size: 1.2rem;
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
transition: all 0.2s ease;
}
.remove-search:hover {
background: #fee2e2;
color: #ef4444;
}
/* Animations */
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes slideInDown {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
.search-header {
animation: fadeInUp 0.6s ease-out;
}
.search-box {
animation: slideInDown 0.6s ease-out 0.2s both;
}
.suggestion-item {
animation: fadeInUp 0.3s ease-out;
}
.suggestion-item:nth-child(1) { animation-delay: 0.1s; }
.suggestion-item:nth-child(2) { animation-delay: 0.2s; }
.suggestion-item:nth-child(3) { animation-delay: 0.3s; }
/* Responsive */
@media (max-width: 768px) {
.search-box-container {
padding: 30px 15px;
}
.search-box-demo {
padding: 25px;
}
.search-header h2 {
font-size: 1.7rem;
}
.search-input {
font-size: 1rem;
padding: 12px 0;
}
.search-btn {
padding: 12px 20px;
font-size: 0.9rem;
}
.search-icon {
font-size: 1.1rem;
padding: 0 12px;
}
.suggestions-dropdown {
max-height: 250px;
}
.suggestion-text {
font-size: 0.9rem;
}
}
@media (max-width: 480px) {
.search-box {
flex-direction: column;
gap: 10px;
padding: 15px;
}
.search-input {
width: 100%;
}
.search-controls {
display: flex;
width: 100%;
gap: 10px;
}
.clear-btn {
margin: 0;
}
.search-btn {
flex: 1;
margin: 0;
}
.suggestions-dropdown {
position: fixed;
top: auto;
bottom: 0;
left: 0;
right: 0;
height: 70vh;
border-radius: 20px 20px 0 0;
transform: translateY(100%);
}
.search-box.focused + .suggestions-dropdown {
transform: translateY(0);
}
}