/* ============================================
   SOTCON Academy - Phase C Stylesheet
   Sotcon-Branding: Off-White, Dunkelgrün, Gold
   ============================================ */

:root {
    --sotcon-bg: #f5f3ef;
    --sotcon-green: #1a3a2e;
    --sotcon-green-light: #2d5246;
    --sotcon-gold: #d4a347;
    --sotcon-gold-light: #e6bf6f;
    --sotcon-text: #1a3a2e;
    --sotcon-text-light: #5a6c64;
    --sotcon-border: #e0ddd6;
    --sotcon-card-bg: #ffffff;
    --sotcon-success: #2d8659;
    --sotcon-warning: #c14545;
    --sotcon-info: #4a7c8c;
}

/* ============================================
   DASHBOARD
   ============================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--sotcon-card-bg);
    border: 1px solid var(--sotcon-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(26, 58, 46, 0.1);
}

.stat-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--sotcon-green);
}

.stat-card-icon {
    font-size: 2rem;
    line-height: 1;
}

.stat-card-title {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--sotcon-text-light);
    font-weight: 600;
}

.stat-card-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--sotcon-green);
    line-height: 1;
}

.stat-card-subtitle {
    font-size: 0.875rem;
    color: var(--sotcon-text-light);
    margin-top: 0.5rem;
}

.streak-flame {
    display: inline-block;
    animation: flicker 2s infinite alternate;
}

@keyframes flicker {
    0% { transform: scale(1) rotate(-2deg); }
    100% { transform: scale(1.1) rotate(2deg); }
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 12px;
    background: var(--sotcon-border);
    border-radius: 6px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sotcon-gold), var(--sotcon-gold-light));
    transition: width 0.6s ease;
    border-radius: 6px;
}

.progress-bar-fill.success {
    background: linear-gradient(90deg, var(--sotcon-success), #4ea878);
}

/* Topic Progress List */
.topic-progress-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.topic-progress-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--sotcon-card-bg);
    border-radius: 8px;
    border: 1px solid var(--sotcon-border);
}

.topic-progress-info {
    flex: 1;
}

.topic-progress-name {
    font-weight: 600;
    color: var(--sotcon-green);
    margin-bottom: 0.25rem;
}

.topic-progress-stats {
    font-size: 0.875rem;
    color: var(--sotcon-text-light);
}

/* ============================================
   MOCK EXAM (PROBEPRÜFUNG)
   ============================================ */

.mock-exam-intro {
    background: linear-gradient(135deg, var(--sotcon-green), var(--sotcon-green-light));
    color: white;
    padding: 3rem 2rem;
    border-radius: 12px;
    margin: 2rem 0;
    text-align: center;
}

