:root {
    --bg-main: #f9f9f9;
    --bg-card: #fff;
    --text-dark: #222;
    --text-main: #333;
    --text-muted: #555;
    --border-light: #eee;
    --border-med: #ddd;
}

body.dark-mode {
    --bg-main: #121212;
    --bg-card: #1e1e1e;
    --text-dark: #f0f0f0;
    --text-main: #e0e0e0;
    --text-muted: #aaaaaa;
    --border-light: #333;
    --border-med: #444;
}

body.dark-mode .code-container,
body.dark-mode .code-header,
body.dark-mode .toc,
body.dark-mode .file-container,
body.dark-mode .note {
    background-color: #252525;
}

body.dark-mode .lang-badge {
    background-color: #333;
    color: #fff;
}

body.dark-mode .project-image-noborder {
    border: 1px solid var(--border-light);
    border-radius: 8px;
}

body.dark-mode .sidebar a:hover:not(.disabled) {
    background-color: #2a2a2a;
}

body.dark-mode nav a:hover,
body.dark-mode nav a.active {
    color: #fff;
}

body.dark-mode nav a.active {
    border-bottom-color: #fff;
}

body.dark-mode .final-project {
    background-color: #333;
    color: #fff;
    border: 1px solid #555;
}

body.dark-mode .final-project:hover {
    background-color: #555;
}

body.dark-mode .file-badge:not(.fusion) {
    background-color: #444;
    color: #fff;
}

body.dark-mode .download-btn {
    background-color: #333;
    color: #fff;
    border: 1px solid #555;
}

body.dark-mode .download-btn:hover {
    background-color: #555;
}

body:not(.lang-en) .en-lang { 
    display: none; 
}

body.lang-en .cs-lang { 
    display: none; 
}

.controls {
    display: flex;
    gap: 10px;
    margin-right: auto;
}

.action-btn {
    background-color: var(--bg-main);
    border: 1px solid var(--border-med);
    color: var(--text-main);
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.action-btn:hover {
    background-color: var(--border-light);
}

.note {
    background-color: #f4f4f4;
    border: 1px solid var(--border-med);
    border-left: 5px solid var(--text-dark);
    border-radius: 8px;
    padding: 15px 20px;
    margin: 25px 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.note p {
    margin-bottom: 0;
}

.note a {
    color: var(--text-dark);
    font-weight: 600;
    text-decoration: underline;
    transition: color 0.2s;
}

.note a:hover {
    color: var(--text-muted);
}

.contact-heading {
    border-top: 1px solid var(--border-light);
    padding-top: 20px;
    margin-top: 40px;
}

/* Base settings */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth; /* Smooth scrolling for anchor links */
}

/* Navigation */
nav {
    background-color: var(--bg-card);
    padding: 1rem 2rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    display: flex;
    justify-content: flex-end;
    gap: 20px;
}

nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    transition: color 0.3s;
}

nav a:hover {
    color: #000;
}

nav a.active {
    color: #000;
    border-bottom: 2px solid var(--text-dark);
    padding-bottom: 3px;
}

/* Main container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    margin: 80px 0 20px;
    color: var(--text-dark);
}

.content h1 {
    margin-bottom: 10px;
    border-bottom: 2px solid #eaeaea;
    padding-bottom: 10px;
}

h2 {
    font-size: 1.5rem;
    margin: 60px 0 15px;
    color: var(--text-dark);
}

h3 {
    font-size: 1.25rem;
    margin: 50px 0 15px;
    color: var(--text-dark);
}

h4 {
    font-size: 1.1rem;
    margin: 40px 0 10px;
    color: var(--text-dark);
}

.content h1:first-child,
.content h2:first-child,
.content h3:first-child,
.content h4:first-child {
    margin-top: 0;
}

hr {
    border: 0;
    border-top: 1px solid var(--border-med);
    margin: 60px 0;
}

.description {
    font-size: 1.1rem;
    color: #666;
    max-width: 700px;
    margin: 0 auto 50px auto;
}

p {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 20px;
}

/* Lists */
ul, ol {
    margin-bottom: 20px; 
    padding-left: 60px;
}

li {
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 4px;
}

strong {
    color: var(--text-main);
}

