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

/* Prevent horizontal overflow globally */
html, body {
    overflow-x: hidden;
    max-width: 100%;
}

/* Ensure all code blocks don't overflow */
pre {
    max-width: 100%;
    overflow-x: auto;
}

code {
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Fix any dynamic content containers */
[data-example-index] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

:root {
    /* Color Palette */
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #10b981;
    --accent-color: #f59e0b;
    --warning-color: #ef4444;
    
    /* Text Colors */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-inverse: #ffffff;
    
    /* Background Colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --bg-code: #1e293b;
    --bg-card: #ffffff;
    --bg-modal: rgba(0, 0, 0, 0.8);
    
    /* Border Colors */
    --border-light: #e5e7eb;
    --border-medium: #d1d5db;
    --border-dark: #374151;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Typography */
    --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-family-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --spacing-3xl: 4rem;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Z-Index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal: 1040;
    --z-popover: 1050;
    --z-tooltip: 1060;
}

/* Base Typography */
body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.gradient-text {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-size-base);
    font-weight: 500;
    border-radius: var(--radius-lg);
    border: none;
    cursor: pointer;
    transition: var(--transition-normal);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--text-inverse);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--text-inverse);
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    backdrop-filter: blur(10px);
    z-index: var(--z-fixed);
    transition: var(--transition-normal);
}

.nav {
    padding: var(--spacing-md) 0;
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    font-size: var(--font-size-2xl);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
}

.nav-link {
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition-fast);
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
    border-radius: 1px;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.theme-toggle,
.search-toggle,
.menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-fast);
    color: var(--text-secondary);
}

.theme-toggle:hover,
.search-toggle:hover,
.menu-toggle:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.menu-toggle {
    display: none;
}

.hamburger {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    position: relative;
}

.hamburger::before,
.hamburger::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    background: currentColor;
    transition: var(--transition-fast);
}

.hamburger::before { top: -6px; }
.hamburger::after { top: 6px; }

/* Search Bar */
.search-bar {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    padding: var(--spacing-md) 0;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

.search-bar.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    position: relative;
}

.search-input {
    width: 100%;
    padding: var(--spacing-md);
    font-size: var(--font-size-lg);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    transition: var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: var(--z-dropdown);
    display: none;
}

/* Main Content */
.main {
    padding-top: 80px;
}

/* Hero Section */
.hero {
    padding: var(--spacing-3xl) 0;
    min-height: 60vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-3xl);
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

.hero-content {
    max-width: 600px;
}

.hero-title {
    font-size: var(--font-size-5xl);
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
    line-height: 1.1;
}

.hero-description {
    font-size: var(--font-size-xl);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-2xl);
}

.hero-actions {
    display: flex;
    gap: var(--spacing-lg);
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.pattern-showcase {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
    transform: rotate(15deg);
}

.pattern-card {
    background: var(--bg-card);
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    text-align: center;
    transition: var(--transition-normal);
}

.pattern-card:hover {
    box-shadow: var(--shadow-xl);
}

.pattern-card:nth-child(2) {
    transform: translateY(20px);
}

.pattern-card:nth-child(3) {
    transform: translateY(-10px);
}

.pattern-icon {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--spacing-sm);
}

.pattern-name {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

/* Features Section */
.features {
    padding: var(--spacing-3xl) 0;
    background: var(--bg-secondary);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-2xl);
    margin-top: var(--spacing-2xl);
}

.feature-card {
    background: var(--bg-card);
    padding: var(--spacing-2xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: var(--transition-normal);
}

.feature-card:hover {
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: var(--font-size-4xl);
    margin-bottom: var(--spacing-lg);
}

.feature-card h3 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

/* Section Titles */
.section-title {
    text-align: center;
    font-size: var(--font-size-4xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xl);
}

.section-description {
    text-align: center;
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-2xl);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Patterns Section */
.patterns-section {
    padding: var(--spacing-3xl) 0;
}

.pattern-categories {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-2xl);
    flex-wrap: wrap;
}

.category-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: transparent;
    border: 2px solid var(--border-medium);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-weight: 500;
}

.category-btn:hover,
.category-btn.active {
    background: var(--primary-color);
    color: var(--text-inverse);
    border-color: var(--primary-color);
}

.patterns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: var(--spacing-xl);
}

.pattern-item {
    transition: var(--transition-normal);
}

.pattern-item.hidden {
    display: none;
}

.pattern-card-full {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition-normal);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.pattern-card-full:hover {
    box-shadow: var(--shadow-lg);
}

.pattern-header {
    padding: var(--spacing-xl);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-lg);
}

.pattern-header .pattern-icon {
    font-size: var(--font-size-3xl);
    margin-bottom: 0;
}

.pattern-meta h3 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.pattern-category {
    display: inline-block;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
}

.pattern-difficulty {
    display: inline-block;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: white;
    margin-left: var(--spacing-sm);
}

.pattern-difficulty.easy {
    background: var(--secondary-color);
}

.pattern-difficulty.medium {
    background: var(--accent-color);
}

.pattern-difficulty.hard {
    background: var(--warning-color);
}

.pattern-description {
    padding: 0 var(--spacing-xl);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
    flex-grow: 1;
}

.pattern-languages {
    padding: 0 var(--spacing-xl);
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.language-tag {
    background: var(--primary-color);
    color: var(--text-inverse);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.pattern-learn-btn {
    margin: 0 var(--spacing-xl) var(--spacing-xl);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--primary-color);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
    font-weight: 500;
}

.pattern-learn-btn:hover {
    background: var(--primary-dark);
}

/* Playground Section */
.playground-section {
    padding: var(--spacing-3xl) 0;
    background: var(--bg-secondary);
}

.playground-container {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin-top: var(--spacing-2xl);
}

.playground-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-light);
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.language-selector {
    display: flex;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.lang-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    font-weight: 500;
}

.lang-btn.active {
    background: var(--primary-color);
    color: var(--text-inverse);
}

.pattern-selector select {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
}

.run-btn {
    padding: var(--spacing-sm) var(--spacing-xl);
    background: var(--secondary-color);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
    font-weight: 500;
}

.run-btn:hover {
    background: #059669;
}

.playground-editors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 400px;
}

.editor-container,
.output-container {
    display: flex;
    flex-direction: column;
}

.editor-container {
    border-right: 1px solid var(--border-light);
}

.editor-header,
.output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-light);
}

.editor-title,
.output-title {
    font-weight: 600;
    color: var(--text-primary);
}

.copy-btn,
.clear-btn {
    padding: var(--spacing-xs) var(--spacing-sm);
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    transition: var(--transition-fast);
}

.copy-btn:hover,
.clear-btn:hover {
    background: var(--bg-secondary);
}

.editor,
.output {
    flex-grow: 1;
    position: relative;
}

.code-input {
    width: 100%;
    height: 100%;
    padding: var(--spacing-lg);
    border: none;
    background: var(--bg-code);
    color: #e2e8f0;
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    resize: none;
    outline: none;
}

.code-input::placeholder {
    color: #64748b;
}

.output {
    padding: var(--spacing-lg);
    background: var(--bg-card);
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    overflow-y: auto;
}

.output-placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* About Section */
.about-section {
    padding: var(--spacing-3xl) 0;
}

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

.about-text p {
    font-size: var(--font-size-lg);
    margin-bottom: var(--spacing-lg);
}

/* Modal - Full Screen */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-modal);
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: var(--transition-normal);
}

.modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 0;
    box-shadow: none;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
    min-height: 48px;
}

.modal-title {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-size: var(--font-size-xl);
    color: var(--text-secondary);
    transition: var(--transition-fast);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.2);
}

