/**
 * Search & Discovery Styles
 * Beautiful, modern search interface for Poetry Translated
 */

/* Container */
.search-container {
    min-height: 100vh;
    padding-top: 80px;
    background: var(--ink-black);
}

/* Hero Search Section */
.search-hero {
    text-align: center;
    padding: 60px 20px 40px;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.08) 0%, transparent 100%);
}

.search-title {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 40px;
}

.search-title .arabic {
    font-family: 'HSN Naskh', serif;
    font-size: 3rem;
    color: var(--emerald-glow);
    text-shadow: 0 0 40px rgba(16, 185, 129, 0.4);
    animation: glow 3s ease-in-out infinite;
}

.search-title .english {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--paper-white);
    opacity: 0.85;
    letter-spacing: 1px;
}

/* Search Bar */
.search-bar-container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.search-bar {
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(16, 185, 129, 0.25);
    border-radius: 60px;
    display: flex;
    align-items: center;
    padding: 6px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.search-bar:focus-within {
    border-color: var(--emerald-glow);
    background: rgba(255, 255, 255, 0.09);
    box-shadow: 0 0 50px rgba(16, 185, 129, 0.25);
    transform: translateY(-2px);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--paper-white);
    font-size: 1.1rem;
    padding: 16px 28px;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.search-input::placeholder {
    color: rgba(250, 250, 250, 0.35);
}

.search-btn {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--emerald-glow);
    border: none;
    color: var(--ink-black);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
}

.search-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.6);
}

.search-btn:active {
    transform: scale(0.95);
}

/* Search Type Toggle */
.search-type-toggle {
    display: flex;
    gap: 6px;
    margin-right: 12px;
    padding: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50px;
}

.type-btn {
    padding: 10px 18px;
    background: transparent;
    border: 1px solid transparent;
    color: rgba(250, 250, 250, 0.6);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.25s;
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
}

.type-btn:hover {
    color: var(--emerald-glow);
    background: rgba(16, 185, 129, 0.08);
}

.type-btn.active {
    background: var(--emerald-glow);
    border-color: var(--emerald-glow);
    color: var(--ink-black);
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

/* Search Suggestions */
.search-suggestions {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    background: rgba(10, 10, 10, 0.98);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.8);
    z-index: 1000;
    backdrop-filter: blur(10px);
    animation: slideDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.suggestion-item {
    padding: 16px 24px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.suggestion-item:hover {
    background: rgba(16, 185, 129, 0.12);
    padding-left: 32px;
}

.suggestion-text {
    color: var(--paper-white);
    font-size: 1rem;
}

.suggestion-type {
    font-size: 0.8rem;
    color: rgba(16, 185, 129, 0.7);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    padding: 4px 10px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 12px;
}

/* Quick Filters */
.quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 30px;
    padding: 0 20px;
}

.filter-chip {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--paper-white);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    font-weight: 500;
}

.filter-chip:hover {
    border-color: rgba(16, 185, 129, 0.5);
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.15);
}

.filter-chip.active {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--emerald-glow);
    color: var(--emerald-glow);
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.3);
}

/* Advanced Filters */
.advanced-filters {
    max-width: 900px;
    margin: 25px auto;
    padding: 32px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    backdrop-filter: blur(10px);
}

.filter-section h3 {
    font-size: 0.9rem;
    color: var(--emerald-glow);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    font-weight: 600;
}

.filter-section select {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--paper-white);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.filter-section select:hover {
    border-color: rgba(16, 185, 129, 0.4);
}

.filter-section select:focus {
    outline: none;
    border-color: var(--emerald-glow);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.apply-filters-btn,
.clear-filters-btn {
    padding: 12px 28px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.3s;
    grid-column: span 1;
}

.apply-filters-btn {
    background: var(--emerald-glow);
    border: none;
    color: var(--ink-black);
}

.apply-filters-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.clear-filters-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--paper-white);
}

.clear-filters-btn:hover {
    border-color: rgba(255, 100, 100, 0.5);
    color: #ff6464;
}

.toggle-advanced-btn {
    display: block;
    margin: 0 auto 40px;
    padding: 12px 32px;
    background: transparent;
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--emerald-glow);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.toggle-advanced-btn:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--emerald-glow);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.2);
}

