/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@300;400;500;600;700&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

/* Font Stack */
:root {
    --font-primary: 'Comfortaa', 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    --font-secondary: 'Poppins', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

/* Hero Section */
.hero-section {
    position: relative;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    width: 100vw;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    margin-top: -2rem;
    margin-bottom: 3rem;
    padding-top: 2rem;
}

.hero-background {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-gradient {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 50%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    animation: gradientShift 20s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.hero-particles {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(99, 102, 241, 0.3) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: float 40s linear infinite;
}

@keyframes float {
    0% { transform: translateY(0) translateX(0); }
    100% { transform: translateY(-50px) translateX(50px); }
}

.hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 1rem 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    margin: 0 0 1.5rem 0;
    line-height: 1.1;
}

.hero-title-main {
    font-family: var(--font-primary);
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
    letter-spacing: -0.02em;
    text-rendering: optimizeLegibility;
    min-height: 4rem;
    line-height: 1.1;
}

.hero-description {
    font-family: var(--font-secondary);
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.6;
    font-weight: 400;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
    min-height: 4rem;
}

.category-page .main-content {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    min-height: calc(100vh - 200px);
    font-family: var(--font-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 1.75rem;
    animation: fadeInUp 0.6s ease-out;
}

.category-grid .query-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 2.5rem;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.04),
        0 16px 32px rgba(0, 0, 0, 0.06),
        0 24px 48px rgba(0, 0, 0, 0.04);
    min-height: 180px;
    margin-top: 20px;
    text-decoration: none !important;
}

.category-grid .query-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 8px 16px rgba(0, 0, 0, 0.08),
        0 24px 48px rgba(0, 0, 0, 0.12),
        0 32px 64px rgba(0, 0, 0, 0.08) !important;
    border-color: var(--accent-primary);
}

.category-grid .query-card h4 {
    font-family: var(--font-primary);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.25;
    letter-spacing: -0.025em;
    text-rendering: optimizeLegibility;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.category-grid .query-card p {
    font-family: var(--font-secondary);
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin: 0;
    flex-grow: 1;
    font-weight: 450;
    letter-spacing: -0.005em;
    opacity: 0.9;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(24px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Popularity Badge Styles */
.popularity-indicator {
    position: absolute;
    top: -12px;
    right: 12px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    z-index: 10;
}

.popularity-indicator.visible {
    opacity: 1;
}

.popularity-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popularity-badge.trending {
    background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
    color: white;
    animation: glow-red 2s ease-in-out infinite;
}

.popularity-badge.popular {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    animation: glow-purple 3s ease-in-out infinite;
}

.popularity-badge.hot {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    animation: pulse-hot 1.5s ease-in-out infinite;
}

.popularity-badge.rising {
    background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    color: white;
    position: relative;
}

.popularity-badge.rank-1 {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.popularity-badge .rank-number {
    background: none;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    margin-right: 0.125rem;
}

/* Badge Animations */
@keyframes glow-red {
    0%, 100% { box-shadow: 0 0 5px rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 15px rgba(239, 68, 68, 0.8); }
}

@keyframes glow-purple {
    0%, 100% { box-shadow: 0 0 5px rgba(99, 102, 241, 0.5); }
    50% { box-shadow: 0 0 15px rgba(99, 102, 241, 0.8); }
}

@keyframes pulse-hot {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Responsive Badge Styles */
@media (max-width: 768px) {
    .popularity-indicator {
        top: -6px;
        right: 8px;
    }

    .popularity-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.6rem;
        max-width: 100px;
    }

    .popularity-badge .rank-number {
        width: 16px;
        height: 16px;
        font-size: 0.6rem;
    }
}