/* ==========================================================================
   LAYOUT.CSS - Globální struktura a vizuální základ webu
   ========================================================================== */

:root {
    --primary: #0d6efd;
    --dark: #212529;
    --text: #4a4a4a;
    --light: #f8f9fa;
    --border: #dee2e6;
    --link: #0d6efd;
    --white: #ffffff;
    --max-width: 1200px;
    --breadcrumbs-offset-top: 10px;
    --h1-margin-y: 0.5em;
}

/* --- 1. ZÁKLADNÍ KONTEJNERY --- */

html, body {
    height: 100%;
    margin: 0;
}

html {
    /* Keep centered layout stable when vertical scrollbar appears/disappears. */
    scrollbar-gutter: stable both-edges;
}

body {
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--white);
    color: var(--text);
    font-size: 0.95rem; 
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1 {
    margin-top: var(--h1-margin-y);
    margin-bottom: var(--h1-margin-y);
}

#app {
    flex: 1 0 auto;
    padding-bottom: 2rem;
}

.container {
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    box-sizing: border-box;
    padding-left: 20px;
    padding-right: 20px;
}

@media (max-width: 1240px) {
    .container {
        padding-left: 18px;
        padding-right: 18px;
    }
}

@media (max-width: 600px) {
    .container {
        padding-left: 6px;
        padding-right: 6px;
    }
}

/* --- 2. NAVIGACE (HLAVIČKA) --- */

.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
}

.navbar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--primary);
    font-weight: 700;
    text-decoration: none;
}

.logo-image {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.8rem;
    line-height: 1;
}

.level-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.95rem;
    border-radius: 6px;
    border: 1px solid transparent;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.nav-links .level-link {
    margin-left: 12px;
}

.level-link--view-all {
    margin-top: 20px;
    width: fit-content;
}

.level-link--beginner {
    background-color: #14b8a6;
    border-color: transparent;
    color: #111827;
}

.level-link--elementary {
    background-color: #facc15;
    border-color: transparent;
    color: #111827;
}

.level-link--pre-intermediate {
    background-color: #4447d7;
    border-color: transparent;
    color: var(--white);
}

.level-link--beginner:hover {
    background-color: #0f9f8f;
    transform: translateY(-1px);
}

.level-link--elementary:hover {
    background-color: #eab308;
    transform: translateY(-1px);
}

.level-link--pre-intermediate:hover {
    background-color: #373ac1;
    transform: translateY(-1px);
}

.level-link:focus-visible {
    outline: 3px solid #111827;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

/* --- 3. SPOLEČNÉ PRVKY (HERO, BREADCRUMBS) --- */

.hero {
    background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)), url('/assets/ui/pozadi.webp');
    background-size: cover;
    background-position: center;
    min-height: 250px;
    padding: 3rem 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: var(--white);
    text-align: center;
}

.hero h1 {
    font-size: 2.7rem;
    font-weight: 700;
    margin-top: var(--h1-margin-y);
    margin-bottom: var(--h1-margin-y);
}

.hero-subtitle {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.breadcrumb {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: #fff;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.breadcrumb a {
    color: var(--link);
    text-decoration: none;
    white-space: nowrap;
    flex: 0 0 auto;
}

.breadcrumb span {
    margin: 0 0.4rem;
    color: #2E333D;
    flex: 0 0 auto;
}

/* --- 4. STRUKTURA STRÁNKY A OBSAH --- */

.page-header {
    padding: var(--breadcrumbs-offset-top) 0 1rem 0;
}

.page-header h1 {
    font-size: 1.8rem;
    color: var(--dark);
    font-weight: 700;
}

.content-area {
    width: 100%;
    padding: 1.5rem 0 4rem 0;
}

/* --- 5. PATIČKA (FOOTER) --- */

.site-footer {
    flex-shrink: 0;
    background-color: var(--white);
    border-top: 1px solid var(--border);
    padding-top: 30px;
    padding-bottom: 30px;
    margin-top: auto;
}

.footer-about a {
    color: var(--dark);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-about a:hover {
    color: var(--primary);
}

.footer-text {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

/* --- 6. STRUKTURA CVIČENÍ (LAYOUT PRO HRU) --- */

.exercise-layout {
    width: 100%;
    margin: var(--breadcrumbs-offset-top) auto 0 auto;
    min-height: 70vh;
}

/* Override older inline templates that still use margin-top: 20px on exercise pages. */
.exercise-layout[style*="margin-top"] {
    margin-top: var(--breadcrumbs-offset-top) !important;
}

.exercise-frame {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 40px; 
    margin-top: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    box-sizing: border-box;
}

.exercise-title {
    margin-top: var(--h1-margin-y);
    margin-bottom: var(--h1-margin-y);
}

/* --- 7. RESPONZIVITA --- */

@media (max-width: 768px) {
    .navbar-content {
        flex-direction: column;
        padding: 1.5rem 0;
        gap: 1rem;
    }

    .nav-links {
        display: flex;
        justify-content: center;
        flex-wrap: nowrap;
        gap: 8px;
        margin: 0;
        width: 100%;
        padding: 0 10px 0 0;
        box-sizing: border-box;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links a {
        margin: 0;
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
        flex: 0 0 auto;
    }

    .exercise-frame {
        padding: 20px 15px;
    }
}