/* Search Toggle Button in Navigation */

.search-toggle {
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    position: relative;
    width: 85px;
    height: 85px;
    transition: background var(--transition-fast);
}

.search-toggle:hover {
    background: var(--color-bg-secondary);
}

.search-toggle i {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    text-align: center;
    font-size: 24px;
    color: rgb(255 255 255 / 50%);
    transition: color var(--transition-base);
}

.search-toggle:hover i {
    color: var(--color-text-primary);
}

@media (max-width: 768px) {
    .search-toggle {
        height: 70px;
    }
}

/* Full-Width Search Bar */

.search-bar-wrapper {
    display: none;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
    animation: slide-down 0.3s ease-out;
}

.search-bar-wrapper.active {
    display: block;
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Form Styling */

.search-form {
    display: flex;
    align-items: center;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-input {
    padding: 0.75rem 5.5rem 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 1rem;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgb(var(--accent-rgb) 0.1);
}

.search-clear {
    position: absolute;
    right: 3rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.75rem;
    font-size: 1.2rem;
    transition: color 0.2s, opacity 0.2s;
}

.search-clear:hover {
    color: var(--accent);
}

.search-submit {
    position: absolute;
    right: 0.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.75rem;
    font-size: 1.2rem;
    transition: color 0.2s;
}

.search-submit:hover {
    color: var(--accent);
}

/* Full-width search bar specific styling */

.search-bar-form {
    width: 100%;
}

.search-bar-form .search-input-wrapper {
    width: 100%;
}

.search-bar-form .search-input {
    font-size: 1.3rem;
    padding: 1.25rem 6.5rem 1.25rem 1.5rem;
    width: 100%;
    background: #fff;
    color: #000;
    border: 2px solid var(--border-color);
}

.search-bar-form .search-input:focus {
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgb(var(--accent-rgb) 0.15);
}

.search-bar-form .search-input::placeholder {
    color: #666;
    opacity: 1;
}

/* Dark theme support */
[data-theme="dark"] .search-bar-form .search-input {
    background: #0b1221;
    color: #fff;
    border-color: #1a2942;
}

[data-theme="dark"] .search-bar-form .search-input::placeholder {
    color: #7a8a9e;
}

[data-theme="dark"] .search-bar-form .search-input:focus {
    background: #0b1221;
    border-color: var(--accent);
}

.search-bar-form .search-clear {
    font-size: 1.4rem;
    padding: 1.25rem;
    right: 4rem;
}

.search-bar-form .search-submit {
    font-size: 1.5rem;
    padding: 1.25rem;
    right: 1rem;
}

/* Search Results Page */

.search-header {
    margin-bottom: 2rem;
}

.search-header h1 {
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.search-results-count {
    color: var(--text-secondary);
    font-size: 1rem;
}

.search-results {
    margin-top: 2rem;
}

.no-results {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.no-results i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.no-results p {
    font-size: 1.2rem;
    margin: 0.5rem 0;
}

.no-results .suggestion {
    font-size: 1rem;
    color: var(--text-muted);
}

/* Pagination */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin-top: 3rem;
    padding: 2rem 0;
}

.pagination-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.2s;
}

.pagination-link:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgb(0 0 0 / 20%);
}

.pagination-info {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Product Search Results  */

.search-results .products-grid {
    margin-top: 2rem;
    grid-template-columns: repeat(4, calc((100% - 90px) / 4));
    gap: 30px;
}

@media (max-width: 1200px) {
    .search-results .products-grid {
        grid-template-columns: repeat(3, calc((100% - 60px) / 3));
    }
}

@media (max-width: 1000px) {
    .search-results .products-grid {
        grid-template-columns: repeat(2, calc((100% - 30px) / 2));
    }
}

@media (max-width: 768px) {
    .search-results .products-grid {
        grid-template-columns: repeat(2, calc((100% - 30px) / 2));
    }
}

.product-excerpt {
    font-size: 0.85rem;
    color: #fff;
    margin-top: 0.5rem;
    line-height: 1.4;
}

[data-theme="light"] .product-excerpt {
    color: #333;
}