.modal-body {
    flex: 1 1 auto;
    overflow: hidden;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Modal Progress - Integrated into header */
.modal-progress {
    display: none;
}

.modal-progress .progress-container {
    padding: 0;
    margin: 0;
    gap: 0.5rem;
    align-items: center;
}

.modal-progress .progress-ring {
    width: 24px;
    height: 24px;
}

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

.modal-progress .pattern-progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Footer */
.footer {
    background: var(--bg-tertiary);
    padding: var(--spacing-2xl) 0 var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

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

.footer-section h4 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.footer-section p {
    color: var(--text-secondary);
    margin-bottom: 0;
}

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

.footer-section li {
    margin-bottom: var(--spacing-xs);
}

.footer-section a {
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.footer-section a:hover {
    color: var(--primary-color);
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-title {
        font-size: var(--font-size-3xl);
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .pattern-showcase {
        grid-template-columns: 1fr;
        transform: none;
    }
    
    .pattern-card:nth-child(2),
    .pattern-card:nth-child(3) {
        transform: none;
    }
    
    .nav-menu {
        display: none;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .playground-editors {
        grid-template-columns: 1fr;
    }
    
    .editor-container {
        border-right: none;
        border-bottom: 1px solid var(--border-light);
    }
    
    .playground-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .patterns-grid {
        grid-template-columns: 1fr;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: var(--spacing-2xl) 0;
    }
    
    .hero-title {
        font-size: var(--font-size-2xl);
    }
    
    .hero-actions {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .pattern-categories {
        flex-direction: column;
    }
    
    .category-btn {
        width: 100%;
    }
}

/* Output Styles */
.output-line {
    margin-bottom: var(--spacing-xs);
    padding: var(--spacing-xs) 0;
    border-left: 3px solid transparent;
    padding-left: var(--spacing-sm);
}

.output-success {
    color: var(--secondary-color);
    border-left-color: var(--secondary-color);
}

.output-error {
    color: var(--warning-color);
    border-left-color: var(--warning-color);
}

.output-info {
    color: var(--text-secondary);
    border-left-color: var(--text-secondary);
}

/* Modal Styles */
.pattern-content {
    max-width: 800px;
}

.pattern-overview {
    margin-bottom: var(--spacing-xl);
}

.pattern-header-modal {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.pattern-icon-large {
    font-size: var(--font-size-4xl);
}

.pattern-badges {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
}

.badge {
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.badge-category {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.badge-difficulty {
    color: white;
}

.badge-easy {
    background: var(--secondary-color);
}

.badge-medium {
    background: var(--accent-color);
}

.badge-hard {
    background: var(--warning-color);
}

.pattern-sections {
    display: grid;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.pattern-section h4 {
    margin-bottom: var(--spacing-sm);
    color: var(--text-primary);
}

.pattern-implementation {
    margin-bottom: var(--spacing-2xl);
}

.implementation-tabs {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
}

.tab-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
}

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

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.code-example {
    background: var(--bg-code);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.code-example pre {
    margin: 0;
    padding: var(--spacing-lg);
    overflow-x: auto;
}

.code-example code {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.diagram-container {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    text-align: center;
}

.examples-grid {
    display: grid;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

.example-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    border: 1px solid var(--border-light);
}

.example-card h5 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.example-card p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.example-code {
    background: var(--bg-code);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.example-code pre {
    margin: 0;
    padding: var(--spacing-md);
    overflow-x: auto;
}

.example-code code {
    font-family: var(--font-family-mono);
    font-size: var(--font-size-sm);
    line-height: 1.4;
}

/* Search Results */
.search-no-results {
    padding: var(--spacing-lg);
    text-align: center;
    color: var(--text-muted);
}

.search-result-item {
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition-fast);
}

.search-result-item:hover {
    background: var(--bg-hover);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.search-result-category {
    font-size: var(--font-size-sm);
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.search-result-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: var(--text-inverse);
    padding: 8px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    z-index: 1000;
    transition: var(--transition-fast);
}

.skip-link:focus {
    top: 6px;
}

/* Keyboard Navigation */
.keyboard-navigation *:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Mobile Menu */
@media (max-width: 768px) {
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-card);
        border-top: 1px solid var(--border-light);
        flex-direction: column;
        align-items: stretch;
        padding: var(--spacing-lg);
        gap: var(--spacing-md);
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: var(--transition-normal);
    }
    
    .nav-menu.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-link {
        padding: var(--spacing-sm) 0;
        text-align: center;
    }
    
    .hamburger.active::before {
        transform: rotate(45deg);
        top: 0;
    }
    
    .hamburger.active::after {
        transform: rotate(-45deg);
        top: 0;
    }
    
    .hamburger.active {
        background: transparent;
    }
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .playground-section {
        display: none;
    }
    
    .main {
        padding-top: 0;
    }
    
    .hero {
        padding: var(--spacing-lg) 0;
    }
    
    .pattern-card-full {
        break-inside: avoid;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border-light: #000000;
        --border-medium: #000000;
        --shadow-md: 0 0 0 1px #000000;
        --shadow-lg: 0 0 0 2px #000000;
    }
}

/* Focus indicators */
button:focus,
input:focus,
select:focus,
textarea:focus,
a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Enhanced Hero Section */
.hero-stats {
    display: flex;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-2xl);
    flex-wrap: wrap;
}

.stat-item {
    text-align: center;
    background: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    min-width: 100px;
}

.stat-number {
    display: block;
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

.stat-label {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

/* Introduction Section */
.introduction-section {
    padding: var(--spacing-3xl) 0;
    background: var(--bg-primary);
}

.introduction-content {
    max-width: 1000px;
    margin: 0 auto;
}

.intro-text {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xl);
    line-height: 1.7;
}

.pattern-categories-intro {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-2xl);
    margin: var(--spacing-2xl) 0;
}

.category-intro {
    background: var(--bg-card);
    padding: var(--spacing-xl);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    text-align: center;
}

.category-icon {
    font-size: var(--font-size-4xl);
    margin-bottom: var(--spacing-lg);
}

.category-intro h4 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

.category-intro p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

.importance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-xl);
    margin: var(--spacing-2xl) 0;
}

.importance-item {
    background: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: var(--transition-normal);
}

.importance-item:hover {
    box-shadow: var(--shadow-md);
}

.importance-icon {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--spacing-md);
}

.importance-item h4 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.importance-item p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.learning-path {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin: var(--spacing-2xl) 0;
}

.path-step {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    background: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.step-number {
    background: var(--primary-color);
    color: var(--text-inverse);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--font-size-lg);
    flex-shrink: 0;
}

.step-content h4 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.step-content p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

/* Enhanced Features Section */
.feature-details {
    text-align: left;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-light);
}

.feature-details h4 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-base);
}

.feature-details ul {
    list-style: none;
    padding: 0;
}

.feature-details li {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-sm);
    position: relative;
    padding-left: var(--spacing-md);
}

.feature-details li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--secondary-color);
    font-weight: 700;
}

/* Enhanced Pattern Cards */
.pattern-examples {
    padding: 0 var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
}

.pattern-examples h4 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-base);
}

.pattern-examples ul {
    list-style: none;
    padding: 0;
}

.pattern-examples li {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
    font-size: var(--font-size-sm);
    padding-left: var(--spacing-md);
}

/* Enhanced Playground Section */
.playground-intro {
    margin-bottom: var(--spacing-2xl);
}

.playground-intro h3 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.playground-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
}

.step-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-md);
    background: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: left;
}

.step-icon {
    font-size: var(--font-size-2xl);
    flex-shrink: 0;
}

.step-text h4 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.step-text p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

/* Enhanced About Section */
.about-section {
    padding: var(--spacing-3xl) 0;
    background: var(--bg-primary);
}

.about-content {
    max-width: 1000px;
    margin: 0 auto;
}

.about-text h3 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    margin-top: var(--spacing-2xl);
}

.about-text h3:first-child {
    margin-top: 0;
}

.about-text p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--spacing-lg);
}

.about-text ul {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--spacing-lg);
    padding-left: var(--spacing-lg);
}

.about-text li {
    margin-bottom: var(--spacing-sm);
}

.learning-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-xl);
    margin: var(--spacing-2xl) 0;
}

