/* Header Component Styles - Optimized */
.main-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: static;
    top: 0;
    z-index: 999;
    transition: all 0.3s ease;
}

.header-container {
    margin: 0 auto;
    padding: 0 20px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Header Sections */
.header-left {
    display: flex;
    align-items: center;
    flex: 1;
}

.header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    justify-content: flex-end;
}

/* Menu toggle button */
.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #333;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover {
    background-color: rgba(0,0,0,0.1);
    color: #667eea;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
}

.logo a {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo img {
    height: 40px;
    width: auto;
}

/* Search section */
.search-section {
    position: relative;
    display: flex;
    align-items: center;
}

/* Header Search Bar (Large screens) */
.header-search-bar {
    display: flex;
    align-items: center;
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 10px;
    width: 250px;
    min-width: 200px;
}

.header-search-bar:hover {
    border-color: #667eea;
    background: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.header-search-bar-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.95rem;
    color: #666;
    cursor: pointer;
}

.header-search-bar-icon {
    color: #667eea;
    font-size: 1.1rem;
}

/* Search Icon (Small screens only) */
.search-toggle {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #333;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: none;
    align-items: center;
    justify-content: center;
}

.search-toggle:hover {
    background-color: rgba(0,0,0,0.1);
    color: #667eea;
}

/* Profile section */
.profile-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.profile-toggle {
    background: none;
    border: none;
    font-size: 1.8rem;
    color: #333;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-toggle:hover {
    background-color: rgba(0,0,0,0.1);
    color: #667eea;
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
    margin-top: 5px;
}

.profile-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-info {
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    background: #f8f9fa;
}

.user-name {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #555;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #333;
}

.dropdown-item.logout:hover {
    background-color: #fee;
    color: #d32f2f;
}

.dropdown-item i {
    width: 16px;
    font-size: 0.9rem;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 5px 0;
}

/* Responsive styles */
@media (max-width: 767px) {
    .header-container {
        padding: 0 15px;
        gap: 15px;
        height: 60px;
    }
    
    .menu-toggle {
        padding: 8px;
    }
    
    .profile-toggle {
        padding: 8px;
        font-size: 1.6rem;
    }
    
    .logo img {
        height: 30px;
    }
    
    .profile-dropdown {
        min-width: 180px;
        right: -10px;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 10px;
        gap: 10px;
    }
    
    .profile-dropdown {
        min-width: 160px;
        right: -5px;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .header-container {
        padding: 0 20px;
    }
}

/* ========================================
   SEARCH OVERLAY STYLES
   ======================================== */

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 10000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 20px 20px;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
}

.search-overlay.active {
    display: flex;
}

.search-overlay-container {
    max-width: 900px;
    width: 100%;
    background: white;
    border-radius: 20px;
    padding: 0;
    position: relative;
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}

.search-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0,0,0,0.1);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    font-size: 1.3rem;
    color: #333;
}

.search-close:hover {
    background: rgba(0,0,0,0.2);
    transform: rotate(90deg);
}

.search-overlay-content {
    padding: 40px;
    overflow-y: auto;
}

.search-overlay-content h2 {
    font-size: 2rem;
    color: #333;
    margin-bottom: 25px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-overlay-content h2 i {
    color: #667eea;
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 30px;
}

.header-search-input {
    width: 100%;
    padding: 18px 60px 18px 24px;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    background: #f9f9f9;
}

.header-search-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.header-search-clear {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: none;
    padding: 5px;
}

.header-search-clear:hover {
    color: #333;
}

.search-results-container {
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 10px;
}

.search-results-container::-webkit-scrollbar {
    width: 8px;
}

.search-results-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.search-results-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.search-results-container::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

.search-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.search-empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.3;
}

.search-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.search-loading i {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Search Results Grid */
.search-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.search-result-item {
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    text-decoration: none;
    color: inherit;
    background: white;
}

.search-result-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
    border-color: #667eea;
}

.search-result-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.search-result-content {
    padding: 16px;
}

.search-result-content h4 {
    font-size: 1.05rem;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    line-height: 1.3;
}

.search-result-content p {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.5;
}

.search-result-price {
    font-weight: 700;
    color: #10b981;
    font-size: 1.15rem;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideDown {
    from { 
        opacity: 0;
        transform: translateY(-30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Responsive for Search */
@media (max-width: 767px) {
    /* Hide search bar, show icon on mobile only */
    .header-search-bar {
        display: none;
    }
    
    .search-toggle {
        display: flex;
    }
    
    .header-right {
        gap: 10px;
    }
}

@media (max-width: 768px) {
    .search-overlay {
        padding: 70px 15px 20px;
    }
    
    .search-overlay-container {
        border-radius: 16px;
    }
    
    .search-overlay-content {
        padding: 25px;
    }
    
    .search-overlay-content h2 {
        font-size: 1.5rem;
    }
    
    .header-search-input {
        font-size: 1rem;
        padding: 15px 50px 15px 20px;
    }
    
    .search-results-grid {
        grid-template-columns: 1fr;
    }
    
    .search-result-image {
        height: 200px;
    }
    
    .header-container {
        padding: 0 15px;
        gap: 10px;
    }
    
    .header-right {
        gap: 8px;
    }
    
    .search-toggle {
        padding: 8px;
        font-size: 1.2rem;
    }
}
