/**
 * ============================================================
 * style.css – Custom Styles für Staatsexamen Lernprogramm
 * ============================================================
 * Ergänzt Bootstrap 5 mit eigenen Styles.
 * 
 * CSS-Lernpunkte:
 * - CSS Custom Properties (Variablen) mit var(--name)
 * - Pseudo-Klassen (:hover, :focus, :active)
 * - Flexbox und Grid-Ergänzungen
 * - Transitions für Animationen
 */

/* ============================================================
   CSS-Variablen (Custom Properties)
   Definiert in :root = gelten überall im Dokument
   ============================================================ */
:root {
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-success: #16a34a;
    --color-warning: #d97706;
    --color-danger: #dc2626;
    --color-purple: #7c3aed;
    --color-bg-light: #f8fafc;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --font-body: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --radius: 0.5rem;
    --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
}

/* ============================================================
   Basis-Styles
   ============================================================ */
body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-bg-light);
}

/* ============================================================
   Frage-Vorschau in der Liste (quiz.php)
   ============================================================ */
.question-preview {
    font-size: 0.9rem;
    line-height: 1.5;
    /* Text nach 2 Zeilen abschneiden (mehrzeilig) */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hover-Effekt für Listeneinträge */
.list-group-item-action {
    transition: background-color 0.15s ease, transform 0.1s ease;
    border-left: 3px solid transparent;
}

.list-group-item-action:hover {
    border-left-color: var(--color-primary);
    transform: translateX(2px);
}

/* Beantwortete Fragen leicht abgedimmt */
.list-group-item-light {
    opacity: 0.75;
}

.list-group-item-light:hover {
    opacity: 1;
}

/* ============================================================
   Antwort-Buttons (question.php)
   ============================================================ */
.answer-btn {
    transition: all 0.2s ease;
    border-radius: var(--radius);
    font-size: 0.95rem;
}

.answer-btn:hover {
    /* Leichter Schatten + Verschiebung = "hebt sich ab" */
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

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

/* Gewählte Antwort (nach Klick, vor AJAX-Response) */
.answer-btn.selected {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* Antwort-Buttons deaktiviert (nach Beantwortung) */
.answer-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ============================================================
   Statistik-Balken (nach Beantwortung)
   ============================================================ */
.answer-stat {
    transition: all 0.3s ease;
    background-color: white;
}

.answer-stat:hover {
    background-color: #f1f5f9;
}

.progress {
    border-radius: 999px;
    background-color: #e2e8f0;
}

.progress-bar {
    /* Animation: Balken "wächst" von links */
    transition: width 0.8s ease-out;
    border-radius: 999px;
}

/* ============================================================
   Fragetext
   ============================================================ */
.question-text {
    font-size: 1.05rem;
    line-height: 1.7;
    white-space: pre-line;
}

/* ============================================================
   Bild-Platzhalter
   ============================================================ */
.image-placeholder {
    background: linear-gradient(135deg, #e2e8f0 0%, #f1f5f9 100%);
    border: 2px dashed #94a3b8;
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    color: var(--color-text-muted);
}

.image-placeholder i {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* ============================================================
   Badges & Tags
   ============================================================ */
/* Lila Badge für Duplikat-Zähler */
.bg-purple {
    background-color: var(--color-purple) !important;
    color: white;
}

.badge {
    font-weight: 500;
}

/* ============================================================
   Kommentare
   ============================================================ */
.comment-item {
    padding: 0.75rem 0;
}

.comment-item:last-child {
    border-bottom: none !important;
}

/* ============================================================
   Karten (Cards)
   ============================================================ */
.card {
    border: none;
    border-radius: var(--radius);
}

.card-header {
    border-bottom: 1px solid #e2e8f0;
    background-color: white;
    font-weight: 600;
}

/* ============================================================
   Responsive Anpassungen
   ============================================================ */

/* Auf kleinen Bildschirmen: Filter-Sidebar wird zum Accordion */
@media (max-width: 991.98px) {
    .question-preview {
        -webkit-line-clamp: 1;
    }
}

/* Druckansicht */
@media print {
    .navbar, .btn, form, .progress {
        display: none !important;
    }
    
    .answer-stat {
        break-inside: avoid;
    }
}

/* ============================================================
   Loading-Spinner (für AJAX-Requests)
   ============================================================ */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Pulsierender Punkt während des Ladens */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.loading-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}
