/* Styly pro stránku testu (bez navbaru) */
:root {
    --primary-color: #519020;
    --primary-hover: #457a1c;
    --text-color: #1a1a1a;
    --text-muted: #6c757d;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.08);
    --radius-md: 8px;
    --radius-lg: 12px;
    --error-bg: #fff5f5;
    --error-color: #dc3545;
    --error-border: #ffc9c9;
}

body.test-body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-color);
}

.test-container {
    width: 100%;
    max-width: 1200px; /* Roztáhneme kontejner pro dvousloupcový layout */
    margin: 0 auto;
    padding: 20px;
}

/* Progress bar */
.task-progress {
    margin-bottom: 20px;
}

.progress-text {
    display: block;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-align: right;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background-color: #e9ecef;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background-color: var(--primary-color);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 6px;
}

/* Task Card */
.test-task, .test-results {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.test-task::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--primary-color);
}

/* Typography */
.task-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 15px;
    line-height: 1.3;
}

/* Task Layout Grid */
.task-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin-bottom: 30px;
    align-items: start;
}

@media (min-width: 992px) {
    /* Na desktopu dva sloupce, pokud jsou obrázky */
    .task-layout.has-images {
        grid-template-columns: 6fr 4fr; /* 60% text, 40% obrázky */
    }
}

/* Images Column */
.task-visuals {
    width: 100%;
}

.task-images-grid {
    display: grid;
    gap: 15px;
    width: 100%;
    /* Automaticky seřadí obrázky vedle sebe, pokud se vejdou */
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

/* Pro jeden obrázek chceme, aby nebyl zbytečně obrovský, ale vyplnil prostor */
.task-images-grid.single-image {
    grid-template-columns: 1fr;
}

.task-image-container {
    width: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s ease;
    /* Omezení výšky obrázků */
    max-height: 400px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Zarovnáme nahoru, aby to vypadalo lépe v gridu */
    background-color: transparent;
}

.task-img {
    width: auto;
    max-width: 100%;
    max-height: 400px; /* Omezení výšky samotného obrázku */
    display: block;
    object-fit: contain; /* Aby se obrázek nedeformoval a vešel se */
    border-radius: var(--radius-md);
}

/* Text Content */
.task-text-content {
    font-size: 18px; /* Ještě trochu větší pro čitelnost */
    line-height: 1.6;
    color: var(--text-color);
}

.task-text-content p:last-child {
    margin-bottom: 0;
}

/* Clean up old styles */
.task-text, .task-info-box, .task-images, .task-images-inner {
    display: none; /* Skryjeme staré třídy pro jistotu */
}

/* Questions Section */
.questions-section {
    margin-top: 25px;
}

.questions-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-color);
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
    display: inline-block;
}

.question-item {
    margin-bottom: 20px;
    background-color: #fff;
    padding: 0;
}

.question-label {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 10px;
    color: var(--text-color);
    display: block;
}

/* Form Inputs */
.answer-input-wrapper {
    position: relative;
}

.answer-input {
    width: 100%;
    padding: 10px 15px;
    font-size: 15px;
    color: var(--text-color);
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-family: inherit;
}

.answer-input:focus {
    background-color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(81, 144, 32, 0.15);
    outline: none;
}

.answer-input::placeholder {
    color: #adb5bd;
}

.answer-input.error {
    border-color: var(--error-color);
    background-color: var(--error-bg);
}

.answer-input.error:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.error-message {
    color: var(--error-color);
    font-size: 13px;
    margin-top: 5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.error-message::before {
    content: '!';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background-color: var(--error-color);
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
}

/* Submit Button */
.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    width: 100%;
    margin-top: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-submit:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-submit:active {
    transform: translateY(0);
}

/* Results Page */
.results-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 5px;
}

.test-name {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.results-summary {
    text-align: center;
    margin-bottom: 30px;
}

.score-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 25px 40px;
    background-color: var(--primary-color);
    border-radius: var(--radius-lg);
    color: white;
    box-shadow: 0 5px 15px rgba(81, 144, 32, 0.2);
    position: relative;
    overflow: hidden;
}

.score-box::after {
    display: none;
}

.score-number {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 5px;
}