.feature-item {
    background: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.feature-item .feature-icon {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--spacing-md);
}

.feature-item h4 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.feature-item p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.target-audience {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    margin: var(--spacing-2xl) 0;
}

.audience-group {
    background: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.audience-group h4 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.audience-group p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

.learning-paths {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
    margin: var(--spacing-2xl) 0;
}

.path-option {
    background: var(--bg-card);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--primary-color);
}

.path-option h4 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.path-option p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

/* Mobile Responsive Enhancements */
@media (max-width: 768px) {
    .hero-stats {
        justify-content: center;
        gap: var(--spacing-md);
    }
    
    .stat-item {
        min-width: 80px;
        padding: var(--spacing-md);
    }
    
    .pattern-categories-intro {
        grid-template-columns: 1fr;
    }
    
    .importance-grid {
        grid-template-columns: 1fr;
    }
    
    .learning-path {
        grid-template-columns: 1fr;
    }
    
    .playground-steps {
        grid-template-columns: 1fr;
    }
    
    .learning-features {
        grid-template-columns: 1fr;
    }
    
    .target-audience {
        grid-template-columns: 1fr;
    }
    
    .learning-paths {
        grid-template-columns: 1fr;
    }
}

/* Modal Content Styling */
.modal .modal-body {
    padding: 2rem;
    overflow-y: auto;
    line-height: 1.7;
    font-size: 1rem;
}

.modal .modal-body h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    margin-top: 0;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.modal .modal-body h2 {
    font-size: 2rem;
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    padding-top: 1rem;
}

.modal .modal-body h3 {
    font-size: 1.5rem;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    color: var(--primary-color);
    padding-top: 0.5rem;
}

.modal .modal-body h4 {
    font-size: 1.25rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

.modal .modal-body h5 {
    font-size: 1.1rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.modal .modal-body p {
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    line-height: 1.7;
}

.modal .modal-body ul,
.modal .modal-body ol {
    margin-bottom: 1.5rem;
    margin-top: 0.5rem;
    padding-left: 2rem;
}

.modal .modal-body li {
    margin-bottom: 0.75rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.modal .modal-body blockquote {
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    font-style: italic;
    color: var(--text-muted);
    line-height: 1.6;
}

.modal .modal-body pre {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
    border: 1px solid var(--border-light);
    line-height: 1.5;
}

.modal .modal-body code {
    background: var(--bg-secondary);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.modal .modal-body pre code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    color: var(--text-primary);
}

.modal .modal-body strong {
    color: var(--primary-color);
    font-weight: 600;
}

.modal .modal-body em {
    color: var(--text-muted);
    font-style: italic;
}

.modal .modal-body a {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.modal .modal-body a:hover {
    border-bottom-color: var(--primary-color);
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.loading::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 1rem;
}

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

/* Error State */
.error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
    color: var(--warning-color);
    font-size: 1.1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--warning-color);
}

.error::before {
    content: '⚠️';
    font-size: 1.5rem;
    margin-right: 1rem;
}

/* Improved scrollbar for modal content */
.modal .modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal .modal-body::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

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

.modal .modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Responsive modal content */
@media (max-width: 768px) {
    .modal .modal-body {
        padding: 1rem;
    }
    
    .modal .modal-body h1 {
        font-size: 2rem;
    }
    
    .modal .modal-body h2 {
        font-size: 1.5rem;
    }
    
    .modal .modal-body h3 {
        font-size: 1.25rem;
    }
    
    .modal .modal-body pre {
        padding: 1rem;
        font-size: 0.9rem;
    }
    
    .modal .modal-body ul,
    .modal .modal-body ol {
        padding-left: 1.5rem;
    }
}

/* Additional content structure styling */
.modal .modal-body h2:not(:first-child) {
    border-top: 1px solid var(--border-light);
    padding-top: 2rem;
    margin-top: 4rem;
}

.modal .modal-body h3:not(:first-child) {
    margin-top: 3rem;
}

/* Better list styling */
.modal .modal-body ol {
    counter-reset: list-counter;
}

.modal .modal-body ol > li {
    counter-increment: list-counter;
    position: relative;
    padding-left: 0.5rem;
}

.modal .modal-body ol > li::marker {
    content: counter(list-counter) ". ";
    font-weight: 600;
    color: var(--primary-color);
}

.modal .modal-body ul > li::marker {
    content: "• ";
    color: var(--primary-color);
    font-size: 1.2em;
}

/* Pedagogical Modal Styling - Full Screen */
.pattern-learning-container {
    padding: 0;
    max-width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1 1 auto;
    min-height: 0;
}

/* Override modal body padding for new layout */
.modal .modal-body:has(.pattern-learning-container) {
    padding: 0;
    overflow: hidden;
}

/* Tab content container - Full Height */
.tab-content-container {
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

/* Minimal Pattern Hero Section */
.pattern-overview-section {
    display: none;
}

.pattern-overview-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
}

.pattern-hero {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 2rem;
    align-items: center;
}

.pattern-icon-large {
    font-size: 3.5rem;
    background: var(--bg-card);
    padding: 1.5rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    height: 100px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    position: relative;
}

.pattern-icon-large::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    border-radius: 20px;
    z-index: -1;
    opacity: 0.2;
}

.pattern-meta h1 {
    margin: 0 0 0.75rem 0;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    border: none;
    padding: 0;
}

.pattern-badges {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.375rem 0.875rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    backdrop-filter: blur(10px);
}

.badge-creational {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.1) 100%);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-structural {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.1) 100%);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-behavioral {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15) 0%, rgba(168, 85, 247, 0.1) 100%);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-difficulty-easy {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.1) 100%);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-difficulty-medium {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.15) 0%, rgba(251, 191, 36, 0.1) 100%);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge-difficulty-hard {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.1) 100%);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.pattern-tagline {
    font-size: 1.125rem;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 600px;
}

/* Always-Visible Tab Navigation - Force Visibility */
.pattern-tabs {
    display: flex !important;
    gap: 0.125rem;
    margin: 0;
    background: var(--bg-primary);
    padding: 0.25rem 1rem;
    border-radius: 0;
    position: sticky;
    top: 0;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-light);
    min-height: 40px;
    align-items: center;
    z-index: 100;
    visibility: visible !important;
    opacity: 1 !important;
}

.tab-button {
    flex: 1;
    padding: 0.375rem 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 0.8125rem;
    border-radius: 4px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 30px;
    visibility: visible !important;
    opacity: 1 !important;
}

.tab-icon {
    font-size: 1.125rem;
    transition: transform 0.3s ease;
}

.tab-button:hover {
    color: var(--text-primary);
}

.tab-button:hover .tab-icon {
    transform: scale(1.05);
}

