/**
 * Search Page Styles - dubDramas
 * Modern horizontal card layout inspired by streaming platforms
 */

:root {
    --search-spacing: 20px;
    --card-height: 140px;
    --card-image-width: 240px;
}

.search-page-body {
    background: linear-gradient(to bottom, #000000 0%, #0a0a0a 100%);
    min-height: 100vh;
    padding-top: 70px;
    padding-bottom: 80px;
}

/* ========================================
   SEARCH MAIN CONTAINER
======================================== */
.search-main {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--search-spacing);
    display: flex;
    flex-direction: column;
}

.search-container {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* ========================================
   SEARCH INPUT
======================================== */
.search-header-fixed {
    position: sticky;
    top: 70px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(20px);
    padding: 20px;
    margin: -20px -20px 20px -20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    width: calc(100% + 40px);
    display: flex;
    flex-direction: column;
}

.search-input-wrapper {
    margin-bottom: 16px;
    width: 100%;
}

.search-input-box {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0 16px;
    transition: all 0.3s ease;
    width: 100%;
}

.search-input-box:focus-within {
    border-color: var(--primary-red);
    background: rgba(220, 38, 38, 0.05);
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.1);
}

.search-icon {
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-right: 12px;
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    padding: 16px 0;
    font-family: 'Inter', sans-serif;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.search-clear {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.search-clear:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ========================================
   FILTER CONTROLS
======================================== */
.search-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    width: 100%;
}

.type-filters {
    display: flex;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.type-filter-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 24px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}

.type-filter-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.type-filter-btn.active {
    background: var(--primary-red);
    border-color: var(--primary-red);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

/* ========================================
   GENRE SELECTOR
======================================== */
.genre-selector {
    position: relative;
}

.genre-selector-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    white-space: nowrap;
}

.genre-selector-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.genre-selector-btn.active {
    border-color: var(--primary-red);
    background: rgba(220, 38, 38, 0.1);
}

.genre-arrow {
    transition: transform 0.3s ease;
}

.genre-selector-btn.active .genre-arrow {
    transform: rotate(180deg);
}

/* Genre Dropdown */
.genre-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 320px;
    max-height: 500px;
    background: rgba(15, 15, 15, 0.98);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(220, 38, 38, 0.3);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 200;
    overflow: hidden;
    animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.genre-dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 2px solid rgba(220, 38, 38, 0.2);
    background: rgba(220, 38, 38, 0.05);
}

.genre-dropdown-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 700;
}

.genre-close-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
}

.genre-close-btn:hover {
    background: rgba(220, 38, 38, 0.2);
    border-color: var(--primary-red);
    color: var(--primary-red);
}

.genre-list {
    max-height: 420px;
    overflow-y: auto;
    padding: 12px 8px;
    background: rgba(0, 0, 0, 0.3);
}

.genre-list::-webkit-scrollbar {
    width: 8px;
}

.genre-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    margin: 4px 0;
}

.genre-list::-webkit-scrollbar-thumb {
    background: rgba(220, 38, 38, 0.6);
    border-radius: 4px;
    border: 2px solid rgba(0, 0, 0, 0.3);
}

.genre-list::-webkit-scrollbar-thumb:hover {
    background: rgba(220, 38, 38, 0.8);
}

.genre-item {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    width: 100%;
    text-align: left;
    font-family: 'Inter', sans-serif;
    margin-bottom: 6px;
}

.genre-item:last-child {
    margin-bottom: 0;
}

.genre-item:hover {
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.3);
    color: var(--text-primary);
    transform: translateX(4px);
}

.genre-item.active {
    background: rgba(220, 38, 38, 0.25);
    border-color: var(--primary-red);
    color: var(--primary-red);
    font-weight: 600;
    box-shadow: 0 0 12px rgba(220, 38, 38, 0.2);
}

/* ========================================
   RESULTS INFO
======================================== */
.results-info {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 0 0 0;
}

.results-info #results-count {
    color: var(--primary-red);
    font-weight: 700;
}

/* ========================================
   LOADING STATE
======================================== */
.search-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 16px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.search-loading p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* ========================================
   EMPTY & NO RESULTS STATES
======================================== */
.search-empty,
.search-no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 20px;
    gap: 16px;
}

.search-empty svg,
.search-no-results svg {
    color: var(--text-secondary);
    opacity: 0.5;
    margin-bottom: 8px;
}

.search-empty h3,
.search-no-results h3 {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.search-empty p,
.search-no-results p {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 400px;
    line-height: 1.5;
    margin: 0;
}

/* ========================================
   RESULTS GRID - HORIZONTAL CARDS
======================================== */
.search-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    margin-top: 0;
    clear: both;
}

.search-result-card {
    display: flex;
    flex-direction: row;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    text-decoration: none;
    height: var(--card-height);
    width: 100%;
}

.search-result-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--primary-red);
    transform: translateX(8px);
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.3);
}

.search-result-card:active {
    transform: translateX(4px) scale(0.99);
}

/* Card Image */
.search-card-image {
    width: var(--card-image-width);
    height: 100%;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.search-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.search-result-card:hover .search-card-image img {
    transform: scale(1.05);
}

.search-card-type-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.search-card-type-badge.movie {
    background: rgba(220, 38, 38, 0.9);
}

.search-card-type-badge.tv {
    background: rgba(59, 130, 246, 0.9);
}

/* Card Content */
.search-card-content {
    flex: 1;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    overflow: hidden;
}

.search-card-title {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-card-year {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.search-card-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #fbbf24;
    font-size: 14px;
    font-weight: 600;
}

.search-card-rating svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.search-card-genres {
    color: var(--text-secondary);
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-card-synopsis {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 4px;
}

/* ========================================
   RESPONSIVE - MOBILE
======================================== */
@media (max-width: 768px) {
    :root {
        --card-height: 120px;
        --card-image-width: 180px;
        --search-spacing: 16px;
    }

    .search-page-body {
        padding-top: 60px;
    }

    .search-header-fixed {
        top: 60px;
        padding: 16px;
        margin: -16px -16px 16px -16px;
    }

    .search-controls {
        flex-direction: column;
    }

    .type-filters {
        width: 100%;
        justify-content: space-between;
    }

    .type-filter-btn {
        flex: 1;
        padding: 10px 16px;
        font-size: 13px;
    }

    .genre-selector-btn {
        width: 100%;
        justify-content: center;
    }

    .genre-dropdown {
        left: 0;
        right: 0;
        width: auto;
    }

    .search-card-title {
        font-size: 16px;
    }

    .search-card-content {
        padding: 12px 16px;
        gap: 6px;
    }

    .search-card-year,
    .search-card-rating {
        font-size: 13px;
    }

    .search-card-genres {
        font-size: 12px;
    }

    .search-card-synopsis {
        display: none;
    }
}

@media (max-width: 480px) {
    :root {
        --card-height: 100px;
        --card-image-width: 140px;
    }

    .search-card-title {
        font-size: 15px;
        -webkit-line-clamp: 1;
    }

    .search-card-content {
        padding: 10px 12px;
    }

    .search-card-meta {
        gap: 8px;
    }
}

/* ========================================
   ANIMATIONS
======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-result-card {
    animation: fadeIn 0.4s ease-out;
}

.search-result-card:nth-child(1) { animation-delay: 0.05s; }
.search-result-card:nth-child(2) { animation-delay: 0.1s; }
.search-result-card:nth-child(3) { animation-delay: 0.15s; }
.search-result-card:nth-child(4) { animation-delay: 0.2s; }
.search-result-card:nth-child(5) { animation-delay: 0.25s; }
