/* Design Patterns Learning Hub Styles */

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

:root {
    /* Colors */
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --creational: #10b981;
    --creational-light: #d1fae5;
    --behavioral: #8b5cf6;
    --behavioral-light: #ede9fe;
    --structural: #f59e0b;
    --structural-light: #fef3c7;
    
    /* UI Colors */
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #ffffff;
    --bg-light: #f9fafb;
    --bg-dark: #111827;
    --border: #e5e7eb;
    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Consolas', 'Monaco', 'Courier New', monospace;
    
    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;
    --space-16: 4rem;
    
    /* Shadows */
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --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);
    
    /* Transitions */
    --transition: all 0.2s ease;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg-light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

/* Header */
.header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    -webkit-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.logo .version {
    background: var(--primary);
    color: white;
    padding: var(--space-1) var(--space-2);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.nav {
    display: flex;
    gap: var(--space-8);
}

.nav-link {
    text-decoration: none;
    color: var(--text-light);
    font-weight: 500;
    padding: var(--space-2) var(--space-4);
    border-radius: 0.375rem;
    transition: var(--transition);
}

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

/* Main Layout */
.main {
    min-height: calc(100vh - 140px);
}

.section {
    display: none;
    padding: var(--space-16) 0;
}

.section.active {
    display: block;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: var(--space-16);
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: var(--space-4);
    background: linear-gradient(135deg, var(--primary), var(--behavioral));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: var(--space-12);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.stats {
    display: flex;
    justify-content: center;
    gap: var(--space-12);
    margin-top: var(--space-8);
}

.stat {
    text-align: center;
}

.stat h3 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: var(--space-2);
}

.stat p {
    color: var(--text-light);
    font-weight: 500;
}

/* Pattern Cards */
.patterns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-8);
    margin-top: var(--space-16);
}

.pattern-card {
    background: var(--bg);
    border-radius: 1rem;
    padding: var(--space-8);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.pattern-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.pattern-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
}

.pattern-icon {
    width: 60px;
    height: 60px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-6);
    font-size: 1.5rem;
    color: white;
}

.pattern-icon.creational {
    background: var(--creational);
}

.pattern-icon.behavioral {
    background: var(--behavioral);
}

.pattern-icon.structural {
    background: var(--structural);
}

.pattern-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.pattern-card .category {
    color: var(--text-light);
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-4);
}

.pattern-card p:not(.category) {
    color: var(--text-light);
    margin-bottom: var(--space-6);
}

.difficulty {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.difficulty.beginner {
    background: var(--creational-light);
    color: var(--creational);
}

.difficulty.intermediate {
    background: var(--structural-light);
    color: var(--structural);
}

.difficulty.advanced {
    background: var(--behavioral-light);
    color: var(--behavioral);
}

/* Pattern Detail */
.pattern-header {
    display: flex;
    align-items: center;
    margin-bottom: var(--space-8);
    padding: var(--space-6);
    background: var(--bg);
    border-radius: 1rem;
    box-shadow: var(--shadow);
}

.back-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1rem;
    cursor: pointer;
    padding: var(--space-3);
    border-radius: 0.5rem;
    transition: var(--transition);
    margin-right: var(--space-6);
}

.back-btn:hover {
    background: var(--bg-light);
}

.pattern-info h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: var(--space-3);
}

.pattern-meta {
    display: flex;
    gap: var(--space-4);
}

.pattern-category,
.pattern-difficulty {
    padding: var(--space-1) var(--space-3);
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pattern-category.creational {
    background: var(--creational-light);
    color: var(--creational);
}

.pattern-category.behavioral {
    background: var(--behavioral-light);
    color: var(--behavioral);
}

.pattern-category.structural {
    background: var(--structural-light);
    color: var(--structural);
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--bg);
    border-radius: 1rem;
    box-shadow: var(--shadow);
    margin-bottom: var(--space-8);
    overflow: hidden;
}

.tab {
    flex: 1;
    background: none;
    border: none;
    padding: var(--space-4) var(--space-6);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    color: var(--text-light);
}

.tab:hover {
    background: var(--bg-light);
}

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

/* Tab Content */
.tab-content {
    background: var(--bg);
    border-radius: 1rem;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.tab-panel {
    display: none;
    padding: var(--space-8);
}

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

/* Overview Grid */
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-6);
}

.overview-card {
    background: var(--bg-light);
    padding: var(--space-6);
    border-radius: 0.75rem;
    border: 1px solid var(--border);
}

.overview-card h3 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-4);
}

.overview-card p {
    color: var(--text);
    line-height: 1.7;
}

.overview-card ul {
    list-style: none;
    padding-left: 0;
}

