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

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

:root {
    --primary-blue: #2563eb;
    --secondary-purple: #7c3aed;
    --accent-teal: #0891b2;
    --success-green: #059669;
    --warning-amber: #d97706;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #334155;
    --bg-elevated: #475569;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-accent: #38bdf8;
    
    --border-primary: #475569;
    --border-accent: #3b82f6;
    --border-subtle: #374151;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-glow: 0 0 20px rgb(59 130 246 / 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(124, 58, 237, 0.05) 0%, transparent 50%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

h1 {
    font-size: 2.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.025em;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 600px;
    margin: 0 auto;
}

.auth-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.auth-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-left: auto; /* Push buttons to the right */

}

.btn {
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--border-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
    background: var(--bg-card);
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--primary-blue);
    border-color: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    box-shadow: 0 0 20px rgb(37 99 235 / 0.4);
}

.search-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.search-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.search-input, .filter-select {
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.search-input {
    flex: 1;
    min-width: 250px;
    font-family: 'JetBrains Mono', monospace;
}

.search-input:focus, .filter-select:focus {
    outline: none;
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

.filter-select {
    min-width: 160px;
    cursor: pointer;
}

.snippets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.snippet-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.snippet-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-blue), var(--secondary-purple));
    border-radius: 12px 12px 0 0;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

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

.snippet-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

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

.snippet-language {
    background: linear-gradient(135deg, var(--accent-teal), var(--primary-blue));
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.snippet-description {
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.snippet-code {
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    overflow-x: auto;
    margin-bottom: 1rem;
    color: var(--text-accent);
    position: relative;
    line-height: 1.5;
}

.snippet-code::before {
    content: attr(data-language) '';
    position: absolute;
    top: -1px;
    right: -1px;
    background: var(--bg-card);
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    border-radius: 0 8px 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.snippet-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.tag {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 0.25rem 0.625rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border-subtle);
    transition: all 0.2s ease;
}

.tag:hover {
    background: var(--secondary-purple);
    color: white;
    border-color: var(--secondary-purple);
}

.snippet-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: center;
}

.premium-overlay {
    position: relative;
    overflow: hidden;
}

.premium-overlay::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(transparent, var(--bg-secondary));
    pointer-events: none;
}

.premium-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, var(--warning-amber), #f59e0b);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 10;
    box-shadow: 0 4px 6px rgb(0 0 0 / 0.1);
}

.user-info {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 500;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}

.modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.modal-header h3 {
    color: var(--primary-blue);
    font-size: 2rem;
    font-weight: 700;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px rgb(59 130 246 / 0.1);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s ease;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.close-modal:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-accent);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 2.25rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .snippets-grid {
        grid-template-columns: 1fr;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .search-input, .filter-select {
        width: 100%;
    }
    
    .auth-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .snippet-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .snippet-language {
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
    }
    
    .search-section, .auth-section {
        padding: 1.5rem;
    }
    
    .snippet-card {
        padding: 1.25rem;
    }
    
    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }
}

/* Subtle animations for a professional feel */
@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

.snippet-card {
    animation: fadeIn 0.3s ease-out;
}

/* Focus states for accessibility */
.btn:focus-visible,
.search-input:focus-visible,
.filter-select:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}
.output-container {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    display: none;
    position: relative;
    overflow: hidden;
}

.output-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--success-green), var(--accent-teal));
}

.output-container.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 300px;
    }
}

.output-header {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.output-content {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8125rem;
    color: var(--text-accent);
    white-space: pre-wrap;
    background: var(--bg-secondary);
    padding: 0.875rem;
    border-radius: 6px;
    border: 1px solid var(--border-primary);
    line-height: 1.5;
    overflow-x: auto;
}

.toggle-output-btn {
    background: var(--bg-card);
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    border: 2px solid var(--border-primary);
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
}

.toggle-output-btn:hover {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    background: var(--bg-elevated);
    border-color: var(--border-accent);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.toggle-output-btn:focus-visible {
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}
