/**
 * PulseMyHome - Modern Search Dropdown Styles
 * Version: 2.0
 *
 * Clean, professional autocomplete design
 * NO emojis - SVG icons only
 */

/* ============================================================
   SEARCH CONTAINER
   ============================================================ */

.search-container-header,
.search-container-hero,
.search-container-mobile {
    position: relative;
}

/* ============================================================
   SEARCH RESULTS DROPDOWN
   ============================================================ */

.search-results {
    /* Hidden by default */
    display: none;

    /* Position */
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 50;

    /* Design */
    background: white;
    border: 1px solid #e5e7eb; /* gray-200 */
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1),
                0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Max height with scroll */
    max-height: 480px;
    overflow-y: auto;
    overflow-x: hidden;

    /* Animation */
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 150ms ease-out, transform 150ms ease-out;
}

/* Active state - smooth appear */
.search-results.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   SCROLLBAR STYLING
   ============================================================ */

.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
    background: #d1d5db; /* gray-300 */
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #9ca3af; /* gray-400 */
}

/* ============================================================
   RESULT ITEMS
   ============================================================ */

.search-result-item {
    /* Remove default link styles */
    text-decoration: none;
    color: inherit;

    /* Smooth transitions */
    transition: background-color 150ms ease-in-out,
                color 150ms ease-in-out,
                border-color 150ms ease-in-out;
}

/* Selected state (keyboard navigation) */
.search-result-item.selected {
    background-color: #eff6ff !important; /* blue-50 */
    border-left: 2px solid #3b82f6 !important; /* blue-500 */
    padding-left: 14px; /* compensate for border */
}

/* Hover state */
.search-result-item:hover {
    background-color: #f9fafb; /* gray-50 */
}

/* Focus visible (accessibility) */
.search-result-item:focus-visible {
    outline: 2px solid #3b82f6; /* blue-500 */
    outline-offset: -2px;
    border-radius: 8px;
}

/* ============================================================
   LOADING STATE
   ============================================================ */

.search-loading {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #6b7280; /* gray-500 */
}

/* ============================================================
   ERROR STATE
   ============================================================ */

.search-error {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #dc2626; /* red-600 */
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.search-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #6b7280; /* gray-500 */
}

/* ============================================================
   MOBILE RESPONSIVENESS
   ============================================================ */

@media (max-width: 640px) {
    .search-results {
        /* Full width on mobile */
        left: -1rem;
        right: -1rem;
        width: calc(100% + 2rem);

        /* Smaller max height on mobile */
        max-height: 320px;

        /* Rounded corners only on bottom */
        border-radius: 0 0 12px 12px;

        /* Full width shadow */
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
                    0 2px 4px -1px rgba(0, 0, 0, 0.06);
    }
}

/* ============================================================
   HIGHLIGHT MATCHES
   ============================================================ */

.search-result-item mark,
.search-result-item .highlight {
    background-color: #fef3c7; /* yellow-100 */
    color: #92400e; /* yellow-900 */
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}

/* ============================================================
   DEPARTMENT LINKS (FALLBACK)
   ============================================================ */

.search-dept-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    text-decoration: none;
    color: #111827; /* gray-900 */
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 150ms ease-in-out,
                color 150ms ease-in-out;
}

.search-dept-link:hover {
    background-color: #f9fafb; /* gray-50 */
    color: #3b82f6; /* blue-600 */
}

.search-dept-link svg {
    transition: color 150ms ease-in-out;
}

.search-dept-link:hover svg {
    color: #3b82f6; /* blue-600 */
}

/* ============================================================
   INPUT FOCUS STATE
   ============================================================ */

.search-container-header input:focus,
.search-container-hero input:focus,
.search-container-mobile input:focus {
    /* Enhanced focus for better UX */
    border-color: #3b82f6; /* blue-500 */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ============================================================
   CATEGORY BADGES
   ============================================================ */

.badge-exact {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    background-color: #dcfce7; /* green-100 */
    color: #15803d; /* green-700 */
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-trigram {
    font-size: 0.75rem;
    font-weight: 500;
    color: #9333ea; /* purple-600 */
}

.badge-phonetic {
    font-size: 0.75rem;
    font-weight: 500;
    color: #4f46e5; /* indigo-600 */
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Apply animations when results appear */
.search-results.active {
    animation: slideDown 200ms ease-out;
}

/* ============================================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================================ */

/* Focus visible for keyboard users only */
*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .search-results {
        border: 2px solid currentColor;
    }

    .search-result-item:hover,
    .search-result-item.selected {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .search-results {
        transition: none;
        animation: none;
    }

    .search-result-item {
        transition: none;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */

@media print {
    .search-results {
        display: none !important;
    }
}

/* ============================================================
   HEADER RESPONSIVE - MOBILE ADJUSTMENTS
   ============================================================ */

/* Mobile first: hide by default */
.pmh-logo-text {
    display: none;
}

.pmh-header-nav {
    display: none;
}

/* Show on desktop (640px = sm breakpoint) */
@media (min-width: 640px) {
    .pmh-logo-text {
        display: inline-block;
    }

    .pmh-header-nav {
        display: block;
    }
}
