/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --bg-color: #0f172a;
    --primary-color: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --secondary-color: #8b5cf6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15) 0%, transparent 50%);
    background-attachment: fixed;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Tutorials List */
.tutorial-grid {
    display: grid;
    gap: 1.5rem;
}

.tutorial-card {
    display: block;
    text-decoration: none;
    color: inherit;
    animation: fadeInUp 0.6s ease-out backwards;
}

.tutorial-card:nth-child(1) { animation-delay: 0.1s; }
.tutorial-card:nth-child(2) { animation-delay: 0.2s; }
.tutorial-card:nth-child(3) { animation-delay: 0.3s; }

.tutorial-card:hover .glass-card {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

.tutorial-card h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: #e2e8f0;
}

.tutorial-card .meta {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

/* Tutorial Detail Page */
.back-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(-3px);
}

.tutorial-content-card {
    padding: 2rem;
    animation: fadeIn 0.6s ease-out;
}

.tutorial-content-card h1 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

/* Content Formatting */
.formatted-content {
    font-size: 1.05rem;
    color: #cbd5e1;
}

.formatted-content h1, .formatted-content h2, .formatted-content h3 {
    color: #f8fafc;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.formatted-content h2 { font-size: 1.5rem; color: #93c5fd; }
.formatted-content p { margin-bottom: 1rem; }
.formatted-content ul { margin-bottom: 1.5rem; padding-left: 1.5rem; }
.formatted-content li { margin-bottom: 0.5rem; }
.formatted-content strong { color: #f1f5f9; }

/* Code / Preformatted blocks */
.formatted-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 1.5rem;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

/* Alerts / Banners */
.alert-box {
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
}

/* Animations */
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

/* Mobile Adjustments */
@media (max-width: 600px) {
    header h1 { font-size: 2rem; }
    .tutorial-content-card { padding: 1.2rem; }
    .formatted-content { font-size: 1rem; }
    .formatted-content h1 { font-size: 1.5rem; }
}

/* Auto-Tags UI */
.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 1rem;
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
}

.tag-pill {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #c084fc;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s ease;
    text-transform: lowercase;
}

.tutorial-card:hover .tag-pill {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.6);
}

.detail-tags {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.detail-tags .tag-pill {
    font-size: 0.85rem;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    text-decoration: none;
}

.detail-tags .tag-pill:hover {
    background: rgba(139, 92, 246, 0.2);
    color: #e879f9;
}

/* Category Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 2rem;
    justify-content: center;
}

.filter-btn {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.5rem 1.2rem;
    border-radius: 30px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* Base Tints für Buttons based on Category */
.filter-btn[data-cat*="efootball"] { color: #34d399; border-color: rgba(16, 185, 129, 0.3); background: rgba(16, 185, 129, 0.05); }
.filter-btn[data-cat*="programmierung"] { color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); background: rgba(245, 158, 11, 0.05); }
.filter-btn[data-cat*="ki"] { color: #a78bfa; border-color: rgba(139, 92, 246, 0.3); background: rgba(139, 92, 246, 0.05); }
.filter-btn[data-cat*="marketing"] { color: #f87171; border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.05); }

/* Hover & Active States */
.filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.filter-btn[data-cat*="efootball"].active, .filter-btn[data-cat*="efootball"]:hover { 
    background: linear-gradient(135deg, #10b981, #059669); 
    border-color: #10b981; 
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4); 
    color: white;
}
.filter-btn[data-cat*="programmierung"].active, .filter-btn[data-cat*="programmierung"]:hover { 
    background: linear-gradient(135deg, #f59e0b, #d97706); 
    border-color: #f59e0b; 
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4); 
    color: white;
}
.filter-btn[data-cat*="ki"].active, .filter-btn[data-cat*="ki"]:hover { 
    background: linear-gradient(135deg, #8b5cf6, #6d28d9); 
    border-color: #8b5cf6; 
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4); 
    color: white;
}
.filter-btn[data-cat*="marketing"].active, .filter-btn[data-cat*="marketing"]:hover { 
    background: linear-gradient(135deg, #ef4444, #b91c1c); 
    border-color: #ef4444; 
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4); 
    color: white;
}

/* Forms (Admin) */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: #94a3b8;
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.8rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

textarea.form-control {
    resize: vertical;
    font-family: monospace;
}

/* Tutorial Layout (2 Columns for ToC) */
.tutorial-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

.tutorial-layout > * {
    min-width: 0; /* Verhindert, dass Grid-Items das Layout sprengen */
}

@media (min-width: 1024px) {
    .tutorial-layout.has-sidebar {
        grid-template-columns: 3fr 1fr; /* Content links, ToC rechts */
    }
}

/* Sticky Table of Contents */
.toc-sidebar {
    position: sticky;
    top: 2rem;
    padding: 1.5rem;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
}

.toc-title {
    font-size: 1.1rem;
    color: #93c5fd;
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

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

.toc-list li {
    margin-bottom: 0.5rem;
}

.toc-list li.toc-h2 { margin-left: 0; font-weight: 600; }
.toc-list li.toc-h3 { margin-left: 1rem; font-size: 0.9rem; }
.toc-list li.toc-h4 { margin-left: 2rem; font-size: 0.85rem; }

.toc-list a {
    color: var(--text-muted);
    text-decoration: none;
    display: block;
    padding: 0.2rem 0;
    transition: color 0.2s ease;
}

.toc-list a:hover {
    color: #c084fc;
}

/* Rendered Markdown Styling */
.rendered-markdown {
    line-height: 1.7;
    color: #e2e8f0;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.rendered-markdown h1, 
.rendered-markdown h2, 
.rendered-markdown h3, 
.rendered-markdown h4 {
    color: var(--text-main);
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.rendered-markdown h1 { font-size: 2rem; border-bottom: 1px solid var(--glass-border); padding-bottom: 0.5rem; }
.rendered-markdown h2 { font-size: 1.5rem; color: #cbd5e1; }
.rendered-markdown h3 { font-size: 1.25rem; }

.rendered-markdown p {
    margin-bottom: 1.5rem;
}

.rendered-markdown strong {
    color: #f8fafc;
    font-weight: 700;
}

.rendered-markdown ul, .rendered-markdown ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.rendered-markdown li {
    margin-bottom: 0.5rem;
}

/* Markdown Tables */
.rendered-markdown table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 2rem;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 8px;
    overflow: hidden;
}

.rendered-markdown th, .rendered-markdown td {
    padding: 0.8rem 1rem;
    border: 1px solid var(--glass-border);
    text-align: left;
}

.rendered-markdown th {
    background: rgba(30, 41, 59, 0.8);
    color: #93c5fd;
    font-weight: 600;
}

.rendered-markdown tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Markdown Code Blocks */
.rendered-markdown pre {
    background: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
    max-width: 100%;
}

.rendered-markdown code {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    background: rgba(15, 23, 42, 0.5);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    color: #c084fc;
}

.rendered-markdown pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.rendered-markdown blockquote {
    border-left: 4px solid var(--primary-color);
    margin: 0 0 1.5rem 0;
    padding: 0.5rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #94a3b8;
}

.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid #10b981;
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 0 8px 8px 0;
    color: #a7f3d0;
}
