/* ===================================
   API Hub - Premium Styles
   =================================== */

:root {
    /* Color Palette */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --secondary: #22d3ee;
    --accent: #f472b6;

    /* Dark Theme */
    --bg-dark: #0a0a0f;
    --bg-card: rgba(20, 20, 30, 0.8);
    --bg-card-hover: rgba(30, 30, 45, 0.9);
    --surface: rgba(30, 30, 45, 0.6);

    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    /* Borders */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
    --gradient-secondary: linear-gradient(135deg, #22d3ee 0%, #6366f1 100%);
    --gradient-text: linear-gradient(135deg, #6366f1, #22d3ee, #f472b6);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);

    /* Spacing */
    --container-width: 1400px;
    --border-radius: 16px;
    --border-radius-sm: 8px;

    /* Animations */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated Background */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(34, 211, 238, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

/* Container */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* ===================================
   Header
   =================================== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px 0;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.logo:hover {
    transform: scale(1.02);
}

.logo-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    border-radius: 8px;
}

.logo-text .highlight {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-stats {
    display: flex;
    gap: 32px;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--surface);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-light);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===================================
   Hero Section
   =================================== */
.hero {
    padding: 140px 0 60px;
    text-align: center;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    line-height: 1.7;
}

/* ===================================
   Search Box
   =================================== */
.search-container {
    max-width: 700px;
    margin: 0 auto 32px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 60px;
    padding: 8px 24px;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.search-box:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.search-icon {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    padding: 16px 20px;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-family: inherit;
}

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

.search-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.search-box:focus-within .search-clear,
.search-clear.visible {
    opacity: 1;
}

.search-clear:hover {
    color: var(--text-primary);
}

/* Live Search Results Counter - Above Search Box */
.search-results-hint {
    text-align: center;
    margin-bottom: 16px;
    font-size: 0.95rem;
    color: var(--text-muted);
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    opacity: 0;
    transform: translateY(10px);
    transition: all var(--transition-normal);
}

.search-results-hint.visible {
    opacity: 1;
    transform: translateY(0);
}

.search-results-hint .suggestion-text {
    font-weight: 600;
    color: var(--secondary);
    background: rgba(34, 211, 238, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(34, 211, 238, 0.2);
    display: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.search-results-hint .suggestion-text:hover {
    background: rgba(34, 211, 238, 0.2);
    border-color: rgba(34, 211, 238, 0.4);
    transform: scale(1.02);
}

.search-results-hint .suggestion-text.visible {
    display: inline-block;
    animation: fadeInSuggestion 0.2s ease;
}

@keyframes fadeInSuggestion {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.search-results-hint .results-info {
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-results-hint #liveResultsCount {
    font-weight: 700;
    font-size: 1.1rem;
    background: var(--gradient-text);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.search-results-hint .enter-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Autocomplete Suggestions - Premium Design */
.autocomplete-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: rgba(20, 20, 35, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 16px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: none;
    transform: translateY(-8px);
    opacity: 0;
    transition: all 0.2s ease;
}

.autocomplete-suggestions.visible {
    display: block;
    transform: translateY(0);
    opacity: 1;
    animation: slideDown 0.25s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.autocomplete-suggestions::-webkit-scrollbar {
    width: 6px;
}

.autocomplete-suggestions::-webkit-scrollbar-track {
    background: transparent;
}

.autocomplete-suggestions::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.4);
    border-radius: 3px;
}

.suggestion-group {
    padding: 12px 0;
}

.suggestion-group:first-child {
    padding-top: 8px;
}

.suggestion-group+.suggestion-group {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.suggestion-group-title {
    padding: 6px 20px 10px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary-light);
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestion-group-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.3), transparent);
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    margin: 0 8px;
    border-radius: 8px;
}

.suggestion-item:hover,
.suggestion-item.active {
    background: rgba(99, 102, 241, 0.12);
    border-left-color: var(--primary);
}

.suggestion-icon {
    font-size: 1.3rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 10px;
    flex-shrink: 0;
}

.suggestion-text {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.suggestion-text .highlight {
    color: var(--secondary);
    font-weight: 700;
    background: rgba(34, 211, 238, 0.1);
    padding: 1px 4px;
    border-radius: 4px;
}

.suggestion-count {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ===================================
   Quick Filters
   =================================== */
.quick-filters {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 24px;
    border: 1px solid var(--border-color);
    background: var(--surface);
    color: var(--text-secondary);
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    transition: all var(--transition-normal);
}

.filter-btn:hover {
    border-color: var(--primary);
    color: var(--text-primary);
}

.filter-btn.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* ===================================
   Category Section
   =================================== */
.category-section {
    padding: 40px 0 20px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.results-count {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.results-count span {
    color: var(--primary-light);
    font-weight: 600;
}

.category-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.category-tabs::-webkit-scrollbar {
    height: 6px;
}

.category-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.category-tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.category-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    transition: all var(--transition-normal);
}

.category-tab:hover {
    border-color: var(--primary);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.category-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.cat-icon {
    font-size: 1.1rem;
}

/* ===================================
   API Cards Grid
   =================================== */
.main-content {
    padding: 20px 0 80px;
    min-height: 50vh;
}

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

/* Clickable Card Link Wrapper */
.api-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    border-radius: var(--border-radius);
    transition: all var(--transition-normal);
    animation: fadeIn 0.4s ease forwards;
}

.api-card-link:hover .api-card {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.api-card-link:hover .api-card::before {
    transform: scaleX(1);
}

.api-card-link:hover .api-name {
    color: var(--primary-light);
}

.api-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    height: 100%;
    cursor: pointer;
}

.api-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform var(--transition-normal);
}

.api-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.api-card:hover::before {
    transform: scaleX(1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    gap: 12px;
}

.api-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.api-name a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.api-name a:hover {
    color: var(--primary-light);
}

.auth-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 20px;
    flex-shrink: 0;
}

.auth-badge.apiKey {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.auth-badge.oauth {
    background: rgba(244, 114, 182, 0.15);
    color: #f472b6;
    border: 1px solid rgba(244, 114, 182, 0.3);
}

.auth-badge.free {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.auth-badge.other {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.api-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.category-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.category-label span {
    color: var(--primary-light);
}

.card-badges {
    display: flex;
    gap: 8px;
}

.badge {
    padding: 4px 8px;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 4px;
    background: var(--surface);
    color: var(--text-muted);
}

.badge.https {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
}

.badge.cors-yes {
    background: rgba(34, 211, 238, 0.1);
    color: #22d3ee;
}

/* ===================================
   Loading & Empty States
   =================================== */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.no-results-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-results h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.no-results p {
    color: var(--text-muted);
}

/* ===================================
   About Section
   =================================== */
.about-section {
    padding: 80px 0;
    background: rgba(10, 10, 20, 0.5);
    border-top: 1px solid var(--border-color);
}

.about-content {
    text-align: center;
    max-width: 900px;
    margin: 0 auto;
}

.about-title {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 24px;
}

.about-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 48px;
}

.about-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.about-feature {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 32px 24px;
    transition: all var(--transition-normal);
}

.about-feature:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.feature-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 16px;
}

.about-feature h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.about-feature p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ===================================
   Footer
   =================================== */
.footer {
    background: rgba(10, 10, 15, 0.9);
    border-top: 1px solid var(--border-color);
    padding: 60px 0 30px;
}

.footer-content {
    text-align: center;
    margin-bottom: 40px;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.footer-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===================================
   Responsive Design
   =================================== */
@media (max-width: 768px) {
    .nav-stats {
        display: none;
    }

    .hero {
        padding: 120px 0 40px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .search-box {
        padding: 4px 16px;
    }

    .search-input {
        padding: 12px 16px;
        font-size: 1rem;
    }

    .api-grid {
        grid-template-columns: 1fr;
    }

    .quick-filters {
        gap: 8px;
    }

    .filter-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .category-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.api-card {
    animation: fadeIn 0.4s ease forwards;
}

.api-card:nth-child(1) {
    animation-delay: 0.05s;
}

.api-card:nth-child(2) {
    animation-delay: 0.1s;
}

.api-card:nth-child(3) {
    animation-delay: 0.15s;
}

.api-card:nth-child(4) {
    animation-delay: 0.2s;
}

.api-card:nth-child(5) {
    animation-delay: 0.25s;
}

.api-card:nth-child(6) {
    animation-delay: 0.3s;
}