.mock-exam-intro h1 {
    color: var(--sotcon-gold);
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.mock-exam-rules {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.mock-exam-rule {
    background: rgba(255,255,255,0.1);
    padding: 1.5rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.mock-exam-rule-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.mock-exam-rule-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--sotcon-gold);
}

.mock-exam-rule-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Timer */
.exam-timer {
    position: sticky;
    top: 1rem;
    background: var(--sotcon-green);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(26, 58, 46, 0.2);
}

.exam-timer.warning {
    background: var(--sotcon-warning);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Question Navigation */
.exam-nav {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 0.5rem;
    background: var(--sotcon-card-bg);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

.exam-nav-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--sotcon-border);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.exam-nav-btn.answered {
    background: var(--sotcon-success);
    color: white;
    border-color: var(--sotcon-success);
}

.exam-nav-btn.current {
    border-color: var(--sotcon-gold);
    background: var(--sotcon-gold);
    color: white;
}

.exam-nav-btn.flagged::after {
    content: '🚩';
    position: absolute;
    margin-left: -25px;
    margin-top: -10px;
    font-size: 0.8rem;
}

/* Exam Result */
.exam-result-hero {
    text-align: center;
    padding: 3rem 2rem;
    border-radius: 12px;
    margin: 2rem 0;
}

.exam-result-hero.passed {
    background: linear-gradient(135deg, var(--sotcon-success), #4ea878);
    color: white;
}

.exam-result-hero.failed {
    background: linear-gradient(135deg, var(--sotcon-warning), #d96565);
    color: white;
}

.exam-result-score {
    font-size: 5rem;
    font-weight: 700;
    line-height: 1;
}

.exam-result-label {
    font-size: 1.25rem;
    margin-top: 1rem;
    opacity: 0.95;
}

/* ============================================
   GLOSSAR
   ============================================ */

.glossar-search {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--sotcon-border);
    border-radius: 8px;
    font-size: 1rem;
    background: white;
}

.glossar-search:focus {
    outline: none;
    border-color: var(--sotcon-gold);
}

.glossar-categories {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.glossar-category-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--sotcon-border);
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.glossar-category-btn.active {
    background: var(--sotcon-green);
    color: white;
    border-color: var(--sotcon-green);
}

.glossar-list {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.glossar-item {
    background: white;
    border: 1px solid var(--sotcon-border);
    border-radius: 8px;
    padding: 1.25rem;
    border-left: 4px solid var(--sotcon-gold);
}

.glossar-term {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--sotcon-green);
    margin-bottom: 0.25rem;
}

.glossar-abbreviation {
    display: inline-block;
    background: var(--sotcon-bg);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--sotcon-text-light);
    margin-left: 0.5rem;
    font-family: monospace;
}

.glossar-definition {
    color: var(--sotcon-text);
    line-height: 1.6;
    margin-top: 0.5rem;
}

.glossar-meta {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: var(--sotcon-text-light);
}

/* ============================================
   FLASHCARDS
   ============================================ */

.flashcard-container {
    max-width: 600px;
    margin: 2rem auto;
    perspective: 1000px;
}

.flashcard {
    background: white;
    border: 2px solid var(--sotcon-border);
    border-radius: 16px;
    padding: 3rem 2rem;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    position: relative;
    box-shadow: 0 8px 24px rgba(26, 58, 46, 0.08);
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem 2rem;
    border-radius: 16px;
    backface-visibility: hidden;
}

.flashcard-back {
    transform: rotateY(180deg);
    background: var(--sotcon-green);
    color: white;
}

.flashcard-label {
    position: absolute;
    top: 1rem;
    left: 1.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--sotcon-text-light);
    font-weight: 600;
}

.flashcard-back .flashcard-label {
    color: var(--sotcon-gold);
}

.flashcard-content {
    font-size: 1.25rem;
    line-height: 1.6;
    overflow-y: auto;
    max-height: 200px;
}

.flashcard-front .flashcard-content {
    color: var(--sotcon-green);
    font-weight: 600;
}

.flashcard-quality-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.quality-btn {
    padding: 1rem;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.quality-btn:hover {
    transform: scale(1.05);
}

.quality-btn.again {
    background: var(--sotcon-warning);
}

.quality-btn.hard {
    background: #c8923a;
}

.quality-btn.good {
    background: var(--sotcon-success);
}

.quality-btn-label {
    display: block;
    font-size: 1rem;
    font-weight: 700;
}

.quality-btn-time {
    display: block;
    font-size: 0.75rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

/* ============================================
   ACHIEVEMENTS
   ============================================ */

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.achievement-card {
    background: white;
    border: 1px solid var(--sotcon-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.2s;
    position: relative;
}

.achievement-card.locked {
    opacity: 0.4;
    filter: grayscale(0.8);
}

.achievement-card.unlocked {
    border-color: var(--sotcon-gold);
    background: linear-gradient(135deg, white, #fefaf3);
}

.achievement-card.unlocked::before {
    content: '✓';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    background: var(--sotcon-success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.achievement-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.achievement-title {
    font-weight: 700;
    color: var(--sotcon-green);
    margin-bottom: 0.5rem;
}

.achievement-description {
    font-size: 0.875rem;
    color: var(--sotcon-text-light);
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.achievement-xp {
    display: inline-block;
    background: var(--sotcon-gold);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.achievement-earned-date {
    font-size: 0.75rem;
    color: var(--sotcon-text-light);
    margin-top: 0.5rem;
}

/* ============================================
   NOTIZEN
   ============================================ */

.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.note-card {
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--sotcon-border);
    position: relative;
    min-height: 150px;
}

.note-card.color-yellow { background: #fff9d6; border-color: #f0e68c; }
.note-card.color-blue { background: #d6ebff; border-color: #87ceeb; }
.note-card.color-green { background: #d4f0d4; border-color: #90c890; }
.note-card.color-pink { background: #ffd6e8; border-color: #f0a0c0; }
.note-card.color-purple { background: #e8d6ff; border-color: #b890e0; }

.note-card.pinned {
    border-width: 2px;
    border-color: var(--sotcon-gold);
}

.note-card.pinned::before {
    content: '📌';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
}

.note-title {
    font-weight: 700;
    color: var(--sotcon-green);
    margin-bottom: 0.5rem;
}

.note-text {
    color: var(--sotcon-text);
    line-height: 1.5;
    white-space: pre-wrap;
    font-size: 0.9375rem;
}

.note-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0,0,0,0.1);
    font-size: 0.75rem;
    color: var(--sotcon-text-light);
}

.note-actions {
    display: flex;
    gap: 0.25rem;
}

.note-action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.note-action-btn:hover {
    background: rgba(0,0,0,0.05);
}

/* ============================================
   FEEDBACK BUTTON / MODAL
   ============================================ */

.feedback-btn {
    background: transparent;
    border: 1px solid var(--sotcon-border);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    color: var(--sotcon-text-light);
    font-size: 0.875rem;
    transition: all 0.2s;
}

.feedback-btn:hover {
    background: var(--sotcon-bg);
    color: var(--sotcon-green);
}

.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(26, 58, 46, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-title {
    font-size: 1.5rem;
    color: var(--sotcon-green);
    margin-bottom: 1.5rem;
}

.feedback-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.feedback-option {
    padding: 0.75rem 1rem;
    border: 2px solid var(--sotcon-border);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.feedback-option:hover,
.feedback-option.selected {
    border-color: var(--sotcon-gold);
    background: #fefaf3;
}

/* ============================================
   GEMEINSAME UI-ELEMENTE
   ============================================ */

.btn-primary {
    background: var(--sotcon-green);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1rem;
}

.btn-primary:hover {
    background: var(--sotcon-green-light);
}

.btn-gold {
    background: var(--sotcon-gold);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1rem;
}

.btn-gold:hover {
    background: var(--sotcon-gold-light);
}

.btn-secondary {
    background: white;
    color: var(--sotcon-green);
    border: 2px solid var(--sotcon-border);
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.btn-secondary:hover {
    border-color: var(--sotcon-green);
}

.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--sotcon-text-light);
}

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

.empty-state-title {
    color: var(--sotcon-green);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--sotcon-green);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    z-index: 1100;
    animation: slideIn 0.3s ease, slideOut 0.3s ease 2.7s forwards;
}

.toast.success { background: var(--sotcon-success); }
.toast.error { background: var(--sotcon-warning); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    to { transform: translateX(100%); opacity: 0; }
}

/* Mobile */
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .stat-card-value { font-size: 2rem; }
    .mock-exam-intro h1 { font-size: 1.75rem; }
    .exam-result-score { font-size: 3.5rem; }
    .flashcard { padding: 2rem 1rem; }
    .flashcard-quality-buttons { grid-template-columns: 1fr; }
}
/* ============================================
   SOTCON Academy - Phase C Mobile Override
   Zielgeräte: iPhone SE bis iPhone Pro Max,
   Samsung Galaxy, Google Pixel, etc.
   
   Wird NACH phase-c.css geladen, daher !important
   nötig um Inline-Styles zu überschreiben.
   ============================================ */

/* ============================================
   GLOBAL: iOS Auto-Zoom verhindern
   Wenn Inputs unter 16px font-size haben, zoomt
   iOS automatisch beim Tap - sehr nervig!
   ============================================ */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="search"],
    input[type="tel"],
    textarea,
    select {
        font-size: 16px !important;
    }
    
    .glossar-search {
        font-size: 16px !important;
    }
}

/* ============================================
   GLOBAL: Touch-Targets (Apple HIG: 44x44 min)
   ============================================ */
@media (max-width: 768px) {
    button,
    .btn-primary,
    .btn-secondary,
    .btn-gold,
    a.btn-primary,
    a.btn-secondary,
    a.btn-gold,
    .glossar-category-btn,
    .nav-link,
    .feedback-btn,
    .feedback-option,
    .quality-btn {
        min-height: 44px !important;
    }
    
    .note-action-btn {
        min-width: 36px !important;
        min-height: 36px !important;
        padding: 0.5rem !important;
        font-size: 1.1rem !important;
    }
    
    /* Tap-Feedback sichtbar */
    button:active,
    .btn-primary:active,
    .btn-secondary:active,
    .btn-gold:active,
    .glossar-category-btn:active,
    .feedback-option:active,
    .quality-btn:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

/* ============================================
   GLOBAL: Container Padding reduzieren
   ============================================ */
@media (max-width: 600px) {
    .container {
        padding-left: 0.875rem !important;
        padding-right: 0.875rem !important;
    }
    
    /* Headlines kleiner auf Mobile */
    h1 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
        line-height: 1.3 !important;
    }
    
    h3 {
        font-size: 1.1rem !important;
    }
}

/* ============================================
   DASHBOARD - Stat Cards
   ============================================ */
@media (max-width: 600px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        margin: 1rem 0 !important;
    }
    
    .stat-card {
        padding: 1.25rem !important;
    }
    
    .stat-card-value {
        font-size: 2rem !important;
    }
    
    .stat-card-icon {
        font-size: 1.75rem !important;
    }
    
    /* Topic Progress kompakter */
    .topic-progress-item {
        padding: 0.875rem !important;
        gap: 0.75rem !important;
        flex-wrap: wrap;
    }
    
    .topic-progress-info {
        min-width: 0;
        flex: 1 1 100%;
    }
    
    .topic-progress-name {
        font-size: 0.95rem !important;
    }
}

/* ============================================
   MOCK EXAM - Probeprüfung
   ============================================ */
@media (max-width: 768px) {
    /* Intro-Hero kompakter */
    .mock-exam-intro {
        padding: 2rem 1rem !important;
    }
    
    .mock-exam-intro h1 {
        font-size: 1.75rem !important;
    }
    
    .mock-exam-rules {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    .mock-exam-rule {
        padding: 1rem 0.75rem !important;
    }
    
    .mock-exam-rule-value {
        font-size: 1.5rem !important;
    }
    
    .mock-exam-rule-label {
        font-size: 0.75rem !important;
    }
    
    /* Timer kompakt */
    .exam-timer {
        font-size: 1.1rem !important;
        padding: 0.65rem 1rem !important;
        top: 0.5rem !important;
    }
    
    /* Frage-Container */
    .container > div[style*="padding:2rem"] {
        padding: 1.25rem !important;
    }
    
    /* Question Navigation - Touch-freundlich */
    .exam-nav {
        grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)) !important;
        gap: 0.4rem !important;
        padding: 0.75rem !important;
    }
    
    .exam-nav-btn {
        width: 100% !important;
        height: 44px !important;
        min-width: 44px !important;
    }
    
    /* Result Hero */
    .exam-result-score {
        font-size: 3.5rem !important;
    }
    
    .exam-result-label {
        font-size: 1.05rem !important;
    }
    
    /* Result Stats - Override 4-Spalten zu 2 */
    .container .dashboard-grid[style*="repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 380px) {
    .mock-exam-rules {
        grid-template-columns: 1fr !important;
    }
    
    .container .dashboard-grid[style*="repeat(4"] {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   FLASHCARDS - Karteikarten
   ============================================ */
@media (max-width: 768px) {
    .flashcard-container {
        margin: 1rem auto !important;
    }
    
    .flashcard {
        padding: 2rem 1.25rem !important;
        min-height: 280px !important;
    }
    
    .flashcard-front,
    .flashcard-back {
        padding: 2rem 1.25rem !important;
    }
    
    .flashcard-content {
        font-size: 1.05rem !important;
        line-height: 1.5 !important;
    }
    
    .flashcard-quality-buttons {
        grid-template-columns: 1fr !important;
        gap: 0.65rem !important;
    }
    
    .quality-btn {
        padding: 0.875rem 1rem !important;
    }
    
    /* Tastatur-Hinweis ausblenden auf Mobile */
    .flashcard-container ~ div[style*="Tipp:"],
    .flashcard-container + div + div {
        display: none !important;
    }
}

/* ============================================
   GLOSSAR
   ============================================ */
@media (max-width: 600px) {
    .glossar-search {
        padding: 0.875rem 1rem !important;
    }
    
    .glossar-categories {
        gap: 0.4rem !important;
        margin: 0.75rem 0 !important;
    }
    
    .glossar-category-btn {
        padding: 0.5rem 0.85rem !important;
        font-size: 0.825rem !important;
    }
    
    .glossar-item {
        padding: 1rem !important;
    }
    
    .glossar-term {
        font-size: 1rem !important;
    }
    
    .glossar-definition {
        font-size: 0.925rem !important;
    }
}

/* ============================================
   ACHIEVEMENTS
   ============================================ */
@media (max-width: 768px) {
    .achievements-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    .achievement-card {
        padding: 1rem 0.75rem !important;
    }
    
    .achievement-icon {
        font-size: 2.25rem !important;
    }
    
    .achievement-title {
        font-size: 0.875rem !important;
    }
    
    .achievement-description {
        font-size: 0.8125rem !important;
        line-height: 1.35 !important;
    }
    
    .achievement-xp {
        font-size: 0.75rem !important;
    }
}

@media (max-width: 360px) {
    .achievements-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ============================================
   NOTIZEN
   ============================================ */
@media (max-width: 600px) {
    .notes-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    .note-card {
        padding: 1rem !important;
        min-height: 120px !important;
    }
    
    .note-text {
        font-size: 0.9rem !important;
    }
}

/* ============================================
   QUIZ / WEAK QUESTIONS - Antwort-Optionen
   ============================================ */
@media (max-width: 600px) {
    /* Quiz-Antwort-Labels Touch-friendly */
    label[style*="display:flex"][style*="background:var(--sotcon-bg)"] {
        padding: 0.875rem !important;
        gap: 0.65rem !important;
    }
    
    label[style*="display:flex"][style*="background:var(--sotcon-bg)"] input {
        min-width: 22px !important;
        min-height: 22px !important;
        margin-top: 0.15rem !important;
    }
    
    /* Buttons in Form-Footer */
    .container form > div[style*="justify-content"] {
        flex-direction: column !important;
        gap: 0.65rem !important;
    }
    
    .container form > div[style*="justify-content"] button,
    .container form > div[style*="justify-content"] a {
        width: 100% !important;
        text-align: center !important;
    }
}

/* ============================================
   MODALS - Auf Mobile fast Vollbild
   ============================================ */
@media (max-width: 600px) {
    .modal-overlay {
        padding: 0.5rem !important;
        align-items: flex-end !important;
    }
    
    .modal-content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1.5rem 1.25rem !important;
        max-height: 85vh !important;
        border-radius: 16px 16px 0 0 !important;
        animation: slideUp 0.3s ease;
    }
    
    .modal-title {
        font-size: 1.25rem !important;
    }
    
    .feedback-options {
        gap: 0.4rem !important;
    }
    
    .feedback-option {
        padding: 0.75rem !important;
        font-size: 0.9rem !important;
    }
    
    /* Color-Picker größere Touch-Targets */
    .modal-content label[style*="cursor:pointer"] .note-card {
        width: 48px !important;
        height: 48px !important;
    }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ============================================
   NAVIGATION - Mobile Menü
   ============================================ */
@media (max-width: 900px) {
    .nav-phase-c {
        flex-direction: column !important;
        align-items: stretch !important;
        background: var(--sotcon-green-light);
        padding: 0.5rem !important;
    }
    
    .nav-link {
        justify-content: flex-start !important;
        padding: 0.75rem 1rem !important;
    }
    
    /* Streak/Level-Badge oben rechts */
    .nav-phase-c > div[style*="margin-left:auto"] {
        margin-left: 0 !important;
        justify-content: space-between !important;
        padding: 0.5rem 1rem;
        background: rgba(0,0,0,0.15);
        border-radius: 6px;
    }
}

/* ============================================
   QUICK ACTIONS auf Dashboard - Karten
   ============================================ */
@media (max-width: 600px) {
    /* Quick-Action-Karten (mit Hover-Link-Style) */
    a.stat-card[href] {
        padding: 1rem !important;
    }
    
    a.stat-card[href] h3 {
        font-size: 1.05rem !important;
        margin: 0.4rem 0 !important;
    }
    
    a.stat-card[href] p {
        font-size: 0.825rem !important;
    }
    
    a.stat-card[href] .stat-card-icon {
        font-size: 2rem !important;
    }
}

/* ============================================
   READING-TIME-INDICATOR (chapter.php)
   Auf Mobile in eigene Zeile umbrechen
   ============================================ */
@media (max-width: 600px) {
    #readingTimeIndicator {
        margin-left: 0 !important;
        flex-basis: 100% !important;
        order: 99 !important;
        padding-top: 0.5rem !important;
        border-top: 1px solid var(--sotcon-border);
    }
}

/* ============================================
   TOAST - Auf Mobile zentriert oben statt unten
   ============================================ */
@media (max-width: 600px) {
    .toast {
        bottom: auto !important;
        top: 1rem !important;
        right: 1rem !important;
        left: 1rem !important;
        text-align: center;
        font-size: 0.9rem !important;
    }
}

/* ============================================
   TABELLE Top-10 Schwachstellen
   Bei sehr engen Screens umstrukturieren
   ============================================ */
@media (max-width: 480px) {
    /* Top-10 Liste - vertikal statt horizontal */
    .container > div[style*="overflow:hidden"] > div[style*="padding:1rem 1.5rem"] > div[style*="gap:1rem"] {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }
    
    .container > div[style*="overflow:hidden"] > div[style*="padding:1rem 1.5rem"] > div[style*="gap:1rem"] > div:last-child {
        text-align: left !important;
    }
}

/* ============================================
   EXAM-TIMER - Sticky-Position mit Mobile-Header
   ============================================ */
@media (max-width: 600px) {
    .exam-timer {
        position: sticky !important;
        top: 0 !important;
        margin: 0 -0.875rem 1rem -0.875rem !important;
        border-radius: 0 !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }
}

/* ============================================
   ZUGÄNGLICHKEIT - Reduced Motion Support
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   DARK MODE FALLBACK
   (falls Smartphones im Dunkelmodus laufen)
   Behalten unsere Off-White Farben
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Sotcon-Branding bleibt heller, nicht erzwungen dunkel */
    :root {
        color-scheme: light;
    }
}

/* ============================================
   LANDSCAPE MODE auf kleinen Geräten
   Bei Querformat bessere Nutzung der Höhe
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .mock-exam-intro {
        padding: 1.5rem 1rem !important;
    }
    
    .mock-exam-intro h1 {
        font-size: 1.5rem !important;
    }
    
    .flashcard {
        min-height: 200px !important;
        padding: 1.5rem 1.25rem !important;
    }
    
    .exam-result-score {
        font-size: 2.5rem !important;
    }
}
