/* ========================================
   Header Component Styles — Mobile-First
   ======================================== */

.main-header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: static;
    z-index: 999;
}

.header-container {
    margin: 0 auto;
    padding: 0 15px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: relative;
}

/* --- Header Sections --- */
.header-left {
    display: flex;
    align-items: center;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
}

/* --- Menu Toggle --- */
.menu-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #333;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-toggle:hover {
    background: rgba(0,0,0,0.1);
    color: var(--accent, #667eea);
}

/* --- Logo --- */
.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 30px;
    width: auto;
}

/* --- Search Section --- */
.search-section {
    position: relative;
    display: flex;
    align-items: center;
}

/* Desktop Search Bar — hidden on mobile */
.header-search-bar {
    display: none;
}

/* Mobile Search Icon */
.search-toggle {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #333;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-toggle:hover {
    background: rgba(0,0,0,0.1);
    color: var(--accent, #667eea);
}

/* --- Profile --- */
.profile-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.profile-toggle {
    background: none;
    border: none;
    font-size: 1.6rem;
    color: #333;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-toggle:hover {
    background: rgba(0,0,0,0.1);
    color: var(--accent, #667eea);
}

/* --- Dropdown --- */
.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: 180px;
    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;
    border-radius: 8px 8px 0 0;
}

.profile-info .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: #f8f9fa;
    color: #333;
}

.dropdown-item.logout:hover {
    background: #fee;
    color: #d32f2f;
}

.dropdown-item i {
    width: 16px;
    font-size: 0.9rem;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 5px 0;
}

/* ========================================
   SEARCH OVERLAY
   ======================================== */
.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: 70px 15px 20px;
    overflow-y: auto;
}

.search-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.search-overlay-container {
    max-width: 900px;
    width: 100%;
    background: #fff;
    border-radius: 16px;
    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: 15px;
    right: 15px;
    background: rgba(0,0,0,0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    color: #333;
}

.search-close:hover {
    background: rgba(0,0,0,0.2);
    transform: rotate(90deg);
}

.search-overlay-content {
    padding: 25px;
    overflow-y: auto;
}

.search-overlay-content h2 {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-overlay-content h2 i {
    color: var(--accent, #667eea);
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.header-search-input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 50px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f9f9f9;
}

.header-search-input:focus {
    outline: none;
    border-color: var(--accent, #667eea);
    background: #fff;
    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: color 0.3s ease;
    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: var(--accent, #667eea);
    border-radius: 10px;
}

.search-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.search-empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    opacity: 0.3;
    display: block;
}

.search-loading {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.search-loading i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

/* Search Results Grid */
.search-results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.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: #fff;
}

.search-result-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
    border-color: var(--accent, #667eea);
}

.search-result-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.search-result-content {
    padding: 14px;
}

.search-result-content h4 {
    font-size: 1rem;
    margin-bottom: 6px;
    color: #333;
    font-weight: 600;
    line-height: 1.3;
}

.search-result-content p {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.5;
}

.search-result-price {
    font-weight: 700;
    color: #10b981;
    font-size: 1.1rem;
}

/* ========================================
   SIDEBAR
   ======================================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    width: 260px;
    height: 100vh;
    background: #fff;
    z-index: 1001;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    background: #f8fafc;
    flex-shrink: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.sidebar-toggle:hover {
    background: #e5e7eb;
    color: #374151;
}

.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-user-profile {
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f8fafc;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary, #f26722);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
    flex-shrink: 0;
}

.sidebar .user-info {
    flex: 1;
    min-width: 0;
}

.sidebar .user-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    color: #6b7280;
    font-size: 12px;
    text-transform: capitalize;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 15px;
    text-decoration: none;
    color: #6b7280;
    transition: all 0.3s ease;
    border: none;
    background: none;
    width: 100%;
    font-size: 14px;
}

.sidebar-nav-link:hover {
    background: #f3f4f6;
    color: var(--primary, #f26722);
}

.sidebar-nav-link.active {
    background: rgba(242, 103, 34, 0.1);
    color: var(--primary, #f26722);
    border-right: 3px solid var(--primary, #f26722);
}

.sidebar-nav-link i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-text {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.sidebar-logout-btn,
.sidebar-login-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    width: 100%;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.sidebar-logout-btn {
    color: #dc2626;
    background: #fee2e2;
}

.sidebar-login-btn {
    color: var(--primary, #f26722);
    background: rgba(242, 103, 34, 0.1);
}

.sidebar-logout-btn:hover {
    background: #fecaca;
    transform: translateY(-1px);
}

.sidebar-login-btn:hover {
    background: rgba(242, 103, 34, 0.2);
    transform: translateY(-1px);
}

/* ========================================
   RESPONSIVE: TABLET+
   ======================================== */
@media (min-width: 768px) {
    .header-container {
        padding: 0 20px;
        height: 70px;
        gap: 15px;
    }

    .logo img {
        height: 40px;
    }

    .profile-toggle {
        font-size: 1.8rem;
        padding: 10px;
    }

    .profile-dropdown {
        min-width: 200px;
    }

    /* Show desktop search bar, hide mobile icon */
    .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: var(--accent, #667eea);
        background: #fff;
        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: var(--accent, #667eea);
        font-size: 1.1rem;
    }

    .search-toggle {
        display: none;
    }

    .header-right {
        gap: 15px;
    }

    /* Search Overlay desktop sizing */
    .search-overlay {
        padding: 80px 20px 20px;
    }

    .search-overlay-container {
        border-radius: 20px;
    }

    .search-overlay-content {
        padding: 40px;
    }

    .search-overlay-content h2 {
        font-size: 2rem;
        margin-bottom: 25px;
    }

    .header-search-input {
        font-size: 1.1rem;
        padding: 18px 60px 18px 24px;
    }

    .search-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 20px;
    }

    .search-result-image {
        height: 180px;
    }

    .search-close {
        top: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }

    .sidebar {
        width: 280px;
        left: -280px;
    }
}

/* ========================================
   RESPONSIVE: SMALL MOBILE (max-width: 480px)
   ======================================== */
@media (max-width: 480px) {
    .header-container {
        padding: 0 10px;
    }

    .sidebar {
        width: 240px;
        left: -240px;
    }

    .profile-dropdown {
        min-width: 160px;
        right: -5px;
    }
}