/* Layout wrappers */
.main-wrapper {
    display: flex;
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    gap: 30px;
    align-items: flex-start;
    width: 100%;
    box-sizing: border-box;
}

/* Grid layout */
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 30px 20px;
    text-decoration: none;
    color: var(--text-main);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    border-color: var(--border-med);
}

.card.disabled {
    background-color: #e5e5e5;
    border-color: #d5d5d5;
    pointer-events: none;
    box-shadow: none;
}

.card.disabled .week-title,
.card.disabled .week-number {
    color: #999;
}

.week-number {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #888;
    margin-bottom: 10px;
}

.week-title {
    font-size: 1.2rem;
    font-weight: bold;
}

/* Buttons */
.final-project {
    display: block;
    background-color: var(--text-dark);
    color: #fff;
    text-decoration: none;
    padding: 20px;
    border-radius: 8px;
    font-size: 1.3rem;
    font-weight: bold;
    margin-top: 20px;
    transition: background-color 0.3s;
}

.final-project:hover {
    background-color: #444;
}

/* Sidebar */
.sidebar {
    width: 200px;
    flex-shrink: 0;
    background-color: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid var(--border-light);
}

.sidebar a {
    display: block;
    padding: 12px 20px;
    color: var(--text-main);
    text-decoration: none;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s, color 0.2s;
}

.sidebar a:last-child {
    border-bottom: none;
}

.sidebar a:hover:not(.disabled) {
    background-color: #f0f0f0;
}

.sidebar a.active {
    font-weight: bold;
    background-color: var(--bg-main);
    border-left: 4px solid var(--text-dark);
}

.sidebar a.disabled {
    color: #aaa;
    pointer-events: none;
    cursor: default;
}

.sidebar-heading {
    display: block;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    background-color: var(--bg-main);
    border-bottom: 1px solid var(--border-light);
}

.sidebar .sidebar-heading:first-child {
    border-radius: 8px 8px 0 0;
}

.sidebar::-webkit-scrollbar {
    display: none; 
}

.sidebar {
    -ms-overflow-style: none; 
    scrollbar-width: none; 
}


.sidebar .week-number {
    display: block; /* Zajistí, že číslo bude na vlastním řádku */
    font-size: 0.75rem; /* Menší text pro číslo týdne */
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted); /* Světlejší barva (funguje i v dark-modu) */
    margin-bottom: 3px; /* Malá mezera pod číslem týdne */
    font-weight: normal; /* Zabrání ztučnění i u aktivní položky */
}

.sidebar a.active .week-number {
    font-weight: normal; 
}

.sidebar .week-title {
    display: block;
    font-size: 1rem; /* Sjednoceno s ostatními jednoduchými texty */
    font-weight: inherit; /* Převezme tloušťku (normální/tučná) podle odkazu */
    line-height: 1.2;
}

/* Main content */
.content {
    flex-grow: 1;
    background-color: var(--bg-card);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    border: 1px solid var(--border-light);
    box-sizing: border-box;
    min-width: 0;
    overflow-x: hidden;
    width: 100%;
}

