/* ===================================================================
   LERNHILFE — App-spezifische Styles
   Gemeinsame Klassen (.btn, .btn-primary, etc.) kommen aus style.css
   =================================================================== */

.app-section {
    background: var(--color-bg-elevated);
    padding: 4rem 0;
    min-height: calc(100vh - 200px);
    border-top: 1px solid var(--color-border);
}

.app-container {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.app-header {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-bottom: 2px solid var(--color-accent);
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

.app-nav { display: flex; gap: 0.5rem; }

.nav-btn {
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-muted);
    font-family: var(--font-main);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--t);
}

.nav-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-text);
}

.nav-btn.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: white;
}

/* Section */
.section { display: none; padding: 1rem 0; }
.section.active { display: block; }

/* Menu */
.menu-container { max-width: 800px; margin: 0 auto; }

.menu-container h3 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1.5rem;
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2px;
    background: var(--color-border);
    margin-bottom: 3rem;
}

.mode-card {
    background: var(--color-bg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all var(--t);
}

.mode-card:hover {
    background: var(--color-bg-card);
    border-bottom-color: var(--color-accent);
}

.mode-icon { font-size: 2.5rem; margin-bottom: 1rem; }

.mode-card h4 { font-size: 1.25rem; margin-bottom: 0.75rem; }

.mode-card p { color: var(--color-text-muted); margin-bottom: 1.5rem; font-size: 0.875rem; }

.start-btn {
    background: var(--color-accent);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    font-family: var(--font-main);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t);
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}

.start-btn:hover { background: var(--color-accent-light); }

/* File Upload */
.file-upload-section {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    padding: 2rem;
    margin-bottom: 2rem;
}

.file-upload-section h4 { text-align: center; margin-bottom: 1.5rem; }

.server-files-section h5,
.upload-section h5 {
    margin-bottom: 1rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.server-files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2px;
    background: var(--color-border);
    margin-bottom: 2rem;
}

.server-file-card {
    background: var(--color-bg);
    padding: 1.5rem;
    border-bottom: 3px solid transparent;
    transition: all var(--t);
    text-align: center;
}

.server-file-card:hover { background: var(--color-bg-card); border-bottom-color: var(--color-accent); }

.server-file-card.loaded  { border-bottom-color: var(--color-success); }
.server-file-card.selected { background: var(--color-bg-card); border-bottom-color: var(--color-accent); }

.server-file-icon { font-size: 1.75rem; margin-bottom: 0.5rem; }

.server-file-name { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.4rem; }

.server-file-description { color: var(--color-text-muted); margin-bottom: 0.75rem; font-size: 0.875rem; }

.server-file-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: var(--color-text-subtle);
}

.server-file-button {
    background: var(--color-accent);
    color: white;
    border: none;
    padding: 0.4rem 1.25rem;
    font-family: var(--font-main);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t);
}

.server-file-button:hover { background: var(--color-accent-light); }

.upload-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
}

.upload-area { position: relative; margin-bottom: 1rem; }

#file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    border: 2px dashed var(--color-border);
    background: var(--color-bg);
    cursor: pointer;
    transition: all var(--t);
    font-weight: 500;
    color: var(--color-text-muted);
}

.upload-label:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.upload-icon { font-size: 1.5rem; }

.loaded-files { margin-top: 1rem; }

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    margin-bottom: 2px;
}

.file-name { font-weight: 500; }
.file-status { font-size: 0.875rem; color: var(--color-text-muted); }

.btn-small { padding: 0.4rem 0.875rem; font-size: 0.8rem; }

/* Marked cards */
.marked-cards-section {
    background: rgba(251, 191, 36, 0.05);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-left: 3px solid var(--color-warning);
    padding: 1.5rem;
    margin-top: 1rem;
}

.marked-cards-section h4 { margin-bottom: 0.75rem; }
.marked-cards-info { margin-bottom: 1rem; color: var(--color-text-muted); font-size: 0.875rem; }

/* Quiz */
.quiz-container { max-width: 800px; margin: 0 auto; }

.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    padding: 1.25rem 1.5rem;
}

.progress-container { flex: 1; margin-right: 2rem; }

.progress-bar {
    width: 100%;
    height: 4px;
    background: var(--color-bg);
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--color-accent);
    transition: width 0.3s ease;
}

