/* Code Highlighting Styles */
.code-block {
    position: relative;
    background: var(--code-bg);
    border-radius: 12px;
    overflow: hidden;
    margin: 1.5rem 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(139, 92, 246, 0.2);
}

.code-block.small {
    margin: 1rem 0;
    font-size: 0.85rem;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(139, 92, 246, 0.1);
    border-bottom: 1px solid rgba(139, 92, 246, 0.2);
}

.code-lang {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.copy-btn {
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: var(--text-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(139, 92, 246, 0.3);
    border-color: rgba(139, 92, 246, 0.5);
}

.copy-btn:active {
    transform: scale(0.95);
}

.copy-btn.copied {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--success);
}

pre {
    margin: 0;
    padding: 1.5rem;
    overflow-x: auto;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    background: transparent;
}

code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    background: rgba(139, 92, 246, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

pre code {
    background: transparent;
    padding: 0;
    border: none;
    font-size: inherit;
    color: var(--text-primary);
}

/* Syntax Highlighting */
.hljs {
    background: transparent !important;
    color: var(--text-primary);
}

.hljs-comment,
.hljs-quote {
    color: #6b7280;
    font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-type {
    color: #8b5cf6;
    font-weight: 600;
}

.hljs-string,
.hljs-title {
    color: #10b981;
}

.hljs-number,
.hljs-symbol,
.hljs-bullet {
    color: #f59e0b;
}

.hljs-function,
.hljs-params {
    color: #3b82f6;
}

.hljs-variable,
.hljs-class,
.hljs-title.class_ {
    color: #ef4444;
}

.hljs-attr,
.hljs-attribute {
    color: #06b6d4;
}

.hljs-built_in,
.hljs-builtin-name {
    color: #8b5cf6;
}

.hljs-meta,
.hljs-meta-keyword {
    color: #6366f1;
}

.hljs-tag {
    color: #ef4444;
}

.hljs-name {
    color: #3b82f6;
}

.hljs-selector-id,
.hljs-selector-class {
    color: #10b981;
}

/* Language-specific highlighting */
.language-python .hljs-keyword {
    color: #8b5cf6;
}

.language-python .hljs-string {
    color: #10b981;
}

.language-python .hljs-function {
    color: #3b82f6;
}

.language-javascript .hljs-keyword {
    color: #8b5cf6;
}

.language-javascript .hljs-string {
    color: #10b981;
}

.language-javascript .hljs-function {
    color: #3b82f6;
}

.language-rust .hljs-keyword {
    color: #8b5cf6;
}

.language-rust .hljs-string {
    color: #10b981;
}

.language-rust .hljs-function {
    color: #3b82f6;
}

.language-rust .hljs-type {
    color: #06b6d4;
}

/* Code block animations */
.code-block {
    opacity: 0;
    transform: translateY(20px);
    animation: slideInUp 0.6s ease forwards;
}

.code-block.stagger-1 {
    animation-delay: 0.1s;
}

.code-block.stagger-2 {
    animation-delay: 0.2s;
}

.code-block.stagger-3 {
    animation-delay: 0.3s;
}

/* Scrollbar styling for code blocks */
pre::-webkit-scrollbar {
    height: 8px;
}

pre::-webkit-scrollbar-track {
    background: rgba(139, 92, 246, 0.1);
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb {
    background: rgba(139, 92, 246, 0.3);
    border-radius: 4px;
}

pre::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 92, 246, 0.5);
}

/* Tabs styling */
.tabs-container {
    margin: 2rem 0;
}

.tabs {
    display: flex;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 12px 12px 0 0;
    padding: 0.5rem;
    gap: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Language selector styling */
.language-selector {
    padding: 2rem 0;
    background: rgba(139, 92, 246, 0.05);
    border-bottom: 1px solid rgba(139, 92, 246, 0.1);
}

.language-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.lang-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: rgba(139, 92, 246, 0.1);
    border: 2px solid rgba(139, 92, 246, 0.2);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.lang-tab:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
}

.lang-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
}

.lang-icon {
    font-size: 2rem;
}

.lang-tab span {
    font-weight: 600;
    font-size: 1.1rem;
}

/* Language content sections */
.lang-content {
    display: none;
    padding: 3rem 0;
}

.lang-content.active {
    display: block;
    animation: fadeInUp 0.5s ease;
}

/* Hero section variants */
.python-hero {
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.9) 0%, 
        rgba(139, 92, 246, 0.9) 50%, 
        rgba(168, 85, 247, 0.9) 100%);
}

.javascript-hero {
    background: linear-gradient(135deg, 
        rgba(245, 158, 11, 0.9) 0%, 
        rgba(139, 92, 246, 0.9) 50%, 
        rgba(234, 179, 8, 0.9) 100%);
}

.rust-hero {
    background: linear-gradient(135deg, 
        rgba(239, 68, 68, 0.9) 0%, 
        rgba(139, 92, 246, 0.9) 50%, 
        rgba(251, 146, 60, 0.9) 100%);
}

.examples-hero {
    background: linear-gradient(135deg, 
        rgba(139, 92, 246, 0.9) 0%, 
        rgba(168, 85, 247, 0.9) 25%,
        rgba(59, 130, 246, 0.9) 50%,
        rgba(245, 158, 11, 0.9) 75%,
        rgba(239, 68, 68, 0.9) 100%);
}

/* Examples grid */
.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.example-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid rgba(139, 92, 246, 0.2);
    transition: all 0.3s ease;
}

.example-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
}

.example-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.example-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.example-type {
    background: var(--primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.example-type:contains("Beginner") {
    background: #10b981;
}

.example-type:contains("Intermediate") {
    background: #f59e0b;
}

.example-type:contains("Advanced") {
    background: #ef4444;
}

/* Responsive design */
@media (max-width: 768px) {
    .examples-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .language-tabs {
        flex-direction: column;
        align-items: center;
    }
    
    .lang-tab {
        min-width: 200px;
    }
    
    .tabs {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .tab-btn {
        text-align: center;
    }
    
    pre {
        padding: 1rem;
        font-size: 0.8rem;
    }
    
    .code-header {
        padding: 0.5rem 1rem;
    }
    
    .copy-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .example-card {
        padding: 1rem;
    }
    
    .code-block {
        margin: 1rem 0;
    }
    
    pre {
        padding: 0.75rem;
    }
}
