/* Live Search Styles */
.live-search-container {
    max-width: 500px;
    margin: 0 auto;
}

.live-search-wrapper {
    position: relative;
    width: 100%;
}

.live-search-input {
    width: 100%;
    padding: 12px 88px 12px 15px;
    font-size: 16px;
    border: 5px solid #e0e0e0; /* Changed from 2px solid #ddd to lighter */
    border-radius: 25px;
    outline: none;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.live-search-input:focus {
    border-color: #b8b8b8; /* Lighter focus color */
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05); /* Lighter shadow */
}

.live-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
}

.live-search-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

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

.live-search-item:hover,
.live-search-item.selected {
    background-color: #f8f9fa;
}

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

.live-search-thumbnail {
    flex-shrink: 0;
    margin-right: 12px;
}

.live-search-thumbnail img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #eee;
}

.live-search-content {
    flex-grow: 1;
    min-width: 0;
}

.live-search-title {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-search-excerpt {
    margin: 0;
    font-size: 12px;
    color: #666;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.live-search-loading {
    padding: 15px;
    text-align: center;
    color: #666;
    font-size: 14px;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: #fff;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1001;
}

.live-search-no-results,
.live-search-error {
    padding: 15px;
    text-align: center;
    color: #666;
    font-size: 14px;
    font-style: italic;
}

.live-search-error {
    color: #d32f2f;
}

/* Hide the browser's own clear (x) so it can't overlap our buttons */
.live-search-input::-webkit-search-cancel-button,
.live-search-input::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}
.live-search-input::-ms-clear { display: none; }

/* Clear (x) button sits left of the search button */
.live-search-clear {
    position: absolute;
    top: 50%;
    right: 48px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: #888;
    cursor: pointer;
}
.live-search-clear.is-visible { display: flex; }
.live-search-clear:hover,
.live-search-clear:focus { background: rgba(0, 0, 0, 0.06); color: #222; outline: none; }

/* Search box at the top of the search results page */
.live-search-page-box { grid-column: 1 / -1; margin: 0 0 20px; }

/* Search button + view-all link */
.live-search-form { margin: 0; }

.live-search-submit {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
}

.live-search-submit:hover,
.live-search-submit:focus {
    background: rgba(0, 0, 0, 0.06);
    color: #222;
    outline: none;
}

.live-search-all {
    display: block;
    padding: 12px 15px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    border-top: 1px solid #f0f0f0;
}

.live-search-all:hover {
    background-color: #f8f9fa;
}

/* Responsive Design */
@media (max-width: 768px) {
    .live-search-container {
        max-width: 100%;
        padding: 0 15px;
    }
    
    .live-search-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .live-search-results {
        max-height: 300px;
    }
    
    .live-search-item {
        padding: 10px 12px;
    }
    
    .live-search-thumbnail img {
        width: 40px;
        height: 40px;
    }
    
    .live-search-title {
        font-size: 13px;
    }
    
    .live-search-excerpt {
        font-size: 11px;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .live-search-submit, .live-search-clear { color: #a0aec0; }
    .live-search-clear:hover, .live-search-clear:focus { background: rgba(255,255,255,0.1); color: #fff; }
    .live-search-submit:hover, .live-search-submit:focus { background: rgba(255,255,255,0.1); color: #fff; }
    .live-search-all { border-top-color: #4a5568; }
    .live-search-all:hover { background-color: #4a5568; }

    .live-search-input {
        background-color: #2d3748;
        color: #fff;
        border-color: #4a5568;
    }
    
    .live-search-input:focus {
        border-color: #63b3ed;
        box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
    }
    
    .live-search-results {
        background-color: #2d3748;
        border-color: #4a5568;
    }
    
    .live-search-item:hover,
    .live-search-item.selected {
        background-color: #4a5568;
    }
    
    .live-search-title {
        color: #fff;
    }
    
    .live-search-excerpt {
        color: #a0aec0;
    }
    
    .live-search-loading {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #a0aec0;
    }
    
    .live-search-no-results {
        color: #a0aec0;
    }
}