/* Search Results */
.search-results {
    padding: 0 20px 80px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Discovery Content */
.discovery-content section {
    margin-bottom: 70px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
    font-size: 1.6rem;
    color: var(--paper-white);
    font-weight: 600;
}

.section-title .icon {
    font-size: 2rem;
}

/* Trending Grid */
.trending-grid {
    display: grid;
    gap: 16px;
    max-width: 700px;
}

.trending-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.trending-item:hover {
    background: rgba(16, 185, 129, 0.08);
    border-color: rgba(16, 185, 129, 0.3);
    transform: translateX(8px);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.15);
}

.trending-rank {
    font-size: 1.6rem;
    font-weight: bold;
    color: var(--emerald-glow);
    min-width: 45px;
    text-align: center;
    font-family: 'Inter', monospace;
}

.trending-info {
    flex: 1;
}

.trending-info h4 {
    color: var(--paper-white);
    margin-bottom: 6px;
    font-size: 1.05rem;
}

.trending-info p {
    color: rgba(250, 250, 250, 0.6);
    font-size: 0.9rem;
}

.trending-stats {
    color: rgba(16, 185, 129, 0.8);
    font-size: 0.85rem;
    font-weight: 500;
}

.play-trending-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--emerald-glow);
    color: var(--emerald-glow);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 1.1rem;
}

.play-trending-btn:hover {
    background: var(--emerald-glow);
    color: var(--ink-black);
    transform: scale(1.1);
}

/* Mood Cards */
.mood-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 24px;
}

.mood-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    padding: 34px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mood-card:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.4);
    transform: translateY(-8px);
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.2);
}

.mood-icon {
    font-size: 3.2rem;
    margin-bottom: 18px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.mood-card h3 {
    color: var(--paper-white);
    font-size: 1.05rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.mood-card p {
    color: rgba(250, 250, 250, 0.5);
    font-size: 0.95rem;
}

/* Poets Grid */
.poets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

.poet-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.poet-card:hover {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.4);
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.2);
}

.poet-avatar {
    width: 90px;
    height: 90px;
    margin: 0 auto 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.25), rgba(16, 185, 129, 0.08));
    border: 2px solid rgba(16, 185, 129, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.15);
}

.poet-initial {
    font-family: 'HSN Naskh', serif;
    font-size: 2.2rem;
    color: var(--emerald-glow);
}

.poet-name {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    color: var(--paper-white);
    font-size: 1rem;
}

.poet-era,
.poet-poems {
    color: rgba(250, 250, 250, 0.6);
    font-size: 0.88rem;
}

/* Results Grid */
.results-grid {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 35px;
}

.results-title {
    font-size: 1.3rem;
    color: var(--paper-white);
    font-weight: 600;
}

.results-title #searchTerm {
    color: var(--emerald-glow);
}

.results-actions {
    display: flex;
    gap: 10px;
}

