/* test.rsbad.de - Styling */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* Navbar */
.navbar {
    background: #4A90E2;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-menu {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
}

.btn-menu:hover {
    background: rgba(255,255,255,0.3);
}

.user-menu {
    position: fixed;
    top: 60px;
    right: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    padding: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: #333;
}

.login-box p {
    text-align: center;
    color: #666;
    margin-bottom: 1.5rem;
}

/* Card */
.card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.card h2 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: #4A90E2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.85rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn-primary {
    background: #4A90E2;
    color: white;
}

.btn-primary:hover {
    background: #357ABD;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-block {
    width: 100%;
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* Exam Grid */
.exam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.exam-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    background: #fafafa;
    transition: transform 0.2s, box-shadow 0.2s;
}

.exam-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.exam-card h3 {
    margin-bottom: 0.5rem;
    color: #333;
}

.exam-card p {
    color: #666;
    margin-bottom: 1rem;
}

.exam-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-success {
    background: #28a745;
    color: white;
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.data-table tbody tr:hover {
    background: #f8f9fa;
}

/* Exam */
.timer {
    background: rgba(255,255,255,0.2);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 600;
}

.exam-header {
    margin-bottom: 2rem;
}

.exam-info {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #ddd;
    color: #666;
}

.question-block {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #dee2e6;
}

.question-number {
    font-weight: bold;
    color: #4A90E2;
    margin-bottom: 0.5rem;
}

.question-text {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: #333;
}

.mc-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.mc-option {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.mc-option:hover {
    border-color: #4A90E2;
    background: #f0f7ff;
}

.mc-option input {
    margin-right: 1rem;
}

.mc-option span {
    flex: 1;
}

.exam-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #dee2e6;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 2rem;
    border: 1px solid #888;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: black;
}

/* Question Images */
.question-image {
    margin: 1rem 0;
    text-align: center;
}

.question-image img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Match (Zuordnung) */
.match-container {
    margin: 1rem 0;
}

.match-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.match-left h4,
.match-right h4 {
    margin-bottom: 1rem;
    color: #333;
}

.match-item {
    background: #4A90E2;
    color: white;
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    cursor: move;
    user-select: none;
}

.match-item:hover {
    background: #357ABD;
}

.match-target {
    margin-bottom: 0.5rem;
}

.match-target-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.match-drop-zone {
    min-height: 50px;
    background: white;
    border: 2px dashed #dee2e6;
    border-radius: 4px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.match-drop-zone.dragover {
    border-color: #4A90E2;
    background: #f0f7ff;
}

.match-placeholder {
    color: #999;
    font-style: italic;
}

.match-item-dropped {
    background: #28a745;
    color: white;
    padding: 0.75rem;
    border-radius: 4px;
    width: 100%;
}

/* Fill Blank (Lückentext) */
.fill-blank-container {
    margin: 1rem 0;
}

.blank-item {
    margin-bottom: 1rem;
}

.blank-hint {
    color: #666;
    font-size: 0.9rem;
    font-style: italic;
}

.blank-input {
    max-width: 300px;
}

/* Grid Color (Raster färben) */
.grid-color-container {
    margin: 1rem 0;
}

.grid-color {
    display: grid;
    grid-template-columns: repeat(auto-fit, 50px);
    gap: 4px;
    max-width: fit-content;
}

.grid-cell {
    width: 50px;
    height: 50px;
    border: 2px solid #333;
    cursor: pointer;
    transition: transform 0.1s;
}

.grid-cell:hover {
    transform: scale(1.1);
}

.grid-cell.black {
    background: #000;
}

.grid-cell.white {
    background: #fff;
}

.grid-legend {
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
}

.grid-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.grid-legend .grid-cell {
    width: 30px;
    height: 30px;
    cursor: default;
}

.grid-legend .grid-cell:hover {
    transform: none;
}

/* Binary Visual (Binärdarstellung) */
.binary-visual-container {
    margin: 1rem 0;
}

.binary-grid {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.binary-bit-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.binary-bit-value {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.binary-bit {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    background: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.binary-bit:hover {
    border-color: #4A90E2;
}

.binary-bit.active {
    background: #4A90E2;
    color: white;
    border-color: #357ABD;
}

.binary-result {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
    font-weight: bold;
    text-align: center;
}

/* Table Fill (Tabelle ausfüllen) */
.table-fill-container {
    margin: 1rem 0;
    overflow-x: auto;
}

.table-fill {
    width: 100%;
    border-collapse: collapse;
}

.table-fill th,
.table-fill td {
    padding: 0.75rem;
    text-align: left;
    border: 1px solid #dee2e6;
}

.table-fill th {
    background: #f8f9fa;
    font-weight: 600;
}

.table-cell-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.table-cell-input:focus {
    outline: none;
    border-color: #4A90E2;
}

/* Huffman Tree */
.huffman-container {
    margin: 1rem 0;
}

.huffman-instruction {
    margin-bottom: 1rem;
    color: #666;
    font-style: italic;
}

.huffman-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.huffman-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.huffman-freq {
    font-size: 0.9rem;
    color: #666;
    font-weight: normal;
}

.huffman-code-input {
    width: 100%;
    font-family: 'Courier New', monospace;
}

/* Results Page */
.result-summary {
    text-align: center;
    padding: 2rem 0;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 2rem;
}

.result-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.score-circle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    width: 200px;
    height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.score-value {
    font-size: 2rem;
    font-weight: bold;
}

.score-percentage {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

.score-grade {
    font-size: 1.5rem;
    padding: 1rem 2rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.score-grade strong {
    font-size: 2.5rem;
    color: #4A90E2;
    margin-left: 0.5rem;
}

.result-details {
    margin-top: 2rem;
}

.result-question {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid #4A90E2;
}

.result-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

.result-question-number {
    font-weight: bold;
    color: #4A90E2;
}

.result-question-points {
    font-weight: bold;
    color: #333;
}

.result-question-text {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.result-mc-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.result-mc-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 4px;
}

.result-mc-option.correct {
    border-color: #28a745;
    background: #d4edda;
}

.result-mc-option.wrong.selected {
    border-color: #dc3545;
    background: #f8d7da;
}

.result-mc-option.selected {
    font-weight: bold;
}

.result-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.result-badge.correct {
    background: #28a745;
    color: white;
}

.result-badge.wrong {
    background: #dc3545;
    color: white;
}

.result-text-answer,
.result-other-answer {
    margin-top: 1rem;
}

.result-label {
    font-weight: 600;
    color: #666;
    margin-bottom: 0.5rem;
}

.result-text-content {
    padding: 1rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.result-info {
    text-align: center;
    padding: 2rem;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .exam-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .exam-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .match-columns {
        grid-template-columns: 1fr;
    }

    .binary-grid {
        flex-wrap: wrap;
    }

    .huffman-inputs {
        grid-template-columns: 1fr;
    }
}