.overview-card li {
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.overview-card li:last-child {
    border-bottom: none;
}

.overview-card li::before {
    content: '✓';
    color: var(--success);
    font-weight: 700;
    margin-right: var(--space-3);
}

/* Code Section */
.code-section,
.example-section {
    margin-bottom: var(--space-8);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.code-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.copy-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: var(--space-2) var(--space-4);
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

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

.example-section h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--space-4);
}

pre {
    background: var(--bg-dark);
    padding: var(--space-6);
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 0;
}

pre code {
    color: #e5e7eb;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
}

/* Playground */
.playground {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
    height: 500px;
}

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

.editor-header,
.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.editor-header h3,
.output-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
}

.editor-actions {
    display: flex;
    gap: var(--space-2);
}

.btn {
    border: none;
    padding: var(--space-2) var(--space-4);
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

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

.btn.primary:hover {
    background: #047857;
}

.btn.secondary {
    background: var(--bg-light);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn.secondary:hover {
    background: var(--border);
}

#code-editor {
    flex: 1;
    background: var(--bg-dark);
    color: #e5e7eb;
    border: none;
    padding: var(--space-4);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    resize: none;
    outline: none;
    border-radius: 0.5rem;
    line-height: 1.6;
}

#output-console {
    flex: 1;
    background: var(--bg-dark);
    border-radius: 0.5rem;
    padding: var(--space-4);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    overflow-y: auto;
    color: #e5e7eb;
}

.console-line {
    padding: var(--space-1) 0;
    border-left: 3px solid transparent;
    padding-left: var(--space-2);
}

.console-line.info {
    border-left-color: var(--primary);
}

.console-line.success {
    border-left-color: var(--success);
    color: #86efac;
}

.console-line.error {
    border-left-color: var(--error);
    color: #fca5a5;
}

/* Exercise */
.exercise-header {
    margin-bottom: var(--space-8);
    text-align: center;
}

.exercise-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--space-3);
}

.exercise-header p {
    color: var(--text-light);
    font-size: 1.125rem;
}

.exercise-content {
    max-width: 800px;
    margin: 0 auto;
}

.exercise-requirements {
    background: var(--bg-light);
    padding: var(--space-6);
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    margin-bottom: var(--space-8);
}

.exercise-requirements h4 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--space-4);
}

.exercise-requirements ul {
    list-style: none;
    padding-left: 0;
}

.exercise-requirements li {
    padding: var(--space-2) 0;
    color: var(--text);
    position: relative;
    padding-left: var(--space-6);
}

.exercise-requirements li::before {
    content: '→';
    color: var(--primary);
    font-weight: 700;
    position: absolute;
    left: 0;
}

.exercise-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.exercise-hint,
.exercise-solution {
    background: var(--bg-light);
    padding: var(--space-6);
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    margin-bottom: var(--space-6);
}

.exercise-hint h4 {
    color: var(--warning);
    margin-bottom: var(--space-3);
}

.exercise-solution h4 {
    color: var(--success);
    margin-bottom: var(--space-4);
}

/* About Section */
.about {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: var(--space-6);
    color: var(--text);
}

.about p {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: var(--space-12);
    line-height: 1.7;
}

.roadmap {
    text-align: left;
}

.roadmap h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-8);
    text-align: center;
    color: var(--text);
}

.phase {
    display: flex;
    align-items: center;
    margin-bottom: var(--space-6);
    padding: var(--space-6);
    background: var(--bg);
    border-radius: 0.75rem;
    border: 1px solid var(--border);
    opacity: 0.6;
    transition: var(--transition);
}

.phase.active {
    opacity: 1;
    border-color: var(--primary);
    background: linear-gradient(135deg, var(--bg) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.phase-number {
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-right: var(--space-6);
    flex-shrink: 0;
}

.phase:not(.active) .phase-number {
    background: var(--text-light);
}

.phase-info h4 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--space-2);
}

.phase-info p {
    color: var(--text-light);
    margin: 0;
}

/* Footer */
.footer {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: var(--space-8) 0;
    text-align: center;
    color: var(--text-light);
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--success);
    color: white;
    padding: var(--space-4) var(--space-6);
    border-radius: 0.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .stats {
        flex-direction: column;
        gap: var(--space-6);
    }
    
    .patterns-grid {
        grid-template-columns: 1fr;
    }
    
    .playground {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
        height: 800px;
    }
    
    .pattern-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-4);
    }
    
    .tabs {
        flex-wrap: wrap;
    }
    
    .tab {
        flex: 1;
        min-width: 120px;
    }
    
    .overview-grid {
        grid-template-columns: 1fr;
    }
}