/**
 * Header Improvements CSS
 * Sticky header, search bar, live counter, help button
 */

/* ============================================
   Header Top Bar with Live Counter
   ============================================ */
.header-top-bar {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    padding: 8px 0;
    font-size: 14px;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.live-visitor-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    animation: pulse-glow 2s ease-in-out infinite;
}

.live-visitor-counter i {
    color: #10b981;
    font-size: 16px;
}

.live-visitor-counter #liveVisitorCount {
    color: #10b981;
    font-weight: 700;
    font-size: 16px;
}

.live-visitor-counter .fire-icon {
    font-size: 16px;
    animation: flicker 1.5s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

@keyframes flicker {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.header-top-links {
    display: flex;
    gap: 20px;
}

.header-top-links a {
    color: #d1d5db;
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.header-top-links a:hover {
    color: #ffffff;
}

.header-top-links i {
    font-size: 14px;
}

/* ============================================
   Sticky Header
   ============================================ */
.header {
    position: relative;
    transition: all 0.3s ease;
    background: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.header.sticky {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Add padding to body when header is sticky to prevent content jump */
body.header-sticky-active {
    padding-top: 140px; /* Adjust based on header height */
}

.header.sticky .header-top-bar {
    padding: 5px 0;
    font-size: 13px;
}

.header.sticky .logo span {
    font-size: 18px;
}

/* ============================================
   Search Bar
   ============================================ */
.header-search {
    position: relative;
    flex: 1;
    max-width: 500px;
    margin: 0 30px;
}

.search-form {
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.search-form:focus-within {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    background: #ffffff;
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 15px;
    font-size: 14px;
    background: transparent;
    color: #1f2937;
}

.search-input::placeholder {
    color: #9ca3af;
}

.search-button {
    background: #6366f1;
    border: none;
    color: #ffffff;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-button:hover {
    background: #4f46e5;
}

.search-button i {
    font-size: 16px;
}

/* Search Suggestions Dropdown */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    display: none;
    z-index: 1001;
}

.search-suggestions.show {
    display: block;
}

.search-suggestion-item {
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.2s ease;
}

.search-suggestion-item:last-child {
    border-bottom: none;
}

.search-suggestion-item:hover {
    background: #f9fafb;
}

.search-suggestion-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 8px;
    color: #ffffff;
    font-size: 18px;
}

.search-suggestion-content {
    flex: 1;
}

.search-suggestion-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
}

.search-suggestion-subtitle {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.search-suggestion-price {
    font-weight: 700;
    color: #6366f1;
    font-size: 14px;
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: #6b7280;
}

.search-no-results i {
    font-size: 32px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* ============================================
   Help Button
   ============================================ */
.help-button {
    position: relative;
    background: linear-gradient(135deg, #10b981, #059669) !important;
    color: #ffffff !important;
    animation: pulse-help 2s ease-in-out infinite;
}

.help-button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.help-button::after {
    content: 'Help';
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 600;
    color: #10b981;
    white-space: nowrap;
}

@keyframes pulse-help {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 1024px) {
    .header-search {
        max-width: 350px;
        margin: 0 20px;
    }

    .header-top-bar {
        font-size: 13px;
    }

    .search-input {
        font-size: 13px;
        padding: 10px 12px;
    }

    .search-button {
        padding: 10px 16px;
    }
}

@media (max-width: 768px) {
    .header-top-bar {
        flex-direction: column;
        gap: 8px;
        padding: 10px 0;
        text-align: center;
    }

    .header-top-links {
        justify-content: center;
    }

    .header-search {
        display: none; /* Hide on mobile, can be toggled */
    }

    .header-content {
        flex-wrap: wrap;
        gap: 10px;
    }

    .help-button::after {
        display: none;
    }

    body.header-sticky-active {
        padding-top: 180px;
    }
}

/* Mobile Search Toggle (optional feature) */
.mobile-search-toggle {
    display: none;
    background: none;
    border: none;
    color: #1f2937;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
}

@media (max-width: 768px) {
    .mobile-search-toggle {
        display: block;
    }

    .header-search.mobile-visible {
        display: block;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #ffffff;
        padding: 15px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        max-width: none;
        margin: 0;
    }
}

/* ============================================
   Header Content Adjustments
   ============================================ */
.header-content {
    display: flex;
    align-items: center;
    padding: 15px 0;
    gap: 20px;
}

.header.sticky .header-content {
    padding: 10px 0;
}

/* Ensure navigation items are properly aligned with new search bar */
.main-nav {
    flex: 0 0 auto;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* Logo adjustments */
.logo {
    flex: 0 0 auto;
}
