/**
 * Advanced Search Styles - Optimized Version
 * Mobile-first responsive design with clean desktop layouts
 */

/* ===== BASE STYLES ===== */
.search-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
}

#advanced-search-container {
    width: 100%;
}

/* ===== SEARCH FORM ===== */
.search-form {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 12px;
}


/* Clean, subtle search input for desktop */
#search-input {
    width: 100%;
    max-width: 900px;
    padding: 14px 24px;
    font-size: 16px;
    background: rgba(255,255,255,0.02); /* slightly translucent to match dark theme */
    color: #fff;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    outline: none;
    transition: box-shadow 0.25s ease, border-color 0.25s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
}

/* Focus state: soft glow, no double red outline or jump */
#search-input:focus {
    border-color: rgba(255, 71, 87, 0.35);
    box-shadow: 0 0 0 3px rgba(255, 71, 87, 0.15), 0 10px 30px rgba(255,71,87,0.06);
    transform: none;
}

#search-input::placeholder {
    color: #888;
    font-style: italic;
}

/* ===== SEARCH INFO ===== */
.search-info-compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* When no-results is inside search-info */
#search-info .no-results {
    margin-top: 20px;
    margin-bottom: 20px;
}

.search-query {
    color: #ff4757;
    font-size: 16px;
    font-weight: 600;
}

.search-count {
    color: #aaa;
    font-size: 13px;
}

.cache-indicator {
    background: #4CAF50;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 500;
}

/* ===== VIDEO GRID - MOBILE FIRST ===== */
/* ===== SEARCH RESULTS GRID - Homepage Style ===== */
#search-results.video-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 2rem;
}

/* ===== VIDEO CARDS - Homepage Style ===== */
.video-card {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
    padding: 0;
    margin: 0;
    transition: none;
}

.video-card:hover {
    transform: none;
    box-shadow: none;
}

.video-card .thumb-wrapper {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 4px;
    background: #000;
    margin-bottom: 4px;
}

.video-card .thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
    transition: transform 0.2s ease;
}

.video-card:hover .thumb-wrapper img {
    transform: scale(1.05);
}

.video-card .video-info {
    padding: 0;
}

.video-card .video-title {
    margin: 4px 0 0 0 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    color: #f1f1f1 !important;
    display: -webkit-box !important;
    overflow: hidden !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    white-space: normal !important;
    text-overflow: unset !important;
}

.video-card .video-title a {
    color: #f1f1f1 !important;
    text-decoration: none;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-card .video-title a:hover {
    color: var(--accent-color, #ff4757) !important;
}

.video-card .video-title a:hover {
    color: var(--accent-color, #ff4757);
}

/* ===== STATES ===== */
.loading {
    text-align: center;
    padding: 40px 20px;
    color: #aaa;
    font-size: 15px;
    background: #1a1a1a;
    border-radius: 8px;
    border: 2px dashed #444;
}

.search-error {
    text-align: center;
    padding: 20px;
    color: #ff4757;
    background: #2d1b1b;
    border: 1px solid #ff4757;
    border-radius: 8px;
    margin: 16px 0;
}

.no-results {
    text-align: center;
    padding: 30px 20px;
    color: #aaa;
    background: #2d2d2d;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid #404040;
}

.no-results h2 {
    color: #fff;
    font-size: 1.5rem;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.no-results p {
    color: #aaa;
    font-size: 1rem;
    margin: 0;
    line-height: 1.5;
}

/* ===== PAGINATION ===== */
#search-pagination {
    text-align: center;
    margin: 32px 0 20px 0;
}

.search-pagination {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.search-pagination a,
.search-pagination span {
    display: inline-block;
    padding: 6px 10px;
    background: #2d2d2d;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid #444;
    transition: all 0.3s ease;
    font-size: 13px;
}

.search-pagination a:hover {
    background: #ff4757;
    border-color: #ff4757;
}

.search-pagination .current-page {
    background: #ff4757;
    border-color: #ff4757;
    font-weight: bold;
}

/* ===== SUGGESTIONS ===== */
#search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #2d2d2d;
    border: 1px solid #444;
    border-radius: 0 0 8px 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    transition: background-color 0.2s ease;
    font-size: 14px;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: #404040;
}

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

/* ===== RESPONSIVE BREAKPOINTS ===== */
@media (min-width: 481px) {
    #search-results.video-grid {
        gap: 10px;
    }
    
    .video-card .thumb-wrapper {
        margin-bottom: 5px;
    }
}

@media (min-width: 768px) {
    .search-container {
        padding: 32px 24px;
    }
    
    #search-results.video-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .video-card .thumb-wrapper {
        border-radius: 6px;
        margin-bottom: 6px;
    }
    
    .video-card .video-title {
        margin: 6px 0 0 0 !important;
        font-size: 13px !important;
        line-height: 1.2 !important;
    }
    
    .search-form {
        margin-bottom: 3rem;
        max-width: 900px;
    }
    
    #search-input {
        max-width: 700px;
        padding: 18px 28px;
        font-size: 17px;
        border-radius: 15px;
    }
    
    .search-info-compact {
        margin-bottom: 2rem;
    }
    
    .search-query {
        font-size: 18px;
    }
    
    .search-count {
        font-size: 14px;
    }
}

@media (min-width: 1200px) {
    .search-container {
        max-width: 1320px;
        padding: 40px 32px;
    }
    
    .search-form {
        margin-bottom: 4rem;
        max-width: 1000px;
    }
    
    #search-input {
        max-width: 800px;
        padding: 20px 32px;
        font-size: 18px;
        border-radius: 16px;
    }
    
    #search-results.video-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
        margin-bottom: 3rem;
    }
    
    .video-card .thumb-wrapper {
        border-radius: 8px;
        margin-bottom: 8px;
    }
    
    .video-card .video-title {
        margin: 8px 0 0 0 !important;
        font-size: 14px !important;
        line-height: 1.3 !important;
    }
    
    .search-pagination a,
    .search-pagination span {
        padding: 8px 12px;
        font-size: 14px;
    }
}

@media (min-width: 1400px) {
    .search-container {
        max-width: 1400px;
        padding: 48px 40px;
    }
    
    .search-form {
        margin-bottom: 4.5rem;
        max-width: 1100px;
    }
    
    #search-input {
        max-width: 900px;
        padding: 22px 36px;
        font-size: 19px;
        border-radius: 18px;
    }
    
    #search-results.video-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    .video-card,
    .video-card .thumb-wrapper img {
        transition: none;
    }
    
    .video-card:hover {
        transform: none;
    }
}

#search-input:focus {
    /* keep input accessible but avoid the heavy red outline used elsewhere */
    outline: none;
}

.video-card:focus,
.search-pagination a:focus {
    outline: 2px solid #ff4757;
    outline-offset: 2px;
}

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

.video-card {
    animation: fadeIn 0.3s ease-out;
}

/* ===== PRINT STYLES ===== */
@media print {
    .search-container {
        max-width: none;
        padding: 0;
    }
    
    #search-results.video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .video-card:hover {
        transform: none;
        box-shadow: none;
    }
}