/* Search Interface Styles */

.search-bar {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-input-container {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 0;
    transition: all 0.2s ease;
}

.search-input-container:focus-within {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.search-category-selector {
    position: relative;
    border-right: 1px solid rgba(255, 255, 255, 0.2);
    margin-right: 8px;
}

.search-category-dropdown {
    background: transparent;
    border: none;
    outline: none;
    padding: 12px 8px 12px 12px;
    font-size: 14px;
    color: #fff;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 4px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 28px;
}

.search-category-dropdown option {
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 12px 16px;
    font-size: 16px;
    color: #fff;
    font-family: inherit;
    min-width: 0;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-button,
.search-clear,
.search-toggle-results {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin: 0 4px;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
}

.search-button:hover,
.search-clear:hover,
.search-toggle-results:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.search-toggle-results {
    color: rgba(255, 255, 255, 0.7);
    padding: 12px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 4px;
}

.search-toggle-results.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.search-toggle-results .toggle-icon {
    width: 16px;
    height: 16px;
}

.search-icon {
    width: 18px;
    height: 18px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.search-results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Default: 2 columns for mobile */
    gap: 16px;
    padding: 16px;
    /* No max-height, no overflow - let it expand naturally */
    /* Main page will scroll instead of this container */
}

/* Match main grid: 10 columns on large screens */
@media (min-width: 1920px) {
    .search-results-grid {
        grid-template-columns: repeat(10, 1fr);
    }
}

/* Match main grid: 5 columns on medium screens */
@media (min-width: 1200px) and (max-width: 1919px) {
    .search-results-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Match main grid: 2 columns on smaller screens */
@media (max-width: 1199px) {
    .search-results-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Scrollbar styles removed - grid expands naturally, page scrolls instead */


.search-result-overview {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
    display: -webkit-box;

    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .search-bar {
        max-width: 100%;
    }

    .search-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

}

/* Search Result Cards */
.search-result-card {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    aspect-ratio: 2/3;
    box-shadow: var(--shadow);
    transform: translateZ(0);
    width: 100%;
    will-change: transform;
    /* Prevent hover flicker during scroll */
    pointer-events: auto;
}

.search-result-card:hover {
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.search-result-card:active {
    transform: scale(0.98) translateZ(0);
}

.search-result-type-indicator {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10;
}

/* Persistent Search Results Container */
.search-results-container {
    position: relative;
    width: 100%;
    max-width: 100vw;
    margin: 20px 0;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: visible;
    transition: all 0.3s ease;
    max-height: none;
    height: auto;
}

.search-results-container.hidden {
    display: none;
}

.search-empty-state {
    padding: 40px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.search-results-status {
    display: none;
    padding: 24px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 15px;
    gap: 12px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.search-results-status.active {
    display: flex;
}

.search-results-status .status-spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.9);
    animation: spin 1s linear infinite;
}

.search-results-status .status-message {
    margin: 0;
    line-height: 1.4;
}

.search-results-status .status-submessage {
    margin: 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.search-results-title {
    margin: 0;
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
}

.search-results-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-results-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.search-results-close svg {
    width: 20px;
    height: 20px;
}

/* Duplicate grid definition removed - see above for main .search-results-grid styles */

.search-result-card {
    width: 100%;
}

/* Ensure movie-card styles apply in search results */
.search-results-grid .movie-card {
    width: 100%;
    margin: 0;
    min-height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .search-results-grid {
        gap: 12px;
        padding: 12px;
        /* No max-height - grid expands naturally on mobile too */
        /* Grid columns already defined above to match main grid (2 columns) */
    }

    .search-results-header {
        padding: 12px 16px;
    }

    .search-results-title {
        font-size: 1rem;
    }
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
    .search-input-container {
        background: rgba(0, 0, 0, 0.3);
        border-color: rgba(255, 255, 255, 0.15);
    }

    .search-input-container:focus-within {
        background: rgba(0, 0, 0, 0.4);
        border-color: rgba(255, 255, 255, 0.3);
    }
}