@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Clash+Display:wght@400;600;700&family=General+Sans:wght@400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #0EA5E9;
    --secondary: #06B6D4;
    --accent: #14B8A6;
    --success: #10B981;
    --warning: #F59E0B;
    --bg: #0A0E1A;
    --bg-pattern: #0F1421;
    --card-bg: rgba(30, 41, 59, 0.6);
    --card-glass: rgba(255, 255, 255, 0.05);
    --text: #F1F5F9;
    --text-secondary: #94A3B8;
    --border: rgba(148, 163, 184, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 16px 48px rgba(0, 0, 0, 0.6);
    --glow: 0 0 40px rgba(14, 165, 233, 0.3);
}

body {
    font-family: 'General Sans', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Animated gradient background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(circle at 20% 50%, rgba(14, 165, 233, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(20, 184, 166, 0.05) 0%, transparent 50%);
    animation: gradientShift 20s ease infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes gradientShift {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(5%, 5%) rotate(120deg); }
    66% { transform: translate(-5%, 5%) rotate(240deg); }
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
    z-index: 1;
}

/* Header with glassmorphism */
header {
    text-align: center;
    padding: 80px 40px;
    background: linear-gradient(135deg,
        rgba(14, 165, 233, 0.15) 0%,
        rgba(6, 182, 212, 0.15) 50%,
        rgba(20, 184, 166, 0.15) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 32px;
    margin-bottom: 40px;
    box-shadow:
        var(--shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 60px rgba(14, 165, 233, 0.2);
    color: white;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeInScale 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.3;
    pointer-events: none;
}

.header-icon {
    width: 140px;
    height: 140px;
    margin-bottom: 32px;
    filter: drop-shadow(0 12px 24px rgba(0,0,0,0.4)) drop-shadow(0 0 40px rgba(14, 165, 233, 0.5));
    position: relative;
    z-index: 1;
    animation: float 6s ease-in-out infinite;
}

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

h1 {
    font-family: 'Clash Display', sans-serif;
    font-size: 4.5em;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -3px;
    position: relative;
    z-index: 1;
    text-shadow: 0 4px 20px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

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

.subtitle {
    font-family: 'General Sans', sans-serif;
    font-size: 1.3em;
    opacity: 0.9;
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
    font-weight: 500;
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s both;
}

/* Stats with staggered animation */
.stats {
    display: flex;
    justify-content: center;
    gap: 28px;
    flex-wrap: wrap;
    margin-top: 40px;
    position: relative;
    z-index: 1;
}

.stat-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 28px 44px;
    min-width: 180px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:nth-child(1) { animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.4s both; }
.stat-card:nth-child(2) { animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.5s both; }
.stat-card:nth-child(3) { animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.6s both; }

.stat-card:hover {
    transform: translateY(-6px);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 32px rgba(0,0,0,0.3), var(--glow);
}

.stat-value {
    font-family: 'Space Mono', monospace;
    font-size: 3.2em;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff, rgba(255,255,255,0.7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-label {
    font-family: 'General Sans', sans-serif;
    font-size: 0.85em;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 600;
}

/* Controls with glassmorphism */
.controls {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 32px;
    border-radius: 24px;
    margin-bottom: 32px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.7s both;
}

.search-box {
    position: relative;
    margin-bottom: 24px;
}

.search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    transition: color 0.3s;
}

#search {
    width: 100%;
    padding: 18px 28px 18px 60px;
    font-size: 17px;
    font-family: 'General Sans', sans-serif;
    border: 2px solid var(--border);
    border-radius: 16px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(15, 20, 33, 0.6);
    backdrop-filter: blur(10px);
    color: var(--text);
}

#search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15), var(--glow);
    background: rgba(15, 20, 33, 0.8);
}

#search:focus + .search-icon {
    color: var(--primary);
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 18px;
}

.filter-select {
    padding: 18px 24px;
    font-size: 16px;
    font-family: 'General Sans', sans-serif;
    font-weight: 500;
    border: 2px solid var(--border);
    border-radius: 16px;
    background: rgba(15, 20, 33, 0.6);
    backdrop-filter: blur(10px);
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-select:focus,
.filter-select:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
    background: rgba(15, 20, 33, 0.8);
}

.filter-select option {
    background: var(--bg);
    color: var(--text);
}

/* Results Info */
.results-info {
    padding: 18px 28px;
    background: rgba(30, 41, 59, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    margin-bottom: 28px;
    font-weight: 600;
    font-family: 'Space Mono', monospace;
    font-size: 0.9em;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.8s both;
}

/* Apps Grid - Bento box inspired */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

.app-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
    cursor: pointer;
    position: relative;
    animation: fadeInScale 0.6s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* Staggered card animations */
.app-card:nth-child(n) {
    animation-delay: calc(0.05s * var(--index, 0));
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(6, 182, 212, 0.1));
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.app-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-hover), var(--glow);
    border-color: rgba(14, 165, 233, 0.3);
}

.app-card:hover::before {
    opacity: 1;
}

.app-screenshot {
    width: 100%;
    height: 220px;
    position: relative;
    background: linear-gradient(135deg, #0EA5E9 0%, #06B6D4 50%, #14B8A6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.app-screenshot::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.2) 100%);
}

.app-screenshot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-card:hover .app-screenshot img {
    transform: scale(1.1);
}

.app-screenshot-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Clash Display', sans-serif;
    font-size: 5em;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    text-shadow: 0 8px 24px rgba(0,0,0,0.4);
    position: relative;
    z-index: 1;
}

.no-image-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    color: white;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.7em;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 2;
}