.score-label {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Result Items */
.task-result {
    margin-bottom: 30px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.task-result:last-child {
    border-bottom: none;
}

.task-title-result {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-color);
}

.task-text-result {
    font-size: 15px;
    color: var(--text-muted);
    background-color: #f8f9fa;
    padding: 10px 15px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border-left: 3px solid #dee2e6;
}

.result-item {
    background-color: #fff;
    border: 1px solid #edf2f7;
    border-radius: var(--radius-md);
    padding: 15px;
    margin-bottom: 15px;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.result-item.correct {
    border-left: 4px solid var(--primary-color);
    background-color: rgba(81, 144, 32, 0.02);
}

.result-item.incorrect {
    border-left: 4px solid var(--error-color);
    background-color: rgba(220, 53, 69, 0.02);
}

.result-question {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 15px;
}

.question-number {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.result-answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: var(--radius-md);
}

.answer-row {
    display: flex;
    flex-direction: column;
}

.answer-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.answer-value {
    font-size: 15px;
    font-weight: 600;
}

.user-answer {
    color: var(--text-color);
}

.correct-answer {
    color: var(--primary-color);
}

.result-status {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    font-size: 14px;
}

.result-item.correct .result-status { color: var(--primary-color); }
.result-item.incorrect .result-status { color: var(--error-color); }

/* Actions */
.results-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.btn-back, .btn-restart {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s ease;
    text-align: center;
    min-width: 150px;
}

.btn-back {
    background-color: #f1f3f5;
    color: var(--text-color);
    border: 1px solid transparent;
}

.btn-back:hover {
    background-color: #e9ecef;
    transform: translateY(-1px);
    color: var(--text-color);
}

.btn-restart {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 5px rgba(81, 144, 32, 0.2);
}

.btn-restart:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(81, 144, 32, 0.3);
    color: white;
}

/* Úvodní stránka */
.test-intro {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-md);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.test-intro::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--primary-color);
}

.intro-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 30px;
    line-height: 1.3;
}

.intro-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 40px;
    text-align: left;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary-color);
}

.info-item.important {
    background-color: rgba(81, 144, 32, 0.1);
    border-left-color: var(--primary-color);
    border-left-width: 4px;
}

.info-item i {
    font-size: 24px;
    color: var(--primary-color);
    min-width: 30px;
}

.info-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 16px;
}

.info-value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 18px;
    margin-left: auto;
}

.intro-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-start-test {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 35px;
    font-size: 18px;
    font-weight: 600;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-start-test:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(81, 144, 32, 0.3);
    color: white;
}

.btn-back-intro {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #f1f3f5;
    color: var(--text-color);
    border: 1px solid transparent;
    padding: 15px 35px;
    font-size: 18px;
    font-weight: 600;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-back-intro:hover {
    background-color: #e9ecef;
    transform: translateY(-1px);
    color: var(--text-color);
}

/* Navigace mezi úlohami */
.task-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    gap: 15px;
    flex-wrap: wrap;
}

.nav-left {
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

.nav-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
}

.btn-nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.2s ease;
    background-color: #f1f3f5;
    color: var(--text-color);
    border: 1px solid transparent;
}

.btn-nav:hover {
    background-color: #e9ecef;
    transform: translateY(-1px);
    color: var(--text-color);
}

.btn-nav.btn-next {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 2px 5px rgba(81, 144, 32, 0.2);
}

.btn-nav.btn-next:hover {
    background-color: var(--primary-hover);
    box-shadow: 0 4px 10px rgba(81, 144, 32, 0.3);
    color: white;
}

/* Varovná zpráva */
.warning-message {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.warning-message i {
    font-size: 18px;
    flex-shrink: 0;
}

/* Loading overlay */
.loading-overlay {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.25em;
}

/* Smooth transitions */
.test-task {
    transition: opacity 0.3s ease;
}

.task-content {
    transition: opacity 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .test-container {
        padding: 15px;
    }
    
    .test-task, .test-results {
        padding: 20px;
    }
    
    .task-title {
        font-size: 22px;
    }
    
    .task-text, .task-info-box {
        font-size: 15px;
        padding: 12px;
    }
    
    .result-answers {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .btn-submit, .btn-back, .btn-restart {
        width: 100%;
    }
    
    .intro-title {
        font-size: 26px;
    }
    
    .test-intro {
        padding: 25px;
    }
    
    .intro-info {
        gap: 15px;
    }
    
    .info-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .info-value {
        margin-left: 0;
    }
    
    .intro-actions {
        flex-direction: column;
    }
    
    .btn-start-test, .btn-back-intro {
        width: 100%;
    }
    
    .task-navigation {
        flex-direction: column;
    }
    
    .nav-left, .nav-right {
        width: 100%;
        justify-content: center;
    }
    
    .btn-nav {
        flex: 1;
    }
    
    .btn-submit {
        flex: 1;
    }
}