.view-toggle {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: rgba(250, 250, 250, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.view-toggle:hover {
    border-color: var(--emerald-glow);
    color: var(--emerald-glow);
}

.view-toggle.active {
    background: rgba(16, 185, 129, 0.15);
    border-color: var(--emerald-glow);
    color: var(--emerald-glow);
}

.results-items.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 28px;
}

.results-items.list-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Result Items */
.result-item {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.result-item:hover {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.2);
    transform: translateY(-6px);
}

.result-cover {
    position: relative;
    aspect-ratio: 1;
    background: linear-gradient(135deg, #0A0A0A, #1a1a1a);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.result-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}

.result-item:hover .result-cover img {
    transform: scale(1.05);
}

.default-cover {
    font-family: 'HSN Naskh', serif;
    font-size: 1.6rem;
    color: rgba(250, 250, 250, 0.25);
    text-align: center;
    padding: 24px;
    line-height: 1.6;
}

.play-result-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.95);
    border: none;
    color: white;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.result-item:hover .play-result-btn {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.result-info {
    padding: 22px;
}

.result-title {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    font-size: 1.05rem;
    color: var(--paper-white);
    line-height: 1.4;
}

.result-poet {
    color: rgba(250, 250, 250, 0.7);
    font-size: 0.92rem;
    margin-bottom: 16px;
}

.result-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.era-badge {
    padding: 5px 14px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--emerald-glow);
    border-radius: 16px;
    font-size: 0.82rem;
    font-weight: 500;
}

.plays {
    color: rgba(250, 250, 250, 0.5);
    font-size: 0.82rem;
}

/* Verse Results */
.verse-result {
    padding: 24px;
}

.verse-content {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.verse-arabic {
    font-family: 'HSN Naskh', serif;
    font-size: 1.4rem;
    line-height: 2.2;
    color: var(--paper-white);
    margin-bottom: 12px;
    text-shadow: 0 0 15px rgba(250, 250, 250, 0.15);
}

.verse-english {
    color: rgba(250, 250, 250, 0.8);
    line-height: 1.7;
    font-size: 1rem;
}

.verse-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.poem-link,
.poet-link {
    color: rgba(16, 185, 129, 0.8);
    font-size: 0.9rem;
}

.play-verse-btn {
    padding: 8px 18px;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--emerald-glow);
    color: var(--emerald-glow);
    border-radius: 22px;
    cursor: pointer;
    font-size: 0.88rem;
    transition: all 0.3s;
    font-weight: 500;
}

.play-verse-btn:hover {
    background: var(--emerald-glow);
    color: var(--ink-black);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* Load More Button */
.load-more-btn {
    display: block;
    margin: 50px auto;
    padding: 16px 42px;
    background: rgba(16, 185, 129, 0.12);
    border: 2px solid var(--emerald-glow);
    color: var(--emerald-glow);
    border-radius: 35px;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
}

.load-more-btn:hover {
    background: var(--emerald-glow);
    color: var(--ink-black);
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.4);
}

/* No Results */
.no-results {
    text-align: center;
    padding: 70px 20px;
    color: rgba(250, 250, 250, 0.6);
}

.no-results h3 {
    font-size: 1.6rem;
    color: var(--paper-white);
    margin-bottom: 12px;
}

.no-results p {
    font-size: 1.1rem;
    margin-bottom: 24px;
}

.suggestions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

.suggestion-link {
    padding: 10px 24px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid var(--emerald-glow);
    color: var(--emerald-glow);
    border-radius: 24px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.suggestion-link:hover {
    background: var(--emerald-glow);
    color: var(--ink-black);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.3);
}

/* Loading State */
.search-results.loading::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 55px;
    height: 55px;
    border: 4px solid rgba(16, 185, 129, 0.2);
    border-top-color: var(--emerald-glow);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1000;
}

.loading-spinner {
    width: 45px;
    height: 45px;
    border: 3px solid rgba(16, 185, 129, 0.2);
    border-top-color: var(--emerald-glow);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 30px auto;
}

/* Error Message */
.error-message {
    text-align: center;
    padding: 50px 20px;
    color: #ff6464;
    font-size: 1.1rem;
}

/* Recommendations Section */
.recommendations-section {
    margin-top: 50px;
}

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
}

.recommendation-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.3s;
}

.recommendation-card:hover {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.2);
    transform: translateY(-5px);
}

.rec-cover {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #0A0A0A, #1a1a1a);
    display: flex;
    align-items: center;
    justify-content: center;
}

.rec-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rec-info {
    padding: 18px;
}

.rec-info h4 {
    color: var(--paper-white);
    margin-bottom: 8px;
    font-size: 1rem;
}

.rec-info p {
    color: rgba(250, 250, 250, 0.6);
    font-size: 0.88rem;
    margin-bottom: 14px;
}

.play-rec-btn {
    width: 100%;
    padding: 10px;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--emerald-glow);
    color: var(--emerald-glow);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.play-rec-btn:hover {
    background: var(--emerald-glow);
    color: var(--ink-black);
}

/* Animations */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes glow {
    0%, 100% {
        text-shadow: 0 0 40px rgba(16, 185, 129, 0.4);
    }
    50% {
        text-shadow: 0 0 60px rgba(16, 185, 129, 0.6);
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .search-title .arabic {
        font-size: 2.2rem;
    }

    .search-title .english {
        font-size: 1.2rem;
    }

    .search-bar {
        flex-wrap: wrap;
    }

    .search-type-toggle {
        display: none;
    }

    .search-input {
        font-size: 1rem;
        padding: 14px 20px;
    }

    .mood-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .results-items.grid-view {
        grid-template-columns: 1fr;
    }

    .trending-item {
        flex-wrap: wrap;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .advanced-filters {
        grid-template-columns: 1fr;
    }

    .filter-section {
        grid-column: span 1 !important;
    }
}

@media (max-width: 480px) {
    .search-hero {
        padding: 40px 15px 30px;
    }

    .quick-filters {
        gap: 8px;
    }

    .filter-chip {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .mood-cards {
        grid-template-columns: 1fr;
    }
}
