/* Základní styly */
body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: var(--line-height);
}
a { color: var(--link-color); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin-top: 0; }
h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }

/* Hlavička */
header {
    background-color: var(--header-bg-color);
    color: #ffffff;
    padding: var(--header-padding) 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}
header h1 { font-size: 1.8rem; z-index: 1000; margin: 0; }
header h1 a { color: #ffffff; text-decoration: none; }

/* Patička */
footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
    background-color: var(--footer-bg-color);
    color: var(--footer-text-color);
    border-top: 1px solid #dee2e6;
}

/* --- STRUKTURA LAYOUTU --- */
.site-content-wrapper {
    display: grid;
    /* ZMĚNA: Středový sloupec má nyní pevnou šířku danou z nastavení */
    grid-template-columns: auto var(--container-width) auto;
    justify-content: center; /* Vycentruje celou mřížku na stránce */
    gap: 1.4rem; /* Nastaví stejnou mezeru mezi všemi sloupci */
    margin: 2rem auto;
    padding: 0 2rem; /* Bezpečnostní mezera od okrajů stránky */
    box-sizing: border-box;
    /* Řádek "align-items: start;" byl smazán */
}

/* Oprava pro správné obalení plovoucích prvků v obsahu */
.container article {
    overflow: auto;
}

/* Kontejner pro hlavní obsah (modrý blok) */
.site-content-wrapper > .container {
    grid-column: 2;
    width: var(--container-width); /* Pevná šířka ze vzhledu */
    margin: 0;
    padding: var(--container-padding);
    background-color: var(--container-bg-color);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    box-sizing: border-box; /* Důležité pro správné počítání šířky */
    overflow: auto; /* TOTO JE TA OPRAVA */
}

/* --- Styly pro Widgety a Panely --- */
.sidebar {
    width: 280px;
    word-break: break-word;
}
#sidebar-left { 
    grid-column: 1; 
    justify-self: end; /* Zarovná panel k pravému okraji jeho sloupce */
}
#sidebar-right { 
    grid-column: 3; 
    justify-self: start; /* Zarovná panel k levému okraji jeho sloupce */
}

.widget {
    background-color: var(--container-bg-color);
    border: 1px solid #e9e9e9;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.widget-title {
    font-size: 1.15rem;
    margin-top: 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.75rem;
    color: #333;
}
.widget-content p:last-child,
.widget-content div:last-child {
    margin-bottom: 0;
}
.widget-content ul {
    padding-left: 20px;
    margin-top: 0;
}

/* --- OSTATNÍ STYLY --- */

/* Hamburger tlačítko */
.mobile-nav-toggle { display: none; }
.mobile-nav-toggle .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; }

