@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #ec4899;
    --accent: #8b5cf6;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --glow: rgba(79, 70, 229, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top left, rgba(79, 70, 229, 0.15), transparent 40%),
        radial-gradient(circle at bottom right, rgba(236, 72, 153, 0.1), transparent 40%);
    z-index: -1;
    pointer-events: none;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: all 0.5s ease;
}

body.has-results .container {
    justify-content: flex-start;
    padding-top: 2rem;
}

/* Header / Logo */
header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

body.has-results header {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    text-align: left;
    gap: 1.5rem;
}

.logo-wrapper {
    display: inline-block;
}

.logo {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.1);
}

.logo span {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.has-results .logo {
    font-size: 1.8rem;
    margin-bottom: 0;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 300;
}

body.has-results .subtitle {
    display: none;
}

/* Search Box */
.search-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    transition: all 0.5s ease;
    z-index: 10;
}

body.has-results .search-container {
    margin: 0;
    max-width: 100%;
    flex: 1;
}

.search-input-wrapper {
    position: relative;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.search-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.2), 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    background: rgba(30, 41, 59, 0.9);
    transform: translateY(-2px);
}

#searchInput {
    width: 100%;
    padding: 1rem 5.5rem 1rem 1.5rem;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.1rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
}

#searchInput::placeholder {
    color: var(--text-muted);
}

.mic-icon {
    position: absolute;
    right: 3.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 10px;
    border-radius: 50%;
    z-index: 5;
}

.mic-icon:hover {
    color: var(--secondary);
    background: rgba(236, 72, 153, 0.1);
}

.mic-icon.listening {
    color: #ef4444;
    animation: pulse 1.5s infinite;
    background: rgba(239, 68, 68, 0.1);
}

