/**
 * Inn_HeaderSearch - Header Search Overlay Styling
 * Integrates with the Andalui design system
 */

/* Header Search Trigger (Icon next to cart) */
.header-search-wrapper {
    display: inline-flex;
    align-items: center;
    margin-right: 15px;
}

.header-search-trigger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #0D1307; /* @neutral_color */
    transition: all 0.3s ease;
    font-size: 28px;
    line-height: 1;
    
    &:hover {
        color: #333;
        transform: scale(1.1);
    }
    
    &:focus {
        outline: 2px solid rgba(13, 19, 7, 0.3);
        outline-offset: 2px;
    }
}

/* Search Overlay */
.header-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    
    &.active {
        opacity: 1;
        visibility: visible;
    }
}

.search-overlay-content {
    position: relative;
    background: #F8F7F4; /* @light_grey */
    margin: 0;
    padding: 0;
    min-height: 200px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.search-overlay-header {
    display: flex;
    align-items: center;
    padding: 30px 40px;
    border-bottom: 2px solid #ddd;
    background: #F8F7F4; /* @light_grey */
}

.search-form-wrapper {
    flex: 1;
    max-width: 600px;
    margin: 0 auto;
}

.search-overlay-header .form.minisearch {
    margin: 0;
}

.search-overlay-header .field.search {
    position: relative;
    margin: 0;
}

.search-overlay-header .field.search .control {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid #ddd;
    border-radius: 0;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.search-overlay-header .field.search .control:focus-within {
    border-color: #0D1307; /* @neutral_color */
}

.search-overlay-header #header-search-input {
    flex: 1;
    border: none;
    padding: 15px 20px;
    font-size: 18px;
    font-family: 'Onest', sans-serif; /* @mainfont */
    color: #0D1307; /* @neutral_color */
    background: transparent;
    outline: none;
}

.search-overlay-header #header-search-input::placeholder {
    color: #999;
    font-style: italic;
}

.search-overlay-header .action.search {
    background: #0D1307; /* @neutral_color */
    border: none;
    padding: 15px 20px;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 18px;
    
    &:hover {
        background: #333;
    }
}

.search-overlay-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #0D1307; /* @neutral_color */
    cursor: pointer;
    padding: 10px;
    margin-left: 20px;
    transition: all 0.3s ease;
    
    &:hover {
        color: #e02b27;
        transform: rotate(90deg);
    }
}

/* Search Suggestions */
.search-suggestions-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: white;
    
    &.active {
        max-height: 400px;
        border-bottom: 2px solid #ddd;
    }
}

.search-suggestions {
    padding: 20px 40px;
    max-height: 400px;
    overflow-y: auto;
}

.search-suggestion-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: all 0.3s ease;
    
    &:hover {
        background: #f9f9f9;
        padding-left: 10px;
    }
    
    &:last-child {
        border-bottom: none;
    }
}

.suggestion-image {
    width: 60px;
    height: 60px;
    margin-right: 15px;
    flex-shrink: 0;
    overflow: hidden;
    border: 1px solid #ddd;
    
    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
}

.suggestion-content {
    flex: 1;
}

.suggestion-title {
    font-family: 'Onest', sans-serif; /* @mainfont */
    font-size: 16px;
    font-weight: 600;
    color: #0D1307; /* @neutral_color */
    margin-bottom: 4px;
    
    mark {
        background: #ffeb3b;
        padding: 0 2px;
        font-weight: 700;
    }
}

.suggestion-price {
    font-family: 'Special Elite', cursive; /* @headfont */
    font-size: 14px;
    color: #666;
}

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

.no-suggestions {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

/* Body class when overlay is open */
body.search-overlay-open {
    overflow: hidden;
}

/* Mobile Responsive */
@media only screen and (max-width: 767px) {
    .header-search-trigger {
        font-size: 24px;
        padding: 6px;
    }
    
    .search-overlay-header {
        padding: 20px 20px;
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-form-wrapper {
        margin-bottom: 15px;
    }
    
    .search-overlay-close {
        align-self: center;
        margin-left: 0;
        font-size: 28px;
    }
    
    .search-overlay-header #header-search-input {
        padding: 12px 15px;
        font-size: 16px;
    }
    
    .search-overlay-header .action.search {
        padding: 12px 15px;
        font-size: 16px;
    }
    
    .search-suggestions {
        padding: 15px 20px;
    }
    
    .search-suggestion-item {
        padding: 10px 0;
    }
    
    .suggestion-image {
        width: 50px;
        height: 50px;
        margin-right: 12px;
    }
    
    .suggestion-title {
        font-size: 14px;
    }
    
    .suggestion-price {
        font-size: 12px;
    }
}

/* Tablet */
@media only screen and (min-width: 768px) and (max-width: 1024px) {
    .search-overlay-header {
        padding: 25px 30px;
    }
    
    .search-suggestions {
        padding: 15px 30px;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .header-search-trigger {
        border: 2px solid #0D1307;
        background: white;
    }
    
    .search-overlay-content {
        border: 3px solid #000;
    }
    
    .search-overlay-header .field.search .control {
        border-color: #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .header-search-trigger,
    .header-search-overlay,
    .search-suggestions-wrapper,
    .search-suggestion-item {
        transition: none;
    }
    
    .header-search-trigger:hover {
        transform: none;
    }
    
    .search-overlay-close:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .header-search-wrapper,
    .header-search-overlay {
        display: none;
    }
}