.progress-text { font-size: 0.8rem; color: var(--color-text-muted); font-family: var(--font-mono); }

.score {
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--color-accent);
}

.question-container { margin-bottom: 2rem; }

.question-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    padding: 2rem;
}

.question-title { font-size: 1.2rem; margin-bottom: 1.5rem; line-height: 1.5; }

.answers-container { display: grid; gap: 2px; background: var(--color-border); }

.answer-option {
    padding: 1rem;
    background: var(--color-bg);
    border: none;
    cursor: pointer;
    transition: background var(--t);
    color: var(--color-text);
    text-align: left;
    font-family: var(--font-main);
    font-size: 0.9375rem;
}

.answer-option:hover    { background: var(--color-bg-card); }
.answer-option.selected { background: var(--color-accent); color: white; }
.answer-option.correct  { background: #166534; color: white; }
.answer-option.incorrect{ background: #7f1d1d; color: white; }

.quiz-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.quiz-results {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-top: 2px solid var(--color-accent);
    padding: 2rem;
    text-align: center;
}

.quiz-results h3 { margin-bottom: 1.5rem; }

.result-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
    gap: 1rem;
}

.stat { text-align: center; }

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--color-accent);
}

.stat-label { color: var(--color-text-muted); font-size: 0.875rem; }

/* Flashcards */
.flashcards-container { max-width: 800px; margin: 0 auto; }

.flashcard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.card-counter { font-family: var(--font-mono); font-size: 0.875rem; color: var(--color-text-muted); }

.flashcard-controls { display: flex; gap: 0.5rem; }

.flashcard-wrapper { margin-bottom: 2rem; }

.flashcard {
    width: 100%;
    height: 500px;
    perspective: 1000px;
    cursor: pointer;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

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

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    box-sizing: border-box;
    overflow: hidden;
}

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

.card-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

.card-content h4 {
    color: var(--color-text);
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    text-align: center;
    max-width: 100%;
    margin: 0;
    font-size: 1.5rem;
    transition: font-size 0.3s ease;
}

.card-content h4.font-medium { font-size: 1.3rem; }
.card-content h4.font-small  { font-size: 1.1rem; }
.card-content h4.font-tiny   { font-size: 0.95rem; }

.card-image-container { margin-top: 1rem; max-width: 100%; }

.card-image {
    max-width: 100%;
    max-height: 200px;
    border: 1px solid var(--color-border);
}

.flip-hint {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--color-text-subtle);
    margin-top: 1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.flashcard-navigation { display: flex; justify-content: center; gap: 1rem; }

#mark-card {
    background: var(--color-warning);
    color: #1a1000;
    border: none;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t);
}

#mark-card:hover { filter: brightness(1.1); }

#mark-card.marked {
    background: var(--color-success);
    color: #001a05;
}

.flashcard.marked::before {
    content: '★';
    position: absolute;
    top: 10px; right: 14px;
    font-size: 1.25rem;
    color: var(--color-warning);
    z-index: 10;
}

/* Responsive */
@media (max-width: 768px) {
    .app-header { flex-direction: column; gap: 1rem; }
    .app-nav { width: 100%; justify-content: center; }
    .mode-cards { grid-template-columns: 1fr; }
    .server-files-grid { grid-template-columns: 1fr; }
    .quiz-header { flex-direction: column; gap: 1rem; }
    .progress-container { margin-right: 0; width: 100%; }
    .result-stats { flex-direction: column; }
    .flashcard-navigation { flex-wrap: wrap; }
    .flashcard { height: 400px; }
    .flashcard-front, .flashcard-back { padding: 1.5rem; }
    .card-content h4 { font-size: 1.1rem; }
    .card-content h4.font-medium { font-size: 1rem; }
    .card-content h4.font-small  { font-size: 0.9rem; }
    .card-content h4.font-tiny   { font-size: 0.8rem; }
}

@media (max-width: 480px) {
    .app-title { font-size: 1.25rem; }
    .nav-btn { padding: 0.4rem 0.875rem; font-size: 0.8rem; }
    .quiz-controls { flex-direction: column; }
    .flashcard { height: 320px; }
    .flashcard-front, .flashcard-back { padding: 1rem; }
    .card-content h4 { font-size: 1rem; }
    .card-content h4.font-tiny { font-size: 0.75rem; }
}
