/**
 * LIYU JOBS - Live Search & UI Enhancements
 * Modern styling for search suggestions, dropdowns, and animated transitions
 */

/* Live Search Suggestions Box */
#searchSuggestions {
    animation: slideDown 200ms ease-out;
}

#searchSuggestions.hidden {
    animation: slideUp 200ms ease-out forwards;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

/* Search Suggestions Button Items */
#searchSuggestions [role="option"] {
    cursor: pointer;
    position: relative;
}

#searchSuggestions [role="option"]:hover,
#searchSuggestions [role="option"][aria-selected="true"] {
    background-color: rgb(240, 249, 245);
    color: rgb(27, 94, 32);
}

#searchSuggestions [role="option"] svg {
    opacity: 0;
    transition: opacity 200ms ease;
}

#searchSuggestions [role="option"]:hover svg,
#searchSuggestions [role="option"][aria-selected="true"] svg {
    opacity: 1;
    transform: translateX(2px);
}

/* Dropdown Animations */
[id$="Dropdown"]:not(.hidden) {
    animation: dropdownOpen 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownOpen {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Jobs Dropdown */
#jobsDropdown {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

#jobsDropdown a {
    position: relative;
}

#jobsDropdown a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: rgb(27, 94, 32);
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 200ms ease;
}

#jobsDropdown a:hover::after {
    transform: scaleX(1);
}

#jobsDropdown a:hover {
    background-color: rgba(27, 94, 32, 0.05);
    color: rgb(27, 94, 32);
}

/* Search Form Styling */
.search-panel input:focus,
.search-panel textarea:focus {
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1), 0 0 0 1px rgba(27, 94, 32, 0.3);
}

.search-panel input::placeholder {
    color: rgb(107, 114, 128);
}

.search-panel button[type="submit"] {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 200ms ease;
}

.search-panel button[type="submit"]:hover {
    box-shadow: 0 20px 25px -5px rgba(27, 94, 32, 0.2), 0 10px 10px -5px rgba(27, 94, 32, 0.1);
    transform: translateY(-2px);
}

.search-panel button[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Enhanced Navigation Links */
.nav-link {
    position: relative;
    padding-bottom: 2px;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: currentColor;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 200ms ease;
}

.nav-link:hover::after {
    transform: scaleX(1);
}

/* Animate SVG icons */
.nav-link svg {
    transition: transform 200ms ease;
}

.nav-link:hover svg {
    transform: rotate(180deg);
}

/* Mobile Menu Animation */
#mobileMenu:not(.hidden) {
    animation: slideDownMenu 300ms ease-out;
}

@keyframes slideDownMenu {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 1000px;
    }
}

#mobileMenu.hidden {
    animation: slideUpMenu 300ms ease-out forwards;
}

@keyframes slideUpMenu {
    from {
        opacity: 1;
        max-height: 1000px;
    }
    to {
        opacity: 0;
        max-height: 0;
    }
}

/* User Menu Dropdown */
#userMenu:not(.hidden) {
    animation: dropdownOpenRight 150ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownOpenRight {
    from {
        opacity: 0;
        transform: translateY(-4px) translateX(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateX(0);
    }
}

#userMenu {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

#userMenu a:hover {
    background-color: rgba(27, 94, 32, 0.05);
    padding-left: 1.25rem;
    transition: all 150ms ease;
}

/* Notification Panel */
.notification-panel:not(.hidden) {
    animation: slideDownSmall 150ms ease-out;
}

@keyframes slideDownSmall {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-panel {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Logo Hover Effect */
a[href="/"] svg {
    transition: transform 200ms ease;
}

a[href="/"]:hover svg {
    transform: scale(1.05) rotate(5deg);
}

/* Theme Toggle Button */
#themeToggleBtn {
    transition: all 200ms ease;
}

#themeToggleBtn:hover {
    background-color: rgba(27, 94, 32, 0.1);
}

#themeToggleBtn svg {
    transition: transform 300ms ease;
}

#themeToggleBtn:hover svg {
    transform: rotate(180deg);
}

/* Fade-in Animation for List Items */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fadeIn {
    animation: fadeIn 200ms ease-out;
}

/* Focus Visible States for Accessibility */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 2px solid transparent;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1), 0 0 0 1px rgba(27, 94, 32, 0.5);
}

/* Loading Spinner Animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Smooth Transitions */
* {
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

button,
a,
input,
textarea,
select {
    transition: all 150ms ease;
}

/* Empty State Styling */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    text-align: center;
}

.empty-state svg {
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #jobsDropdown {
        position: fixed;
        left: 0;
        right: 0;
        margin-left: 1rem;
        margin-right: 1rem;
        width: auto;
    }
    
    #userMenu {
        right: auto;
        left: -8rem;
    }
    
    .search-panel {
        grid-template-columns: 1fr;
    }
    
    .search-panel button {
        width: 100%;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    #searchSuggestions {
        background-color: rgb(31, 41, 55);
        border-color: rgb(55, 65, 81);
    }
    
    #searchSuggestions [role="option"]:hover,
    #searchSuggestions [role="option"][aria-selected="true"] {
        background-color: rgba(27, 94, 32, 0.2);
    }
    
    .search-panel {
        background-color: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .search-panel input,
    .search-panel button {
        background-color: rgba(31, 41, 55, 0.7);
        color: white;
        border-color: rgb(55, 65, 81);
    }
}

/* Print Styles */
@media print {
    #searchSuggestions,
    .search-panel,
    .notification-panel,
    #userMenu,
    #mobileMenu {
        display: none !important;
    }
}
