/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --bg-card: rgba(45, 45, 45, 0.95);
    --bg-card-hover: rgba(45, 45, 45, 1);
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #808080;
    --accent-primary: #4a9eff;
    --accent-secondary: #00d4ff;
    --accent-gradient: linear-gradient(135deg, #4a9eff, #00d4ff);
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

html {
    scroll-behavior: smooth;
}

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

/* Animated Background */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    animation: float 25s ease-in-out infinite;
}

.orb-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #4a9eff, transparent);
    top: -250px;
    left: -250px;
    animation-delay: 0s;
}

.orb-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #00d4ff, transparent);
    bottom: -200px;
    right: -200px;
    animation-delay: 5s;
}

.orb-3 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, #667eea, transparent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 10s;
}

.orb-4 {
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, #764ba2, transparent);
    top: 20%;
    right: 10%;
    animation-delay: 15s;
}

.orb-5 {
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, #f093fb, transparent);
    bottom: 30%;
    left: 15%;
    animation-delay: 20s;
}

@keyframes float {
    0%, 100% { 
        transform: translate(0, 0) scale(1) rotate(0deg); 
        opacity: 0.15;
    }
    25% { 
        transform: translate(100px, -100px) scale(1.1) rotate(90deg); 
        opacity: 0.2;
    }
    50% { 
        transform: translate(-100px, 100px) scale(0.9) rotate(180deg); 
        opacity: 0.1;
    }
    75% { 
        transform: translate(50px, 50px) scale(1.05) rotate(270deg); 
        opacity: 0.18;
    }
}

.particles {
    position: absolute;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 60% 70%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 80% 20%, white, transparent);
    background-size: 200px 200px, 150px 150px, 100px 100px, 250px 250px;
    animation: particles 60s linear infinite;
    opacity: 0.03;
}

@keyframes particles {
    0% { background-position: 0% 0%, 0% 0%, 0% 0%, 0% 0%; }
    100% { background-position: 200% 200%, 150% 150%, 100% 100%, 250% 250%; }
}

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

/* Header */
.header {
    padding: 30px 0;
    animation: slideDown 0.8s ease-out;
}

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

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    animation: pulse 2s ease-in-out infinite;
}

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

.logo-text h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.logo-text p {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 15px;
    color: var(--text-muted);
    z-index: 2;
    transition: var(--transition-smooth);
}

#searchInput {
    padding: 12px 15px 12px 45px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 16px;
    width: 300px;
    transition: var(--transition-smooth);
    backdrop-filter: blur(10px);
}

#searchInput:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
    transform: translateY(-1px);
}

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

.filter-container select {
    padding: 12px 20px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition-smooth);
    backdrop-filter: blur(10px);
}

.filter-container select:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Navigation */
.nav-container {
    margin: 30px 0;
    animation: fadeIn 1s ease-out 0.3s both;
}

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

.nav-letters {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 800px;
    margin: 0 auto;
}

.nav-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    background: var(--bg-card);
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: var(--transition-bounce);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.nav-letter::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--accent-gradient);
    transition: left 0.5s ease;
    z-index: -1;
}

.nav-letter:hover {
    color: var(--text-primary);
    transform: translateY(-3px) scale(1.1);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.nav-letter:hover::before {
    left: 0;
}

/* Stats Bar */
.stats-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    margin: 30px 0;
    backdrop-filter: blur(10px);
    animation: fadeIn 1s ease-out 0.6s both;
}

.stats-content {
    display: flex;
    justify-content: center;
    gap: 60px;
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Main Content */
.main-content {
    margin: 40px 0;
}

.snippets-container {
    min-height: 400px;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

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

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.letter-section {
    margin-bottom: 80px;
    animation: slideUp 0.8s ease-out;
}

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

.letter-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 40px;
    text-align: center;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
}

.letter-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

.snippets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 30px;
}

.snippet-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 30px;
    transition: var(--transition-smooth);
    backdrop-filter: blur(15px);
    position: relative;
    overflow: hidden;
}

.snippet-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.snippet-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--accent-primary);
}

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

.snippet-header {
    margin-bottom: 20px;
}

.snippet-title {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.3;
}

.snippet-description {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
}

.snippet-meta {
    display: flex;
    gap: 12px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.language-tag, .category-tag {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: var(--transition-smooth);
}

.language-tag {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.3);
}

.language-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.4);
}

.category-tag {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.snippet-code {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
    position: relative;
}

.snippet-code pre {
    margin: 0;
    white-space: pre;
    word-wrap: normal;
}

.snippet-code code {
    color: var(--text-primary);
}

.copy-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition-bounce);
    box-shadow: 0 2px 8px rgba(74, 158, 255, 0.3);
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 158, 255, 0.4);
}

.copy-btn.copied {
    background: linear-gradient(135deg, #10b981, #059669);
}

.no-results {
    text-align: center;
    padding: 100px 20px;
    color: var(--text-secondary);
}

.no-results h3 {
    font-size: 2rem;
    margin-bottom: 15px;
    color: var(--text-primary);
}

/* Footer */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    padding: 60px 0 20px;
    margin-top: 80px;
    backdrop-filter: blur(10px);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 1.1rem;
}

.footer-section p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    color: var(--text-secondary);
    margin-bottom: 12px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.footer-section ul li:hover {
    color: var(--accent-primary);
    transform: translateX(5px);
}

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

/* Responsive Design */
@media (max-width: 1024px) {
    .header-content {
        flex-direction: column;
        gap: 30px;
        text-align: center;
    }
    
    .header-controls {
        width: 100%;
        justify-content: center;
    }
    
    .snippets-grid {
        grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .logo-text h1 {
        font-size: 2rem;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }
    
    #searchInput {
        width: 100%;
        max-width: 300px;
    }
    
    .nav-letters {
        gap: 6px;
    }
    
    .nav-letter {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
    
    .stats-content {
        gap: 30px;
    }
    
    .snippets-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .snippet-card {
        padding: 20px;
    }
    
    .snippet-code {
        padding: 15px;
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .letter-title {
        font-size: 2rem;
    }
    
    .snippet-title {
        font-size: 1.2rem;
    }
    
    .nav-letter {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }
}