/* Navigace pro desktop */
.primary-navigation { display: flex; align-items: center; }
.primary-navigation ul { list-style: none; margin: 0; padding: 0; display: flex; }
.primary-navigation ul li a {
    color: var(--nav-link-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    display: block;
    border-radius: 4px;
}
.primary-navigation ul li a:hover {
    background-color: var(--nav-link-hover-bg);
    text-decoration: none;
}
.lang-switcher { margin-left: 2rem; border-left: 1px solid #6c757d; padding-left: 1rem; }
.lang-switcher a { color: #adb5bd; text-decoration: none; margin: 0 0.5rem; font-weight: bold; }
.lang-switcher a.active { color: #ffffff; text-decoration: underline; }

/* Styly pro obsah z editoru */
.editor-row { display: flex; flex-wrap: wrap; gap: 1.5rem; margin: 1.5rem 0; }
.editor-col { flex: 1; min-width: 200px; }
.table-wrapper { overflow-x: auto; margin: 1.5rem 0; border: 1px solid #dee2e6; }
.container table { border-collapse: collapse; font-size: 0.9em; min-width: 600px; width: 100%;}
.container th, .container td { border: 1px solid #ccc; padding: 0.75rem; text-align: left; }
.container th { background-color: #f8f9fa; }
.video-wrapper { position: relative; overflow: hidden; max-width: 100%; margin-bottom: 1rem; aspect-ratio: 16 / 9; }
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.container figure {
    padding: 0;
    max-width: 100%;
}
.container figure a { border: none; display: inline-block; line-height: 0; }
.container figure img { max-width: 100%; height: auto; display: block; margin-left: auto; margin-right: auto; cursor: pointer; }
.container figcaption { text-align: center; font-size: 0.9em; color: #6c757d; margin-top: 0.5rem; clear: both; }

/* Zarovnání obrázků */
.align-left { float: left; margin: 0.2rem 1.5rem 1rem 0; }
.align-right { float: right; margin: 0.2rem 0 1rem 1.5rem; }
.align-center { 
    display: table;
    margin-left: auto; 
    margin-right: auto; 
    float: none;
}

.style-shadow img { box-shadow: 0 4px 15px rgba(0,0,0,0.15); }
.style-bordered img { border: 1px solid #dee2e6; padding: 5px; }


/* --- RESPONZIVNÍ STYLY --- */
@media (max-width: 1500px) { /* Upraven breakpoint pro lepší chování */
    .site-content-wrapper {
        display: flex;
        flex-direction: column;
        margin: 0;
        padding: 0 1rem;
    }

    .site-content-wrapper > .container {
        order: 1;
        margin: 2rem 0;
        width: 100%;
        box-sizing: border-box;
    }
    #sidebar-left {
        order: 2;
        width: 100%;
        margin-top: 0;
    }
    #sidebar-right {
        order: 3;
        width: 100%;
        margin-top: 2rem;
    }
}

@media (max-width: 768px) {
    .align-left, .align-right { float: none; max-width: 100%; margin: 1.5rem auto; }
    .mobile-nav-toggle {
        display: block; position: absolute; z-index: 2000; right: 1.5rem; top: 50%; transform: translateY(-50%);
        background: transparent; border: 0; padding: 0.5em; cursor: pointer;
    }
    .mobile-nav-toggle::before, .mobile-nav-toggle::after {
        content: ''; position: absolute; width: 2em; height: 3px; background: white; border-radius: 3px; transition: transform 0.3s ease-in-out;
    }
    .mobile-nav-toggle::before { transform: translateY(-6px); }
    .mobile-nav-toggle::after { transform: translateY(6px); }
    .mobile-nav-toggle[aria-expanded="true"]::before { transform: rotate(45deg); }
    .mobile-nav-toggle[aria-expanded="true"]::after { transform: rotate(-45deg); }

    .primary-navigation {
        position: fixed; z-index: 100; inset: 0 0 0 30%;
        flex-direction: column; padding: min(20vh, 10rem) 2em;
        background: hsl(0 0% 0% / 0.8);
        backdrop-filter: blur(1rem);
        transform: translateX(100%);
        transition: transform 350ms ease-out;
    }
    .primary-navigation[data-visible="true"] { transform: translateX(0%); }
    .primary-navigation ul { flex-direction: column; gap: 1.5rem; width: 100%; }
    footer .lang-switcher { margin-top: 2rem; margin-left: 0; padding-left: 0; border-left: none; border-top: 1px solid #6c757d; padding-top: 1rem; }
}

/* --- STYLY PRO LIGHTBOX --- */
.lightbox {
    position: fixed; z-index: 3000; inset: 0; background: rgba(0,0,0,0.8);
    display: flex; justify-content: center; align-items: center;
    opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease;
}
.lightbox.active { opacity: 1; visibility: visible; }
.lightbox-content { position: relative; max-width: 90%; max-height: 90%; }
.lightbox-image { max-width: 100%; max-height: 100%; display: block; animation: zoomIn 0.3s ease; }
.lightbox-close { position: absolute; top: -40px; right: 0; font-size: 2.5rem; color: white; cursor: pointer; line-height: 1; }
@keyframes zoomIn { from { transform: scale(0.8); } to { transform: scale(1); } }

/* Styly pro menu v patičce */
.footer-navigation ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 20px 0;
    gap: 25px;
}

.footer-navigation a {
    color: var(--footer-menu-link-color);
    text-decoration: none;
    font-size: 14px;
}

.footer-navigation a:hover {
    color: var(--footer-menu-link-hover-color);
    text-decoration: underline;
}