/* Shared media styles */
.project-image,
.project-video-ikfinal,
.project-video-ik {
    display: block;
    margin: 15px auto;
    max-width: 100%;
    height: auto;
    border-radius: 8px; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Specific video properties */
.project-video-ikfinal,
.project-video-ik {
    object-fit: cover;
    object-position: center;
}

.project-video-ikfinal {
    aspect-ratio: 45 / 71;
}

.project-video-ik {
    aspect-ratio: 1.14 / 1;
}

.project-image-noborder {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
    padding: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* YouTube container */
.video-container {
    position: relative;
    width: 100%;
    margin: 30px auto;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background-color: #000;
    aspect-ratio: 16 / 9;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Code blocks */
.code-container {
    border: 1px solid var(--border-med);
    border-radius: 8px;
    margin-bottom: 20px;
    background-color: #f4f4f4;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    max-width: 100%;
    width: 100%;
    overflow: auto;
    display: block;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #eaeaea;
    padding: 8px 15px;
    border-bottom: 1px solid var(--border-med);
}

.code-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lang-badge {
    background-color: var(--text-dark);
    color: #fff;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.language-label {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.toggle-btn, .copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-family: inherit;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    font-weight: 600;
}

.toggle-btn:hover, .copy-btn:hover {
    background-color: #d5d5d5;
    color: #000;
}

/* Prism.js overrides */
.code-container pre,
.code-container pre[class*="language-"] {
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 15px !important;
    max-height: 700px;
    overflow-x: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    word-break: normal !important;
    word-wrap: normal !important;
    white-space: pre !important;
}

.code-container code[class*="language-"] {
    display: block !important;
    width: fit-content !important;
    min-width: 100%;
    padding: 0 !important;
    white-space: pre !important;
}

/* Code animation */
.code-content {
    transition: max-height 0.3s ease-in-out;
    max-height: 5000px;
    overflow: hidden;
    width: 100%;
}

.code-content.collapsed {
    max-height: 0;
}

code {
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
}

:not(pre) > code {
    color: inherit !important;
    background: transparent !important;
    text-shadow: none !important;
}

/* Table of Contents (TOC) */
.toc {
    background-color: #f4f4f4;
    border: 1px solid var(--border-med);
    border-radius: 8px;
    padding: 20px 30px;
    margin-bottom: 40px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.toc h2 {
    margin: 0 0 15px;
    font-size: 1.3rem;
    border-bottom: 1px solid #eaeaea;
    padding-bottom: 10px;
}

.toc li {
    margin-bottom: 8px;
}

/* TOC levels styling */
.toc ul {
    list-style-type: disc;
    padding-left: 50px;
    margin-bottom: 0;
}

.toc ul ul {
    list-style-type: circle;
    padding-left: 50px;
    margin: 8px 0 15px;
}

.toc ul ul ul {
    list-style-type: disc;
    margin-bottom: 0;
}

.toc ul ul ul ul {
    list-style-type: circle;
    padding-left: 50px;
    margin: 8px 0 15px;
}

.toc a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 600;
    transition: color 0.2s;
}

.toc a:hover {
    color: #000;
    text-decoration: underline;
}

/* Downloadable files */
.file-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f4f4f4;
    border: 1px solid var(--border-med);
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.file-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-badge {
    background-color: #333;
    color: #fff;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.file-badge.fusion {
    background-color: #f26522;
}

.file-name {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
}

.file-size {
    font-size: 0.9rem;
    color: #888;
}

.download-btn {
    display: inline-block;
    background-color: var(--text-dark);
    color: #fff;
    text-decoration: none;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    padding: 6px 15px;
    border-radius: 4px;
    transition: background-color 0.2s, transform 0.1s;
}

.download-btn:hover {
    background-color: #444;
}

.download-btn:active {
    transform: scale(0.98);
}

/* Desktop layout additions */
@media (min-width: 769px) {
    .sidebar {
        position: sticky;
        top: 40px;
        max-height: calc(100vh - 80px); 
        overflow-y: auto;
    }
}

/* Media queries (Responsive - Mobile & Tablets) */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .main-wrapper {
        flex-direction: column;
        padding: 0 10px;
    }
    /*
    .sidebar {
        width: 100%;
    }
    */
    .sidebar {
        display: none; 
    }
    .content {
        padding: 20px;
        width: 100%;
    }
    nav {
        padding: 1rem 10px;
    }
    .container {
        padding: 30px 10px;
    }
}

@media (max-width: 500px) {
    .grid {
        grid-template-columns: 1fr;
    }
    
    h1 { font-size: 1.6rem; margin: 0 0 15px; }
    h2 { font-size: 1.15rem; margin: 20px 0 10px; }
    h3 { font-size: 1.0rem; margin: 15px 0 10px; }
    h4 { font-size: 0.9rem; margin: 15px 0 5px; }
    
    p, li, .description {
        font-size: 0.8rem;
        line-height: 1.5;
        margin-bottom: 12px;
    }
    
    ul, ol {
        padding-left: 25px; 
        margin-bottom: 15px;
    }
    
    .content {
        padding: 15px;
    }

    .file-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .download-btn {
        width: 100%;
        text-align: center;
        box-sizing: border-box;
    }
    .code-container pre,
    .code-container pre[class*="language-"] {
        font-size: 0.7rem !important;
        padding: 10px !important;
    }
}