.app-info {
    padding: 24px;
}

.app-name {
    font-family: 'Clash Display', sans-serif;
    font-size: 1.3em;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.app-category-badge {
    display: inline-block;
    font-family: 'Space Mono', monospace;
    font-size: 0.7em;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 7px 16px;
    border-radius: 12px;
    font-weight: 700;
    margin-bottom: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.app-description {
    font-family: 'General Sans', sans-serif;
    color: var(--text-secondary);
    font-size: 0.95em;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 16px;
}

.app-languages-compact {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.language-tag-small {
    font-family: 'Space Mono', monospace;
    font-size: 0.7em;
    background: rgba(15, 20, 33, 0.8);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.language-tag-small:hover {
    background: rgba(14, 165, 233, 0.2);
    border-color: var(--primary);
    color: var(--primary);
}

/* Modal with enhanced glassmorphism */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: block;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
}

.modal-content {
    position: relative;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    max-width: 1100px;
    max-height: 90vh;
    margin: 5vh auto;
    border-radius: 32px;
    overflow-y: auto;
    animation: modalSlideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), var(--glow);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.modal-close {
    position: absolute;
    top: 28px;
    right: 28px;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 28px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.9);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
}

.modal-body {
    padding: 40px;
}

.modal-header-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    margin: -40px -40px 40px -40px;
    border-radius: 32px 32px 0 0;
}

.modal-title {
    font-family: 'Clash Display', sans-serif;
    font-size: 3em;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text);
    letter-spacing: -2px;
}

.modal-meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.modal-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(15, 20, 33, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    font-family: 'Space Mono', monospace;
    font-size: 0.85em;
    font-weight: 700;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.modal-description {
    font-family: 'General Sans', sans-serif;
    font-size: 1.2em;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: 36px;
}

.modal-section {
    margin-bottom: 36px;
}

.modal-section-title {
    font-family: 'Clash Display', sans-serif;
    font-size: 1.8em;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
    letter-spacing: -1px;
}

.modal-languages {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.language-tag {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(15, 20, 33, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 14px;
    font-family: 'Space Mono', monospace;
    font-size: 0.95em;
    color: var(--text);
    font-weight: 700;
    border: 2px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.language-tag:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.3);
}

.language-icon {
    width: 24px;
    height: 24px;
}

.modal-links {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.modal-link {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-decoration: none;
    border-radius: 16px;
    font-family: 'General Sans', sans-serif;
    font-weight: 700;
    font-size: 1.05em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.4);
    position: relative;
    overflow: hidden;
}

.modal-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.modal-link:hover::before {
    left: 100%;
}

.modal-link:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(14, 165, 233, 0.5);
}

.modal-link svg {
    width: 24px;
    height: 24px;
}

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

.modal-screenshot {
    width: 100%;
    border-radius: 18px;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: 2px solid var(--border);
}

.modal-screenshot:hover {
    transform: scale(1.05);
    border-color: var(--primary);
    box-shadow: var(--shadow-hover), var(--glow);
}

/* Loading */
.loading {
    text-align: center;
    padding: 120px 20px;
    grid-column: 1 / -1;
}

.spinner {
    width: 70px;
    height: 70px;
    border: 6px solid rgba(14, 165, 233, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 28px;
}

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

.loading p {
    font-family: 'Space Mono', monospace;
    font-size: 1.3em;
    color: var(--text-secondary);
    font-weight: 600;
}

.no-results {
    text-align: center;
    padding: 120px 20px;
    grid-column: 1 / -1;
}

.no-results p {
    font-family: 'Clash Display', sans-serif;
    font-size: 1.6em;
    color: var(--text-secondary);
    margin-bottom: 14px;
    font-weight: 600;
}

/* Footer */
footer {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
    margin-top: 80px;
}

footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    position: relative;
}

footer a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s;
}

footer a:hover::after {
    width: 100%;
}

footer p {
    margin: 12px 0;
    font-family: 'General Sans', sans-serif;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 14px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: 7px;
    border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--secondary), var(--accent));
}

/* Responsive */
@media (max-width: 768px) {
    h1 {
        font-size: 2.8em;
        letter-spacing: -2px;
    }

    .subtitle {
        font-size: 1.1em;
    }

    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .stat-card {
        padding: 20px 32px;
        min-width: 140px;
    }

    .stat-value {
        font-size: 2.4em;
    }

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

    header {
        padding: 60px 28px;
    }

    .modal-content {
        margin: 0;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-title {
        font-size: 2.2em;
    }

    .modal-screenshots {
        grid-template-columns: 1fr;
    }
}

/* Animation utilities */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
