/* Lernmanager - German UI Styles */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #ca8a04;
    --danger: #dc2626;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-900);
    line-height: 1.5;
}

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

/* Navigation */
nav {
    background: var(--primary);
    color: white;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

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

nav a {
    color: white;
    text-decoration: none;
}

nav a:hover {
    text-decoration: underline;
}

nav .logo {
    font-size: 1.25rem;
    font-weight: bold;
}

nav .nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1rem;
}

.card-header {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--gray-200);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background: white url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") right 0.5rem center/1.5em 1.5em no-repeat;
}

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

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
}

.table tr:hover {
    background: var(--gray-50);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Grid */
.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
    .grid-2, .grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary {
    background: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Progress */
.progress-container {
    background: var(--gray-200);
    border-radius: 9999px;
    height: 0.5rem;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.progress-bar.complete {
    background: var(--success);
}

/* Task Cards */
.task-card {
    border-left: 4px solid var(--primary);
}

.task-card.bonus {
    border-left-color: var(--warning);
}

.task-card.complete {
    border-left-color: var(--success);
    opacity: 0.8;
}

/* Subtask List */
.subtask-list {
    list-style: none;
}

.subtask-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--gray-100);
}

.subtask-item:last-child {
    border-bottom: none;
}

.subtask-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.subtask-item.completed .subtask-text {
    text-decoration: line-through;
    color: var(--gray-500);
}

/* Enhanced Subtask Cards */
.subtask-list-enhanced {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.subtask-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--gray-50);
    border-radius: 0.5rem;
    border: 1px solid var(--gray-200);
    transition: all 0.2s ease;
}

.subtask-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.subtask-card.completed {
    background: linear-gradient(to right, #ecfdf5, var(--gray-50));
    border-color: var(--success);
}

.subtask-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.subtask-card.completed .subtask-number {
    background: var(--success);
}

.subtask-content {
    flex: 1;
    min-width: 0;
}

.subtask-card.completed .subtask-text {
    text-decoration: line-through;
    color: var(--gray-500);
}

.subtask-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.subtask-toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.subtask-checkmark {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--gray-300);
    border-radius: 0.375rem;
    background: white;
    transition: all 0.2s ease;
}

.subtask-toggle:hover .subtask-checkmark {
    border-color: var(--primary);
}

.subtask-toggle input:checked + .subtask-checkmark {
    background: var(--success);
    border-color: var(--success);
}

.subtask-toggle input:checked + .subtask-checkmark::after {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    height: 100%;
}

.subtask-toggle input:disabled + .subtask-checkmark {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Rating Stars/Points */
.rating-group {
    display: flex;
    gap: 0.5rem;
}

.rating-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid var(--gray-300);
    border-radius: 0.375rem;
    background: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.rating-btn:hover {
    border-color: var(--primary);
}

.rating-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.rating-btn.active-1 { background: #ef4444; border-color: #ef4444; color: white; }
.rating-btn.active-2 { background: #f59e0b; border-color: #f59e0b; color: white; }
.rating-btn.active-3 { background: #22c55e; border-color: #22c55e; color: white; }

/* Materials */
.material-list {
    list-style: none;
}

.material-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--gray-50);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

.material-icon {
    font-size: 1.25rem;
}

/* Quiz */
.quiz-question {
    background: var(--gray-50);
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.quiz-question h4 {
    margin-bottom: 0.75rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.quiz-option:hover {
    border-color: var(--primary);
}

.quiz-option.correct {
    background: #dcfce7;
    border-color: #22c55e;
}

.quiz-option.incorrect {
    background: #fee2e2;
    border-color: #ef4444;
}

.quiz-option.selected {
    background: #e0f2fe;
    border-color: #0284c7;
    font-weight: 500;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

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

.login-card h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--primary);
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

/* Emoji indicators */
.status-indicator {
    font-size: 1.5rem;
}

/* Attendance toggle */
.attendance-toggle {
    width: 3rem;
    height: 1.5rem;
    background: var(--gray-300);
    border-radius: 9999px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}

.attendance-toggle.active {
    background: var(--success);
}

.attendance-toggle::after {
    content: '';
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    background: white;
    border-radius: 50%;
    top: 0.125rem;
    left: 0.125rem;
    transition: transform 0.2s;
}

.attendance-toggle.active::after {
    transform: translateX(1.5rem);
}

/* Subtask Editor */
.subtask-edit-item {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.subtask-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.subtask-edit-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-weight: 600;
}

#subtask-list:empty::after {
    content: 'Keine Teilaufgaben. Klicke "+ Teilaufgabe" um eine hinzuzufügen.';
    color: var(--gray-500);
    font-style: italic;
    display: block;
    padding: 1rem;
    text-align: center;
}

/* Markdown Content Styles */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-content h1 { font-size: 1.5rem; }
.markdown-content h2 { font-size: 1.25rem; }
.markdown-content h3 { font-size: 1.125rem; }
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 { font-size: 1rem; }

.markdown-content p {
    margin-bottom: 0.75rem;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
}

.markdown-content li {
    margin-bottom: 0.25rem;
}

.markdown-content code {
    background: var(--gray-100);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.875em;
}

.markdown-content pre {
    background: var(--gray-100);
    padding: 1rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    margin-bottom: 0.75rem;
}

.markdown-content pre code {
    background: none;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
    margin: 0.75rem 0;
    color: var(--gray-700);
    font-style: italic;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0.75rem;
}

.markdown-content th,
.markdown-content td {
    border: 1px solid var(--gray-300);
    padding: 0.5rem;
    text-align: left;
}

.markdown-content th {
    background: var(--gray-100);
    font-weight: 600;
}

.markdown-content a {
    color: var(--primary);
    text-decoration: underline;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid var(--gray-300);
    margin: 1rem 0;
}

/* Markdown Editor with Preview */
.markdown-editor {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.markdown-editor textarea {
    min-height: 150px;
}

.markdown-preview {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: 0.375rem;
    padding: 0.75rem;
    min-height: 150px;
    overflow-y: auto;
}

.markdown-preview:empty::before {
    content: 'Vorschau...';
    color: var(--gray-500);
    font-style: italic;
}

@media (max-width: 768px) {
    .markdown-editor {
        grid-template-columns: 1fr;
    }
}