.tab-button.active {
    background: var(--bg-card);
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.tab-button.active .tab-icon {
    transform: scale(1.1);
}

/* Tab Progress Indicator */
.tab-progress {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.tab-progress-bar {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.tab-button.completed .tab-progress-bar {
    width: 100%;
}

/* Tab Content - Full Available Height */
.tab-content {
    display: none;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 1rem;
    min-height: 0;
    scroll-behavior: smooth;
}

.tab-content.active {
    display: flex !important;
    flex-direction: column;
    animation: fadeInUp 0.3s ease;
    visibility: visible !important;
    opacity: 1 !important;
    height: 100%;
    flex: 1 1 auto;
}

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

/* Overview Tab Styling - Full Height */
.overview-content {
    padding: 0 0 2rem 0;
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
}

.pattern-intro {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 1rem;
}

.pattern-intro h2 {
    margin: 0 0 0.75rem 0;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.pattern-badges-overview {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.pattern-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

.quick-summary {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary-color);
}

.quick-summary h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.summary-text {
    font-size: 1rem;
    line-height: 1.6;
    margin: 0;
}

.concept-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.concept-card {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.concept-card:hover {
    box-shadow: var(--shadow-lg);
}

.concept-card h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.problem-card {
    border-left: 4px solid #ef4444;
}

.solution-card {
    border-left: 4px solid #22c55e;
}

.example-card {
    border-left: 4px solid #3b82f6;
}

.when-to-use {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    margin-bottom: 2rem;
}

.when-to-use h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.use-cases {
    display: grid;
    gap: 0.5rem;
}

.use-case {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-card);
    border-radius: 6px;
    border: 1px solid var(--border-light);
}

.use-case-icon {
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 1.125rem;
}

/* Learning Tab Styling - Fixed Navigation */
.learn-content {
    padding: 0;
    max-width: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.learning-path {
    max-width: 100%;
    margin: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0;
    position: relative;
}

/* Minimal Step Navigation - Simplified for all screen sizes */
.step-navigation-top {
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-tertiary);
    padding: 0.5rem 1rem;
    border-radius: 0;
    margin-bottom: 0;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    min-height: 40px;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Hide the traditional progress section */
.step-progress {
    display: none;
}

.step-counter {
    display: none;
}

.step-title {
    display: none;
}

/* Centered controls with integrated step info */
.step-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    position: relative;
}

/* Step info displayed between buttons */
.step-controls::before {
    content: attr(data-step-info);
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
    order: 1;
    padding: 0 0.5rem;
}

.prev-step {
    order: 0;
}

.next-step {
    order: 2;
}

.step-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
    min-height: 32px;
}

.step-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.prev-step {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.prev-step:not(:disabled):hover {
    background: var(--bg-tertiary);
}

.next-step {
    background: var(--primary-color);
    color: white;
}

.next-step:not(:disabled):hover {
    background: var(--primary-dark);
}

/* Full Height Step Content - Only for modal content */
.modal .step-content {
    display: none;
    background: var(--bg-card);
    padding: 0.75rem 1rem 1.5rem;
    border-radius: 0;
    border: none;
    width: 100%;
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.6;
    height: 100%;
    min-height: 100%;
}

.modal .step-content.active {
    display: block;
    animation: fadeInUp 0.3s ease;
}

.modal .step-content h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
}

.step-explanation {
    margin-top: 0;
}

.step-explanation > p:first-child {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* Minimal Bottom Progress Bar */
.step-progress-bottom {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-light);
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.progress-dot.active {
    background: var(--primary-color);
    transform: scale(1.3);
}

.progress-dot:hover {
    background: var(--primary-color);
    opacity: 0.7;
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.progress-dot.active {
    background: var(--primary-color);
    transform: scale(1.2);
}

.progress-dot:hover {
    background: var(--primary-color);
    opacity: 0.7;
}

/* Ultra-Compact Problem/Implementation Examples */
.problem-example,
.implementation-example {
    margin: 1rem 0;
    padding: 1rem;
    border-radius: 6px;
    border: none;
    border-left: 3px solid;
    overflow: visible;  /* Changed to visible for header buttons */
    font-size: 0.9375rem;
    line-height: 1.5;
}

.problem-example {
    background: rgba(239, 68, 68, 0.05);
    border-left: 4px solid #ef4444;
}

.implementation-example {
    background: rgba(34, 197, 94, 0.05);
    border-left: 4px solid #22c55e;
}

.problem-example > h4,
.problem-example .example-header > h4 {
    color: #dc2626;
    margin: 0 0 0.75rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.implementation-example > h4,
.implementation-example .example-header > h4 {
    color: #16a34a;
    margin: 0 0 0.75rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

/* When inside example-header, remove bottom margin */
.problem-example .example-header > h4,
.implementation-example .example-header > h4 {
    margin-bottom: 0;
}

.problem-example p,
.implementation-example p {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.problem-example ul,
.implementation-example ul {
    margin: 1rem 0 0 0;
    padding-left: 1.5rem;
}

.problem-example li {
    color: var(--text-primary);
    font-weight: 500;
    margin: 0.5rem 0;
}

.problem-example li::marker {
    color: #dc2626;
}

.implementation-example li {
    color: var(--text-primary);
    font-weight: 500;
    margin: 0.5rem 0;
}

.implementation-example li::marker {
    color: #16a34a;
}

/* Code blocks in examples */
.problem-example pre,
.implementation-example pre {
    margin: 1rem 0;
    border-radius: 8px;
    overflow-x: auto;
    background: var(--bg-code) !important;
}

.problem-example code,
.implementation-example code {
    font-size: 0.875rem !important;
    line-height: 1.6 !important;
}

/* Practice Tab Styling */
.practice-content {
    padding: 0;
    flex: 1;
    overflow-y: auto;
}

.practice-scenario {
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.scenario-description {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.scenario-description h4 {
    margin-top: 0;
    color: var(--primary-color);
}

.code-playground {
    padding: 1rem;
}

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

.playground-header h4 {
    margin: 0;
    color: var(--text-primary);
}

.language-selector {
    display: flex;
    gap: 0.5rem;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lang-btn.active,
.lang-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.code-editor {
    margin: 1rem 0;
}

.code-input {
    width: 100%;
    height: 300px;
    padding: 1rem;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    resize: vertical;
}

.playground-actions {
    display: flex;
    gap: 1rem;
    margin: 1rem 0;
}

.output-section h5 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.output-console {
    background: var(--bg-code);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1rem;
    font-family: var(--font-family-mono);
    font-size: 0.875rem;
    line-height: 1.5;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 1rem;
    color: var(--text-primary);
}

.output-line {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    animation: fadeInUp 0.3s ease;
}

.output-line:last-child {
    border-bottom: none;
}

.output-log {
    color: var(--text-primary);
}

.output-success {
    color: var(--success-color);
    background: rgba(34, 197, 94, 0.1);
    border-radius: 4px;
    padding: 0.5rem;
    margin: 0.25rem 0;
}

.output-error {
    color: var(--warning-color);
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    padding: 0.5rem;
    margin: 0.25rem 0;
}

.output-warn {
    color: #f59e0b;
    background: rgba(251, 191, 36, 0.1);
    border-radius: 4px;
    padding: 0.5rem;
    margin: 0.25rem 0;
}

.output-placeholder {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    border: 2px dashed var(--border-light);
}

.output-console::-webkit-scrollbar {
    width: 8px;
}

.output-console::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.output-console::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

.output-console::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Enhanced run button styling */
.run-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.run-btn:hover {
    background: #16a34a;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.run-btn:active {
    transform: translateY(0);
}

/* Reset button styling */
.reset-btn {
    background: var(--text-secondary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reset-btn:hover {
    background: #4b5563;
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.reset-btn:active {
    transform: translateY(0);
}

.output-placeholder {
    color: var(--text-muted);
    font-style: italic;
}

/* Examples Tab Styling */
.examples-content {
    padding: 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.example-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.example-card:hover {
    box-shadow: var(--shadow-lg);
}

.example-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    gap: 0.5rem;
}

.example-header h4 {
    margin: 0;
    color: var(--primary-color);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.example-category {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    flex-shrink: 0;
}

.example-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

/* Best Practices Styling */
.best-practices {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.best-practices h4 {
    margin-top: 0;
    color: var(--primary-color);
}

.practices-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.practices-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border-light);
}

.practice-icon {
    color: var(--secondary-color);
    font-size: 1.125rem;
    margin-top: 0.125rem;
}

/* Complete Example Styling */
.complete-example {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

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

.complete-example .example-header h4 {
    margin: 0;
    flex: 1;
}

.code-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.code-tab {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-light);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.code-example-js,
.code-example-php {
    display: none;
}

.code-example-js.active,
.code-example-php.active {
    display: block;
}

/* Responsive Design */
/* This duplicate mobile media query is removed - enhanced version is below */

/* ... existing code ... */

/* Achievement Notification */
.achievement-notification {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--bg-card);
    border: 2px solid var(--primary-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-xl);
    transform: translateX(calc(100% + 2rem));
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: var(--z-tooltip);
    max-width: 350px;
}

.achievement-notification.show {
    transform: translateX(0);
}

.achievement-icon {
    font-size: 3rem;
    animation: bounceIn 0.6s ease;
}

.achievement-content h4 {
    margin: 0 0 0.25rem 0;
    color: var(--primary-color);
    font-size: 1.125rem;
}

.achievement-content p {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
}

.achievement-content small {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Celebration Overlay */
.celebration-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    animation: fadeIn 0.3s ease;
}

.celebration-overlay.fade-out {
    animation: fadeOut 0.5s ease;
}

.celebration-content {
    text-align: center;
    color: white;
    position: relative;
    z-index: 2;
}

.celebration-content h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    animation: scaleIn 0.5s ease;
}

.celebration-content p {
    font-size: 1.5rem;
    color: white;
    animation: slideUp 0.5s ease 0.2s both;
}

/* Confetti Animation */
.confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f0f;
    animation: confettiFall 3s linear infinite;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* Interactive Code Editor */
.interactive-code {
    width: 100%;
    min-height: 200px;
    padding: 1rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    background: var(--bg-code);
    color: var(--code-text);
    font-family: var(--font-family-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.3s ease;
}

.interactive-code:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.code-feedback {
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.code-feedback.success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.code-feedback.hint {
    background: rgba(251, 191, 36, 0.1);
    color: #f59e0b;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.code-feedback.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--warning-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Progress Ring */
.progress-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-ring__circle {
    stroke: var(--border-light);
    fill: transparent;
}

.progress-ring__circle--progress {
    stroke: var(--primary-color);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

.progress-stats {
    flex: 1;
}

.progress-stats h3 {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.pattern-progress-text {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Learning Objectives */
.learning-objectives {
    background: var(--bg-secondary);
    border: 2px dashed var(--primary-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.learning-objectives h3 {
    margin-top: 0;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.learning-objectives ul {
    margin: 0;
    padding-left: 1.5rem;
}

.learning-objectives li {
    margin: 0.5rem 0;
    position: relative;
}

.learning-objectives li::marker {
    content: "🎯 ";
}

/* Interactive Quiz */
.quiz-container {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.quiz-question {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.quiz-option {
    padding: 1rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.quiz-option:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-color);
}

.quiz-option.selected {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.1);
}

.quiz-option.correct {
    border-color: var(--success-color);
    background: rgba(34, 197, 94, 0.1);
}

.quiz-option.incorrect {
    border-color: var(--warning-color);
    background: rgba(239, 68, 68, 0.1);
}

.quiz-feedback {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    display: none;
}

.quiz-feedback.show {
    display: block;
    animation: slideUp 0.3s ease;
}

/* Enhanced Step Navigation */
.step-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.step-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-light);
    transition: all 0.3s ease;
}

.step-dot.active {
    background: var(--primary-color);
    transform: scale(1.3);
}

.step-dot.completed {
    background: var(--success-color);
}

.step-line {
    flex: 1;
    height: 2px;
    background: var(--border-light);
    transition: background 0.3s ease;
}

.step-line.completed {
    background: var(--success-color);
}

/* Responsive Enhancements */
/* This duplicate mobile media query is removed - enhanced version is above */

/* Implementation viewing styles */
.example-actions {
    margin-top: 15px;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.view-implementation-btn {
    padding: 8px 16px;
    border: 1px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.view-implementation-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
}

.view-implementation-btn.active {
    background: var(--primary-color);
    color: white;
}

.view-implementation-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #999;
    border-color: #ccc;
}

.implementation-code {
    margin-top: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-dark);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.implementation-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.implementation-header h5 {
    margin: 0;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.implementation-code pre {
    margin: 0;
    padding: 20px;
    background: #1e1e1e;
    overflow-x: auto;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.implementation-code code {
    background: none;
    padding: 0;
    color: #d4d4d4;
    white-space: pre;
    overflow-x: auto;
    display: block;
}

/* Syntax highlighting for dark theme */
.implementation-code .comment {
    color: #6a9955;
    font-style: italic;
}

.implementation-code .keyword {
    color: #569cd6;
    font-weight: bold;
}

.implementation-code .string {
    color: #ce9178;
}

.implementation-code .function {
    color: #dcdcaa;
}

.implementation-code .number {
    color: #b5cea8;
}

.implementation-code .operator {
    color: #d4d4d4;
}

.implementation-code .punctuation {
    color: #d4d4d4;
}

/* Copy button styling for dark theme */
.btn-small {
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Responsive adjustments for implementation code */
@media (max-width: 768px) {
    .implementation-code pre {
        font-size: 12px;
        padding: 15px;
    }
    
    .implementation-header {
        padding: 10px 12px;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .view-implementation-btn {
        width: 100%;
        padding: 10px;
    }
}

/* Enhanced example card styling for dark theme */
.example-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.example-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

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

.example-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.example-category {
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.example-description {
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 15px;
}

/* Loading animation for implementation content */
.implementation-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.implementation-loading::before {
    content: "⏳";
    font-size: 24px;
    display: block;
    margin-bottom: 10px;
    animation: spin 2s linear infinite;
}

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

/* Success feedback for copy action */
.copy-success {
    background: #28a745 !important;
    color: white !important;
    border-color: #28a745 !important;
}

/* Enhanced scrollbar for code blocks - dark theme */
.implementation-code pre::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.implementation-code pre::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.implementation-code pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.implementation-code pre::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Fullscreen overlay for implementation examples */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: var(--z-modal);
    animation: fadeIn 0.3s ease;
}

.fullscreen-content {
    width: 95%;
    height: 95%;
    max-width: 1400px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg) var(--spacing-xl);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.fullscreen-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: var(--font-size-lg);
}

.fullscreen-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.fullscreen-close {
    background: var(--warning-color) !important;
    color: white !important;
}

.fullscreen-close:hover {
    background: #dc2626 !important;
}

.fullscreen-code-container {
    flex: 1;
    overflow: auto;
    padding: var(--spacing-lg);
}

.fullscreen-code-container pre {
    margin: 0;
    height: 100%;
    background: var(--bg-code);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    font-family: var(--font-family-mono);
    font-size: 0.75rem;  /* Reduced from 1rem for better fullscreen visibility */
    line-height: 1.4;  /* Tighter line height */
    overflow: auto;
    color: #e2e8f0;
}

.fullscreen-code-container code {
    font-family: var(--font-family-mono);
    font-size: 0.75rem;  /* Match pre font size */
    line-height: 1.4;
    white-space: pre;
    color: inherit;
}

/* Implementation actions container */
.implementation-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

/* Fullscreen implementation view styles for all devices */
.implementation-view.fullscreen pre,
.modal-content.fullscreen pre,
.learn-content.fullscreen pre,
.problem-example.fullscreen pre,
.implementation-example.fullscreen pre {
    font-size: 0.75rem;
    line-height: 1.4;
}

.implementation-view.fullscreen code,
.modal-content.fullscreen code,
.learn-content.fullscreen code,
.problem-example.fullscreen code,
.implementation-example.fullscreen code {
    font-size: 0.75rem;
    line-height: 1.4;
}

/* Prevent body scrolling when fullscreen is active */
body.fullscreen-active {
    overflow: hidden;
}

/* Responsive adjustments for fullscreen */
@media (max-width: 768px) {
    .fullscreen-content {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .fullscreen-header {
        padding: var(--spacing-md);
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: flex-start;
    }
    
    .fullscreen-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .fullscreen-code-container {
        padding: var(--spacing-md);
    }
    
    .fullscreen-code-container pre {
        font-size: 0.625rem;  /* Smaller text for mobile fullscreen */
        line-height: 1.3;
        padding: var(--spacing-sm);
    }
    
    .fullscreen-code-container code {
        font-size: 0.625rem;  /* Smaller text for mobile fullscreen */
    }
    
    /* Smaller text for modal fullscreen code on mobile */
    body.modal-open .modal-content pre code {
        font-size: 0.625rem;
        line-height: 1.3;
    }
    
    body.modal-open .modal-content .code-container pre {
        font-size: 0.625rem;
        padding: var(--spacing-sm);
    }
    
    /* Fullscreen implementation example on mobile */
    body.modal-open .implementation-view.fullscreen pre {
        font-size: 0.625rem;
        line-height: 1.3;
        padding: var(--spacing-sm);
    }
    
    body.modal-open .implementation-view.fullscreen code {
        font-size: 0.625rem;
    }
    
    /* Learn content fullscreen code on mobile */
    body.modal-open .learn-content.fullscreen pre,
    body.modal-open .problem-example.fullscreen pre,
    body.modal-open .implementation-example.fullscreen pre {
        font-size: 0.625rem;
        line-height: 1.3;
        padding: var(--spacing-sm);
    }
    
    body.modal-open .learn-content.fullscreen code,
    body.modal-open .problem-example.fullscreen code,
    body.modal-open .implementation-example.fullscreen code {
        font-size: 0.625rem;
    }
    
    /* Ensure code containers don't overflow on mobile */
    .code-container {
        max-width: 100%;
        overflow-x: auto;
    }
    
    .code-container pre {
        overflow-x: auto;
        max-width: 100%;
    }
    
    /* Fix any pre/code blocks in step content */
    .step-content pre {
        max-width: 100%;
        overflow-x: auto;
        font-size: 0.75rem;
    }
    
    .step-content code {
        font-size: 0.75rem;
    }
}

/* Keyboard support for fullscreen */
.fullscreen-overlay:focus {
    outline: none;
}

/* Ensure all code in fullscreen overlay is smaller */
.fullscreen-overlay pre,
.fullscreen-overlay code {
    font-size: 0.75rem !important;
    line-height: 1.4 !important;
}

/* Animation for fullscreen */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Enhanced Mobile Responsiveness for Learn and Examples Sections */
@media (max-width: 768px) {
    /* Global overflow prevention */
    * {
        max-width: 100%;
    }
    
    /* DEBUG: Force fullscreen buttons to be visible in Learn section */
    .problem-example .btn-small[onclick*="toggleLearnFullscreen"],
    .implementation-example .btn-small[onclick*="toggleLearnFullscreen"],
    .complete-example .btn-small[onclick*="toggleLearnFullscreen"] {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        background: #4a5568 !important;
        color: white !important;
        border: 2px solid #2d3748 !important;
        padding: 0.25rem 0.5rem !important;
        font-size: 0.75rem !important;
        border-radius: 4px !important;
        cursor: pointer !important;
        z-index: 999 !important;
        position: relative !important;
        min-width: fit-content !important;
        width: auto !important;
        height: auto !important;
        margin: 0 !important;
        flex-shrink: 0 !important;
    }
    
    /* Ensure all containers respect boundaries */
    div, section, article, aside {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Modal and Full-Screen Adjustments */
    .modal {
        padding: 0;
        margin: 0;
        overflow-x: hidden;
    }
    
    .modal-content {
        border-radius: 0;
        height: 100vh;
        width: 100vw;
        max-width: 100vw;
        margin: 0;
        display: flex;
        flex-direction: column;
        overflow-x: hidden;
    }
    
    .modal-header {
        padding: 0.5rem 0.75rem;
        min-height: 48px;
        max-height: 48px;
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px solid var(--border-light);
    }
    
    .modal-title {
        font-size: 1.125rem;
        font-weight: 600;
        line-height: 1;
        margin: 0;
        flex: 1;
    }
    
    .modal-close {
        width: 36px;
        height: 36px;
        font-size: 1.25rem;
        flex-shrink: 0;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .modal-body {
        padding: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
        min-height: 0;
        position: relative;
    }
    
    /* Pattern Hero Section Mobile - Compact */
    .pattern-hero {
        padding: 0.75rem;
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
        background: var(--bg-secondary);
        border-bottom: 1px solid var(--border-light);
    }
    
    .pattern-icon-large {
        font-size: 2rem;
        width: 40px;
        height: 40px;
        margin: 0;
        flex-shrink: 0;
    }
    
    .pattern-meta {
        flex: 1;
        text-align: left;
    }
    
    .pattern-meta h1 {
        font-size: 1.25rem;
        line-height: 1.2;
        margin-bottom: 0.25rem;
    }
    
    .pattern-tagline {
        font-size: 0.875rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
        color: var(--text-secondary);
    }
    
    .pattern-badges {
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .badge {
        font-size: 0.75rem;
        padding: 0.125rem 0.5rem;
    }
    
    /* Tab Navigation Mobile - Ultra Compact */
    .pattern-tabs {
        display: flex;
        gap: 0;
        padding: 0;
        border-bottom: 1px solid var(--border-light);
        background: var(--bg-card);
        position: sticky;
        top: 0;
        z-index: 10;
        height: 44px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab-button {
        flex: 1;
        min-width: 0;
        max-width: none;
        padding: 0 0.75rem;
        font-size: 0.8125rem;
        text-align: center;
        border-radius: 0;
        border-bottom: 2px solid transparent;
        background: transparent;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
        height: 44px;
        white-space: nowrap;
    }
    
    .tab-button.active {
        border-bottom-color: var(--primary-color);
        background: rgba(99, 102, 241, 0.05);
        color: var(--primary-color);
    }
    
    .tab-icon {
        font-size: 1rem;
        margin-bottom: 0;
    }
    
    /* Show only icon and first word of tab text on mobile */
    .tab-button {
        flex-direction: row;
    }
    
    .tab-button span {
        font-size: 0.75rem;
        margin-left: 0.25rem;
    }
    
    /* Tab Content Mobile - Full Width */
    .tab-content {
        padding: 0;
        min-height: calc(100vh - 140px); /* header + hero + tabs */
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        position: relative;
    }
    
    .tab-content.active {
        display: block;
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    .tab-content-container {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
        overflow-x: hidden;
        position: relative;
    }
    
    /* Ensure tab content children don't overflow */
    .tab-content > * {
        max-width: 100%;
        overflow-x: hidden;
    }
    
    /* Overview Content Mobile */
    .overview-content {
        padding: 1rem;
        width: 100%;
    }
    
    .pattern-intro h2 {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    .pattern-description {
        font-size: 0.9375rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }
    
    .concept-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        width: 100%;
    }
    
    .concept-card {
        padding: 1rem;
        border-radius: 8px;
        margin: 0;
        width: 100%;
    }
    
    .concept-card h4 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .concept-card p {
        font-size: 0.875rem;
        line-height: 1.4;
    }
    
    /* Learn Content Mobile - Compact Navigation */
    .learn-content {
        padding: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    /* Mobile step navigation inherits simplified desktop styles */
    .step-navigation-top {
        top: 44px; /* height of tabs on mobile */
    }
    
    .step-btn:disabled {
        opacity: 0.4;
    }
    
    /* Step Content Mobile - Optimized for Space */
    .modal .step-content {
        padding: 1rem;
        min-height: auto;
        width: 100%;
    }
    
    .modal .step-content h3 {
        font-size: 1.125rem;
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }
    
    .step-explanation {
        font-size: 0.9375rem;
        line-height: 1.5;
        margin-bottom: 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-wrap: break-word;
    }
    
    /* Problem and Implementation Examples Mobile - Compact */
    .problem-example,
    .implementation-example {
        padding: 0.75rem;
        margin: 0.75rem 0;
        border-radius: 8px;
        background: var(--bg-secondary);
        border-left: 3px solid var(--primary-color);
        width: 100%;
        overflow: visible !important;
    }
    
    /* Example headers in Learn section with fullscreen button */
    .problem-example .example-header,
    .implementation-example .example-header,
    .complete-example .example-header {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
        flex-wrap: nowrap;  /* Keep items on same line */
        gap: 0.5rem;
        width: 100%;
    }
    
    .problem-example .example-header h4,
    .implementation-example .example-header h4,
    .complete-example .example-header h4 {
        margin: 0 !important;
        flex: 1;
        min-width: 0;
        font-size: 1rem;  /* Smaller font size on mobile */
    }
    
    /* Make sure buttons are visible */
    .problem-example .btn-small,
    .implementation-example .btn-small,
    .complete-example .btn-small,
    .problem-example .example-header .btn-small,
    .implementation-example .example-header .btn-small,
    .complete-example .example-header .btn-small {
        display: inline-flex !important;
        white-space: nowrap;
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
        flex-shrink: 0;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative;
        z-index: 1;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-light);
        color: var(--text-primary);
        cursor: pointer;
        border-radius: 4px;
        align-items: center;
        justify-content: center;
        min-width: auto;
        height: auto;
        line-height: 1;
    }
    
    .problem-example > h4:not(.example-header h4),
    .implementation-example > h4:not(.example-header h4) {
        font-size: 0.9375rem;
        margin-bottom: 0.5rem;
        font-weight: 600;
    }
    
    /* Force example headers to display properly */
    .problem-example .example-header,
    .implementation-example .example-header,
    .complete-example .example-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-bottom: 0.75rem !important;
        gap: 0.5rem !important;
        width: 100% !important;
    }
    
    .problem-example .example-header h4,
    .implementation-example .example-header h4,
    .complete-example .example-header h4 {
        font-size: 0.9375rem !important;
        margin: 0 !important;
        flex: 1 !important;
    }
    
    .problem-example pre,
    .implementation-example pre {
        font-size: 0.75rem;
        line-height: 1.35;
        padding: 0.75rem;
        border-radius: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0;
        background: var(--bg-code);
    }
    
    .problem-example code,
    .implementation-example code {
        font-size: 0.75rem;
        font-family: var(--font-family-mono);
    }
    
    /* Practice Content Mobile */
    .practice-content {
        padding: 0;
    }
    
    .practice-scenario {
        margin-bottom: 1.5rem;
    }
    
    .scenario-description {
        padding: 1.25rem;
        background: var(--bg-secondary);
        border-radius: 12px;
        margin-bottom: 1rem;
    }
    
    .scenario-description h4 {
        font-size: 1.125rem;
        margin-bottom: 0.75rem;
    }
    
    /* Code Playground Mobile */
    .code-playground {
        border-radius: 12px;
        overflow: hidden;
    }
    
    .playground-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        padding: 1rem;
        background: var(--bg-tertiary);
    }
    
    .playground-header h4 {
        font-size: 1.125rem;
        margin: 0;
        text-align: center;
    }
    
    .language-selector {
        justify-content: center;
    }
    
    .lang-btn {
        flex: 1;
        max-width: 120px;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        border-radius: 8px;
    }
    
    .code-editor {
        background: var(--bg-code);
    }
    
    .code-input {
        height: 300px;
        font-size: 0.875rem;
        line-height: 1.4;
        padding: 1rem;
        border: none;
        border-radius: 0;
        resize: vertical;
        min-height: 250px;
    }
    
    .playground-actions {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 1rem;
        background: var(--bg-tertiary);
    }
    
    .run-btn,
    .reset-btn {
        flex: 1;
        min-width: 120px;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
        border-radius: 8px;
    }
    
    /* Output Section Mobile */
    .output-section {
        padding: 1rem;
        background: var(--bg-secondary);
    }
    
    .output-section h5 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .output-console {
        height: 200px;
        font-size: 0.875rem;
        line-height: 1.4;
        padding: 1rem;
        border-radius: 8px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .output-line {
        margin-bottom: 0.5rem;
        padding: 0.5rem 0;
        border-left: 3px solid transparent;
        padding-left: 0.75rem;
        word-break: break-word;
    }
    
    /* Examples Content Mobile - Full Width & Compact */
    .examples-content {
        padding: 0;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: auto;
        max-width: 100vw;
    }
    
    /* Add padding to the grid instead */
    .examples-grid {
        padding: 1rem;
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Ensure all children don't overflow */
    .examples-content * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Ensure implementation sections fit */
    .example-card .implementation-code {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Fix example card content */
    .example-card > * {
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
    
    /* Fix any grid containers inside example cards */
    .example-card [class*="grid"] {
        width: 100%;
        max-width: 100%;
        overflow: hidden;
    }
    
    /* Fix implementation containers specifically in examples */
    .example-card .implementation-code {
        margin: 0.75rem 0;
        width: 100%;
    }
    
    .example-card .implementation-header {
        width: 100%;
        overflow: hidden;
    }
    
    .example-card .implementation-code pre {
        max-width: 100%;
        overflow-x: auto;
    }
    
    /* Final overflow fixes for examples */
    .examples-content .example-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0;
        overflow: hidden !important;
    }
    
    .examples-content .example-grid,
    .examples-content [class*="example-grid"] {
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }
    
    /* Ensure no horizontal scroll on the examples tab */
    #examples,
    [id*="examples"] {
        overflow-x: hidden !important;
        max-width: 100% !important;
    }
    
    /* Fix flex container overflow issues */
    .example-card {
        flex-shrink: 1;
        min-width: 0;
    }
    
    .example-header {
        flex-wrap: wrap;
    }
    
    .example-header > * {
        min-width: 0;
    }
    
    /* Fix learn-content overflow issues */
    .learn-content * {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .learn-content .step-content {
        overflow-x: hidden;
    }
    
    .learn-content .problem-example,
    .learn-content .implementation-example {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
    
    /* Prevent any pre blocks from overflowing */
    .learn-content pre {
        max-width: 100%;
        overflow-x: auto;
        word-break: normal;
        white-space: pre;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        width: 100%;
        max-width: 100%;
    }
    
    .example-card {
        padding: 0.875rem;
        border-radius: 8px;
        background: var(--bg-card);
        border: 1px solid var(--border-light);
        width: 100%;
        max-width: 100%;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        box-sizing: border-box;
        overflow: hidden;
        position: relative;
        display: block;
    }
    
    .example-header {
        margin-bottom: 0.75rem;
    }
    
    .example-header h4 {
        font-size: 1rem;
        margin-bottom: 0.375rem;
        line-height: 1.2;
        font-weight: 600;
    }
    
    .example-category {
        font-size: 0.75rem;
        padding: 0.125rem 0.5rem;
        border-radius: 12px;
        display: inline-block;
        margin-bottom: 0.5rem;
    }
    
    .example-description {
        font-size: 0.875rem;
        line-height: 1.4;
        margin-bottom: 0.75rem;
        color: var(--text-secondary);
    }
    
    /* Implementation Code Mobile - Ultra Compact */
    .implementation-code {
        margin: 0.75rem 0;
        border-radius: 8px;
        overflow: hidden;
        width: auto;
        max-width: 100%;
        position: relative;
        box-sizing: border-box;
        display: block;
    }
    
    .implementation-header {
        padding: 0.5rem 1rem;
        background: var(--bg-tertiary);
        border-bottom: 1px solid var(--border-light);
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        box-sizing: border-box;
    }
    
    .implementation-header h5 {
        font-size: 0.875rem;
        margin: 0;
        font-weight: 600;
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .implementation-code pre {
        font-size: 0.6875rem;
        line-height: 1.3;
        padding: 0.75rem 1rem;
        margin: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        background: var(--bg-code);
        max-height: 350px;
        overflow-y: auto;
        width: 100%;
        box-sizing: border-box;
        max-width: 100%;
    }
    
    .implementation-code code {
        font-size: 0.6875rem;
        font-family: var(--font-family-mono);
        display: block;
        min-width: fit-content;
    }
    
    /* View Implementation Button Mobile */
    .view-implementation-btn {
        width: 100%;
        padding: 0.625rem 1rem;
        font-size: 0.8125rem;
        border-radius: 6px;
        margin-top: 0.75rem;
        background: var(--bg-secondary);
        border: 1px solid var(--border-light);
        box-sizing: border-box;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* Example Actions Container */
    .example-actions {
        width: 100%;
        box-sizing: border-box;
        margin-top: 0.75rem;
        overflow: hidden;
    }
    
    /* Ensure buttons in example cards don't overflow */
    .example-card button,
    .example-card .btn,
    .example-card [class*="btn"] {
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* Best Practices Mobile */
    .best-practices {
        padding: 1.25rem;
        background: var(--bg-secondary);
        border-radius: 12px;
        margin: 1.5rem 0;
    }
    
    .best-practices h4 {
        font-size: 1.125rem;
        margin-bottom: 1rem;
    }
    
    .practices-list {
        padding-left: 0;
    }
    
    .practices-list li {
        padding: 0.75rem;
        margin-bottom: 0.75rem;
        background: var(--bg-card);
        border-radius: 8px;
        border-left: 4px solid var(--primary-color);
    }
    
    /* Progress Indicators Mobile - Inline */
    .step-progress-bottom {
        padding: 0.75rem;
        background: var(--bg-card);
        border-top: 1px solid var(--border-light);
        margin-top: 0;
        border-radius: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        position: sticky;
        bottom: 0;
        z-index: 5;
    }
    
    .progress-dot {
        width: 8px;
        height: 8px;
        margin: 0 3px;
    }
    
    .progress-dot.active {
        transform: scale(1.25);
    }
    
    /* Scroll Improvements */
    .modal-body {
        scroll-behavior: smooth;
    }
    
    /* Touch Improvements */
    .tab-button,
    .step-btn,
    .run-btn,
    .reset-btn,
    .view-implementation-btn {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* Prevent zoom on input focus */
    .code-input {
        font-size: 16px;
    }
}

/* Extra Small Mobile Devices - Ultra Compact */
@media (max-width: 480px) {
    .modal-header {
        padding: 0.5rem 0.625rem;
        min-height: 44px;
        max-height: 44px;
    }
    
    .modal-title {
        font-size: 1rem;
    }
    
    .modal-close {
        width: 32px;
        height: 32px;
        font-size: 1.125rem;
    }
    
    .pattern-hero {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .pattern-icon-large {
        font-size: 1.75rem;
        width: 36px;
        height: 36px;
    }
    
    /* Fix step navigation on very small screens */
    .step-navigation-top {
        padding: 0.375rem 0.5rem;
        min-height: 36px;
    }
    
    .step-controls {
        gap: 0.75rem;
    }
    
    .step-controls::before {
        font-size: 0.75rem;
        padding: 0 0.25rem;
    }
    
    .step-btn {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
        min-height: 28px;
    }
    
    .pattern-meta h1 {
        font-size: 1.125rem;
    }
    
    .pattern-tagline {
        font-size: 0.8125rem;
    }
    
    .tab-button {
        padding: 0 0.5rem;
        font-size: 0.75rem;
        height: 40px;
    }
    
    .tab-icon {
        font-size: 0.875rem;
    }
    

    
    .modal .step-content {
        padding: 0.75rem;
    }
    
    .modal .step-content h3 {
        font-size: 1rem;
    }
    
    .step-explanation {
        font-size: 0.875rem;
    }
    
    .problem-example,
    .implementation-example {
        padding: 0.625rem;
        margin: 0.5rem 0;
    }
    
    .problem-example h4,
    .implementation-example h4 {
        font-size: 0.875rem;
    }
    
    .problem-example pre,
    .implementation-example pre {
        font-size: 0.6875rem;
        padding: 0.625rem;
    }
    
    .code-input {
        height: 200px;
        padding: 0.625rem;
        font-size: 0.75rem;
    }
    
    .playground-header,
    .playground-actions,
    .output-section {
        padding: 0.625rem;
    }
    
    .output-console {
        height: 150px;
        padding: 0.625rem;
        font-size: 0.75rem;
    }
    
    .examples-content {
        padding: 0.75rem;
    }
    
    .example-card {
        padding: 0.75rem;
    }
    
    .example-header h4 {
        font-size: 0.9375rem;
    }
    
    .example-description {
        font-size: 0.8125rem;
    }
    
    .implementation-code pre {
        font-size: 0.625rem;
        padding: 0.625rem;
        max-height: 280px;
    }
    
    .view-implementation-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
}

/* Landscape Mobile Orientation - Space Optimized */
@media (max-width: 768px) and (orientation: landscape) {
    .modal-header {
        padding: 0.375rem 0.75rem;
        min-height: 40px;
        max-height: 40px;
    }
    
    .modal-title {
        font-size: 1rem;
    }
    
    .modal-close {
        width: 32px;
        height: 32px;
    }
    
    .pattern-hero {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .pattern-icon-large {
        font-size: 1.5rem;
        width: 32px;
        height: 32px;
    }
    
    .pattern-meta h1 {
        font-size: 1.125rem;
    }
    
    .pattern-tabs {
        height: 36px;
    }
    
    .tab-button {
        height: 36px;
        font-size: 0.75rem;
        padding: 0 0.625rem;
    }
    
    .tab-icon {
        font-size: 0.875rem;
    }
    
    .tab-content {
        min-height: calc(100vh - 120px); /* reduced header height */
    }
    

    
    .modal .step-content {
        padding: 0.75rem;
    }
    
    .modal .step-content h3 {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .problem-example pre,
    .implementation-example pre {
        font-size: 0.625rem;
        line-height: 1.25;
        padding: 0.5rem;
        max-height: 200px;
    }
    
    .code-input {
        height: 150px;
        font-size: 0.6875rem;
    }
    
    .output-console {
        height: 120px;
        font-size: 0.6875rem;
    }
    
    .examples-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .example-card {
        padding: 0.625rem;
    }
    
    .implementation-code pre {
        max-height: 200px;
    }
}

/* Additional Mobile Performance and Accessibility Improvements */
@media (max-width: 768px) {
    /* Improve scrolling performance */
    .modal-body,
    .tab-content,
    .output-console,
    .implementation-code pre {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Better touch targets */
    .modal-close,
    .tab-button,
    .step-btn,
    .run-btn,
    .reset-btn,
    .view-implementation-btn,
    .lang-btn {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    /* Prevent text selection on interactive elements */
    .tab-button,
    .step-btn,
    .run-btn,
    .reset-btn,
    .view-implementation-btn {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Improve focus visibility */
    .tab-button:focus,
    .step-btn:focus,
    .run-btn:focus,
    .reset-btn:focus,
    .view-implementation-btn:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }
    
    /* Better code readability - Updated for smaller fonts */
    .implementation-code pre,
    .problem-example pre,
    .implementation-example pre {
        font-size: 0.75rem;
        line-height: 1.35;
        white-space: pre;
        overflow-x: auto;
        overflow-y: auto;
        max-width: 100%;
        -webkit-text-size-adjust: none;
    }
    
    /* Sticky elements adjustments */
    .pattern-tabs {
        position: sticky;
        top: 0;
        z-index: 20;
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    
    /* Loading states for better UX */
    .implementation-loading {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 2rem;
        font-size: 0.875rem;
        color: var(--text-secondary);
    }
    
    /* Better spacing for mobile */
    .modal .modal-body h2 {
        margin-top: 1.5rem;
        margin-bottom: 1rem;
        font-size: 1.375rem;
    }
    
    .modal .modal-body h3 {
        margin-top: 1.25rem;
        margin-bottom: 0.75rem;
        font-size: 1.125rem;
    }
    
    .modal .modal-body p {
        margin-bottom: 1rem;
        line-height: 1.6;
    }
    
    /* Improve button spacing */
    
    .playground-actions {
        padding: 1rem;
        gap: 1rem;
    }
    
    /* Better visual feedback */
    .tab-button:active,
    .step-btn:active,
    .run-btn:active,
    .reset-btn:active,
    .view-implementation-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Improve modal transitions */
    .modal-content {
        animation: slideInFromBottom 0.3s ease-out;
    }
    
    @keyframes slideInFromBottom {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
}