@keyframes pulse {
    0% {
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: translateY(-50%) scale(1.1);
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {
        transform: translateY(-50%) scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

.search-icon {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    font-size: 1.2rem;
    pointer-events: none;
}

/* Trending Keywords */
.trending-keywords {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
    min-height: 25px;
    /* Prevent layout shift */
}

body.has-results .trending-keywords {
    display: none;
}

.trending-tag {
    background: rgba(79, 70, 229, 0.2);
    border: 1px solid rgba(79, 70, 229, 0.4);
    color: #e0e7ff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.trending-tag i {
    font-size: 0.75rem;
    color: #a5b4fc;
}

.trending-tag:hover {
    background: rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

/* Filters (Visual Only for now) */
.quick-filters {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    transition: opacity 0.3s ease;
}

body.has-results .quick-filters {
    display: none;
}

.filter-chicklet {
    background: rgba(51, 65, 85, 0.5);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-chicklet:hover {
    background: var(--surface-light);
    color: var(--text);
    border-color: var(--primary);
}

/* Results Area */
#searchResults {
    margin-top: 2rem;
    display: grid;
    gap: 1rem;
    width: 100%;
}

.result-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.result-card:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: var(--primary);
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.2s;
}

.result-card:hover::before {
    opacity: 1;
}

.result-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.icon-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.icon-purple {
    background: rgba(168, 85, 247, 0.15);
    color: #c084fc;
}

.icon-green {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.icon-orange {
    background: rgba(249, 115, 22, 0.15);
    color: #fb923c;
}

.icon-teal {
    background: rgba(20, 184, 166, 0.15);
    color: #2dd4bf;
}

.result-content {
    flex: 1;
    min-width: 0;
    /* Text truncation fix */
}

.result-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sponsored-badge {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #0f172a;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sponsored-badge i {
    font-size: 0.6rem;
}

.result-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.result-title a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.result-title a:hover {
    color: var(--primary);
}

.highlight {
    background: rgba(79, 70, 229, 0.3);
    color: #fff;
    padding: 0 2px;
    border-radius: 2px;
}

.result-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.tag {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
}

.result-action {
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.2s;
}

.result-card:hover .result-action {
    opacity: 1;
    transform: translateX(0);
}

.btn-visit {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    text-decoration: none;
    transition: all 0.2s;
}

.btn-visit:hover {
    background: var(--primary);
    transform: rotate(-45deg);
}

/* No Results State */
.no-results {
    text-align: center;
    margin-top: 4rem;
}

.no-results-icon {
    font-size: 4rem;
    color: var(--surface-light);
    margin-bottom: 1rem;
}

.no-results h3 {
    margin-bottom: 0.5rem;
}

.no-results p {
    color: var(--text-muted);
}

/* Animations */
.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease forwards;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(30, 41, 59, 0.98);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 16px 16px;
    max-height: 350px;
    overflow-y: auto;
    z-index: 100;
    backdrop-filter: blur(12px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.autocomplete-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.clear-recent {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.clear-recent:hover {
    background: rgba(79, 70, 229, 0.2);
}

.autocomplete-item {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    cursor: pointer;
    transition: all 0.15s;
    gap: 0.75rem;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: rgba(79, 70, 229, 0.15);
}

.autocomplete-icon {
    color: var(--text-muted);
    font-size: 0.9rem;
    width: 20px;
    text-align: center;
}

.autocomplete-text {
    flex: 1;
    color: var(--text);
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-text strong {
    color: var(--primary);
}

/* Search Filters */
.search-filters {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-select {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    color: var(--text);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 150px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.filter-select:hover {
    border-color: var(--primary);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.filter-select option {
    background: var(--surface);
    color: var(--text);
}

/* Results Summary */
.results-summary {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 1rem;
    padding-bottom: 0.5rem;
}

/* Did You Mean */
.did-you-mean {
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.3);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.did-you-mean-link {
    color: #fb923c;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.did-you-mean-link:hover {
    color: #fdba74;
    text-decoration: underline;
}

/* Result Tags */
.result-tags {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.result-tags i {
    margin-right: 0.25rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding: 1rem 0;
}

.pagination-btn {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    transition: all 0.2s;
    min-width: 40px;
}

.pagination-btn:hover:not(.disabled):not(.active) {
    background: rgba(79, 70, 229, 0.2);
    border-color: var(--primary);
}

.pagination-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pagination-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-dots {
    color: var(--text-muted);
    padding: 0 0.5rem;
}

/* Mobile Tweaks */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .logo {
        font-size: 2.5rem;
    }

    .result-card {
        flex-direction: column;
        align-items: flex-start;
        position: relative;
    }

    .result-icon {
        margin-bottom: 0.5rem;
    }

    .result-action {
        position: absolute;
        top: 1rem;
        right: 1rem;
        opacity: 1;
        transform: none;
    }

    body.has-results header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .search-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select {
        width: 100%;
    }

    .pagination {
        flex-wrap: wrap;
    }

    .pagination-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    .autocomplete-dropdown {
        max-height: 250px;
    }
}

/* ============================================================
   FEED STYLES - Google Discover Style (Enhanced)
   ============================================================ */

.feed-container {
    margin-top: 2rem;
    width: 100%;
}

.feed-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 1rem;
}

.feed-loading i {
    font-size: 1.5rem;
    color: var(--primary);
}

.feed-error {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

/* Feed Section */
.feed-section {
    margin-bottom: 2rem;
    animation: fadeIn 0.4s ease forwards;
}

.feed-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.25rem;
}

.feed-section-title {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.feed-section-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.feed-section-text h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    line-height: 1.2;
}

.feed-section-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

.feed-see-all {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    background: rgba(79, 70, 229, 0.1);
}

.feed-see-all:hover {
    background: rgba(79, 70, 229, 0.2);
    gap: 0.5rem;
}

.feed-see-all i {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.feed-see-all:hover i {
    transform: translateX(3px);
}

/* Horizontal Scroll Wrapper */
.feed-scroll-wrapper {
    overflow-x: auto;
    overflow-y: hidden;
    margin: 0 -1.5rem;
    padding: 0.5rem 1.5rem 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.feed-scroll-wrapper::-webkit-scrollbar {
    display: none;
}

/* Feed Cards - Horizontal Scroll */
.feed-cards {
    display: flex;
    gap: 1rem;
    padding-bottom: 0.5rem;
}

/* Individual Feed Card */
.feed-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    min-width: 280px;
    max-width: 280px;
    flex-shrink: 0;
}

.feed-card:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(79, 70, 229, 0.5);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.3);
}

.feed-card-gradient {
    height: 4px;
    width: 100%;
}

.feed-card-content {
    flex: 1;
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
}

.feed-sponsored-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    gap: 4px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #0f172a;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
}

.feed-sponsored-badge i {
    font-size: 0.55rem;
}

.feed-card-category {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.feed-card-category i {
    font-size: 0.65rem;
    opacity: 0.8;
}

.feed-card-title {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.45;
    margin: 0;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-card-title a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.feed-card-title a:hover {
    color: #a5b4fc;
}

.feed-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.85rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(51, 65, 85, 0.5);
}

.feed-card-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.feed-card-time i {
    font-size: 0.7rem;
}

.feed-card-action {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(79, 70, 229, 0.15);
    border-radius: 8px;
    color: var(--primary);
    font-size: 0.7rem;
    opacity: 0;
    transform: translateX(-5px);
    transition: all 0.2s;
}

.feed-card:hover .feed-card-action {
    opacity: 1;
    transform: translateX(0);
}

/* Mobile Feed Adjustments */
@media (max-width: 640px) {
    .feed-scroll-wrapper {
        margin: 0 -1rem;
        padding: 0.5rem 1rem 1rem;
    }

    .feed-card {
        min-width: 260px;
        max-width: 260px;
    }

    .feed-section-header {
        padding: 0;
    }

    .feed-section-icon {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .feed-section-text h2 {
        font-size: 1.05rem;
    }

    .feed-see-all {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }

    .feed-card-title {
        font-size: 0.9rem;
        -webkit-line-clamp: 2;
    }

    .feed-card-action {
        opacity: 1;
        transform: none;
    }
}

/* Tablet adjustments */
@media (min-width: 641px) and (max-width: 900px) {
    .feed-card {
        min-width: 300px;
        max-width: 300px;
    }
}

/* Large screens */
@media (min-width: 1100px) {
    .container {
        max-width: 1100px;
    }

    .feed-card {
        min-width: 320px;
        max-width: 320px;
    }

    .feed-scroll-wrapper {
        margin: 0 -2rem;
        padding: 0.5rem 2rem 1rem;
    }
}