/* Modern Minimalistic Programming Blog Styles */

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

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

/* Base styles */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --text-muted: #999999;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --border: #e5e7eb;
    --border-hover: #d1d5db;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 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);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 16px;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
header {
    padding: 32px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 48px;
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
    background: rgba(255, 255, 255, 0.95);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

nav {
    display: flex;
    gap: 32px;
    align-items: center;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s ease;
    padding: 8px 12px;
    border-radius: var(--radius);
}

nav a:hover {
    color: var(--accent);
    background: rgba(37, 99, 235, 0.05);
}

/* Main content */
main {
    min-height: calc(100vh - 200px);
}

h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 24px;
    letter-spacing: -0.025em;
    line-height: 1.3;
}

/* Article list */
.articles {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.articles a {
    display: block;
    padding: 24px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.2s ease;
    box-shadow: var(--shadow);
}

.articles a:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.articles a h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.articles a p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* Article content */
.article-content {
    background: var(--bg-primary);
    padding: 48px 0;
}

.article-header {
    margin-bottom: 48px;
    text-align: center;
}

.article-header h1 {
    font-size: 42px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.article-meta {
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}

.article-body {
    font-size: 18px;
    line-height: 1.8;
    color: var(--text-primary);
}

.article-body p {
    margin-bottom: 24px;
}

.article-body h2 {
    font-size: 28px;
    font-weight: 600;
    margin: 48px 0 24px 0;
    color: var(--text-primary);
}

.article-body h3 {
    font-size: 22px;
    font-weight: 600;
    margin: 32px 0 16px 0;
    color: var(--text-primary);
}

.article-body h4 {
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 12px 0;
    color: var(--text-primary);
}

.article-body ul, .article-body ol {
    margin: 24px 0;
    padding-left: 24px;
}

.article-body li {
    margin-bottom: 8px;
}

.article-body blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 24px;
    margin: 32px 0;
    font-style: italic;
    color: var(--text-secondary);
    background: rgba(37, 99, 235, 0.02);
    padding: 16px 24px;
    border-radius: 0 var(--radius) var(--radius) 0;
}

.article-body code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Monaco', 'Consolas', monospace;
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--accent);
}

.article-body pre {
    background: var(--bg-secondary);
    padding: 24px;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 24px 0;
    border: 1px solid var(--border);
}

.article-body pre code {
    background: none;
    padding: 0;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.6;
}

/* Back to blog link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 32px;
    padding: 8px 12px;
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.back-link:hover {
    color: var(--accent);
    background: rgba(37, 99, 235, 0.05);
}

.back-link::before {
    content: "←";
    font-size: 16px;
}

/* Footer */
footer {
    text-align: center;
    padding: 48px 0;
    border-top: 1px solid var(--border);
    margin-top: 48px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Form styles */
.form-container {
    max-width: 500px;
    margin: 0 auto;
    padding: 48px 0;
}

.auth-form, .publish-form {
    background: var(--bg-primary);
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: inherit;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.error-message {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border: 1px solid #fecaca;
    font-size: 14px;
    font-weight: 500;
}

/* Quiz styles */
.quiz-section {
    margin: 48px 0;
    padding: 32px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.quiz-section h2 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.quiz-container {
    max-width: 600px;
    margin: 0 auto;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.quiz-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.quiz-progress {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.quiz-question {
    margin-bottom: 24px;
}

.quiz-question h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.quiz-option {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg-primary);
}

.quiz-option:hover {
    border-color: var(--accent);
    background: rgba(37, 99, 235, 0.02);
}

.quiz-option.selected {
    border-color: var(--accent);
    background: rgba(37, 99, 235, 0.05);
}

.quiz-option.correct {
    border-color: #22c55e;
    background: #f0fdf4;
}

.quiz-option.incorrect {
    border-color: #ef4444;
    background: #fef2f2;
}

.quiz-option input[type="radio"] {
    margin-right: 12px;
    transform: scale(1.2);
}

.quiz-option input[type="radio"]:checked + .option-text {
    font-weight: 600;
    color: var(--accent);
}

.feedback-icon {
    margin-left: auto;
    font-size: 18px;
}

.feedback-message {
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 16px;
    line-height: 1.5;
    background: #f0fdf4;
    border: 1px solid #22c55e;
    color: #166534;
}

.option-text {
    font-size: 16px;
    color: var(--text-primary);
    line-height: 1.4;
}

.quiz-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-secondary:disabled,
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quiz Results */
.quiz-results {
    max-width: 600px;
    margin: 0 auto;
}

.results-header {
    text-align: center;
    margin-bottom: 32px;
}

.results-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.score-display {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    min-width: 120px;
}

.score-good {
    background: #f0fdf4;
    border: 2px solid #22c55e;
    color: #166534;
}

.score-average {
    background: #fffbeb;
    border: 2px solid #f59e0b;
    color: #92400e;
}

.score-poor {
    background: #fef2f2;
    border: 2px solid #ef4444;
    color: #991b1b;
}

.score-number {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.score-percentage {
    font-size: 18px;
    font-weight: 600;
}

.score-message {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0;
}

.results-breakdown {
    margin-bottom: 32px;
}

.results-breakdown h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.result-item {
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    border-left: 4px solid;
}

.result-item.correct {
    background: #f0fdf4;
    border-left-color: #22c55e;
}

.result-item.incorrect {
    background: #fef2f2;
    border-left-color: #ef4444;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.result-number {
    font-weight: 600;
    color: var(--text-primary);
}

.result-status {
    font-size: 18px;
}

.result-question {
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.result-explanation {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.results-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

/* Quiz animations */
@keyframes scoreReveal {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes slideIn {
    0% {
        transform: translateX(-20px);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive quiz */
@media (max-width: 768px) {
    .quiz-section {
        padding: 20px;
        margin: 32px 0;
    }
    
    .quiz-header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .quiz-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .score-display {
        padding: 16px;
        min-width: 100px;
    }
    
    .score-number {
        font-size: 24px;
    }
    
    .score-percentage {
        font-size: 16px;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    header {
        padding: 24px 0;
        margin-bottom: 32px;
    }
    
    header .container {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    nav {
        gap: 16px;
    }
    
    h1 {
        font-size: 24px;
    }
    
    h2 {
        font-size: 28px;
    }
    
    .article-header h1 {
        font-size: 32px;
    }
    
    .article-body {
        font-size: 16px;
    }
    
    .articles a {
        padding: 20px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f0f23;
        --bg-secondary: #1a1a2e;
        --text-primary: #e2e8f0;
        --text-secondary: #94a3b8;
        --text-muted: #64748b;
        --border: #1e293b;
        --border-hover: #334155;
    }
    
    header {
        background: rgba(15, 15, 35, 0.95);
    }
}