/* ============================================================
   KI-Kompetenz Schulung – Stylesheet
   ============================================================ */

/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: #2d3748;
    background: #f7f8fc;
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Typography === */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.3; margin-bottom: 0.5rem; }
h2 { font-size: 1.35rem; font-weight: 600; line-height: 1.35; margin-bottom: 0.5rem; margin-top: 1.5rem; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.4rem; }
p { margin-bottom: 0.75rem; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }
code { background: #edf2f7; padding: 2px 6px; border-radius: 4px; font-size: 0.9em; }

/* === Layout === */
.container { max-width: 960px; margin: 0 auto; padding: 0 1.25rem; }
.site-main { flex: 1; padding: 2rem 0; }

/* === Header === */
.site-header {
    background: var(--primary);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.header-logo { height: 36px; }
.header-company { font-weight: 600; font-size: 0.95rem; }
.header-title { font-size: 0.85rem; opacity: 0.85; }
.header-user { margin-left: auto; font-size: 0.85rem; opacity: 0.9; }

/* === Footer === */
.site-footer {
    background: #edf2f7;
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: #718096;
    margin-top: auto;
}
.footer-legal { font-size: 0.75rem; margin-top: 0.25rem; }

/* === Buttons === */
.btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    line-height: 1.4;
    font-family: inherit;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { opacity: 0.9; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn-secondary { background: #edf2f7; color: #2d3748; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-text { background: none; color: var(--primary); padding: 0.4rem 0.5rem; }
.btn-text:hover { background: #edf2f7; }
.btn-large { padding: 0.85rem 2rem; font-size: 1rem; font-weight: 600; }
.btn-danger { color: var(--danger) !important; }

/* === Forms === */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.3rem; font-size: 0.9rem; }
.form-group input, .form-group select {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--primary); outline: none; }
.form-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 150px; }

/* === Alerts === */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}
.alert-error { background: #fff5f5; color: #c53030; border: 1px solid #fed7d7; }
.alert-success { background: #f0fff4; color: #276749; border: 1px solid #c6f6d5; }

/* === Badges === */
.badge {
    display: inline-block;
    padding: 0.15rem 0.55rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-success { background: #c6f6d5; color: #276749; }
.badge-warning { background: #fefcbf; color: #975a16; }
.badge-neutral { background: #edf2f7; color: #718096; }

/* Progress Mini (Admin Table) */
.progress-mini {
    width: 60px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}
.progress-mini-bar {
    height: 100%;
    background: var(--accent, #2ECC71);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.progress-mini-label {
    font-size: 0.75rem;
    color: #718096;
    vertical-align: middle;
}

/* ============================================================
   WELCOME PAGE
   ============================================================ */
.welcome-page { display: flex; justify-content: center; padding: 2rem 0; }
.welcome-card {
    text-align: center;
    background: white;
    border-radius: 16px;
    padding: 3rem 2.5rem;
    max-width: 520px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.welcome-icon { font-size: 3rem; margin-bottom: 1rem; }
.welcome-card h1 { color: var(--primary); }
.welcome-card h2 { color: #4a5568; font-weight: 500; margin-top: 0; }
.welcome-text { color: #718096; margin: 1.5rem 0; }
.welcome-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin: 1.5rem 0;
}
.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    padding: 0.6rem;
    background: #f7f8fc;
    border-radius: 8px;
}
.info-icon { font-size: 1.1rem; }
.welcome-cta { color: #718096; font-size: 0.9rem; margin-top: 1.5rem; }

/* ============================================================
   REGISTER PAGE
   ============================================================ */
.register-page { display: flex; justify-content: center; padding: 2rem 0; }
.register-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
    text-align: center;
}
.register-badge {
    display: inline-block;
    background: #edf2f7;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #718096;
    margin-bottom: 0.5rem;
}
.register-card h2 { color: var(--primary); margin-top: 0.25rem; }
.register-card h1 { margin-bottom: 1rem; }
.register-text { color: #718096; font-size: 0.9rem; margin-bottom: 1.5rem; }
.register-form { text-align: left; }
.register-note { font-size: 0.8rem; color: #a0aec0; margin-top: 1.25rem; }

/* ============================================================
   COURSE DASHBOARD
   ============================================================ */
.dashboard-header { margin-bottom: 1.5rem; }
.dashboard-header h1 { margin-bottom: 0.25rem; }
.dashboard-header p { color: #718096; }

/* Progress */
.progress-wrapper { margin-bottom: 2rem; }
.progress-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.4rem;
}
.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 10px;
    transition: width 0.5s ease;
}
.progress-label { font-size: 0.8rem; color: #718096; }

/* Module Grid */
.module-grid { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 2rem; }
.module-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    border-radius: 12px;
    padding: 1.1rem 1.25rem;
    border: 2px solid #e2e8f0;
    transition: all 0.2s;
}
.module-card:hover:not(.module-locked) { border-color: var(--primary); box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.module-completed { border-color: #c6f6d5; background: #f0fff4; }
.module-active { border-color: #bee3f8; background: #ebf8ff; }
.module-locked { opacity: 0.55; }

.module-number {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
    background: #edf2f7;
    color: #4a5568;
}
.module-completed .module-number { background: var(--accent); color: white; }
.module-active .module-number { background: var(--primary); color: white; }

.module-content { flex: 1; }
.module-content h3 { font-size: 1rem; margin-bottom: 0.15rem; }
.module-duration { font-size: 0.8rem; color: #a0aec0; margin-bottom: 0.2rem; }

.module-status { font-size: 0.8rem; font-weight: 500; }
.status-done { color: #38a169; }
.status-progress { color: var(--primary); }
.status-locked { color: #a0aec0; }
.status-open { color: #718096; }

.module-link {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    background: #edf2f7;
    color: var(--primary);
    transition: background 0.2s;
}
.module-link:hover { background: #e2e8f0; text-decoration: none; }

/* Quiz Section */
.quiz-section { margin-top: 1rem; }
.quiz-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    border: 2px solid #e2e8f0;
}
.quiz-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.quiz-card h2 { margin-top: 0; }
.quiz-card p { color: #718096; }
.quiz-info { text-align: left; max-width: 320px; margin: 1rem auto; color: #4a5568; font-size: 0.9rem; list-style: none; }
.quiz-info li::before { content: "•"; margin-right: 0.5rem; color: var(--primary); }
.quiz-actions { display: flex; gap: 0.75rem; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.quiz-passed { border-color: #c6f6d5; background: #f0fff4; }
.quiz-ready { border-color: #bee3f8; }
.quiz-paused { border-color: #fbd38d; background: #fffaf0; }
.quiz-wait { background: #fffff0; padding: 1rem; border-radius: 8px; margin: 1rem 0; }
.quiz-tip { font-size: 0.85rem; }
.quiz-last-result { font-size: 0.85rem; color: #a0aec0; margin-top: 1rem; }

/* ============================================================
   MODULE PAGE
   ============================================================ */
.module-page { max-width: 720px; margin: 0 auto; }
.module-nav-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.module-indicator { font-size: 0.8rem; color: #a0aec0; }

.module-header { margin-bottom: 2rem; }
.module-tag {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 0.2rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.module-header h1 { font-size: 1.6rem; }
.module-meta { font-size: 0.85rem; color: #a0aec0; }

/* Module Content */
.module-body { background: white; border-radius: 12px; padding: 2rem 2.25rem; box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.content-section { margin-bottom: 2rem; }
.content-section:last-child { margin-bottom: 0; }
.content-section h2 { color: var(--primary); border-bottom: 2px solid #edf2f7; padding-bottom: 0.4rem; margin-top: 2rem; }
.content-section h2:first-child { margin-top: 0; }
.content-text { margin-bottom: 1rem; }
.content-text p { margin-bottom: 0.75rem; }

/* Content Boxes */
.content-box {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 4px solid;
}
.content-info { background: #ebf8ff; border-color: #4299e1; }
.content-warning { background: #fffff0; border-color: #ecc94b; }
.content-example { background: #f0fff4; border-color: #48bb78; }
.content-box strong { display: block; margin-bottom: 0.3rem; }
.content-box p { margin-bottom: 0; font-size: 0.9rem; }

/* Tables */
.content-table-wrapper { overflow-x: auto; margin: 1rem 0; }
.content-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.content-table th, .content-table td {
    padding: 0.6rem 0.85rem;
    border: 1px solid #e2e8f0;
    text-align: left;
}
.content-table th { background: #f7f8fc; font-weight: 600; }
.content-table tr:hover { background: #f7f8fc; }

.content-list { margin: 0.75rem 0 0.75rem 1.25rem; }
.content-list li { margin-bottom: 0.4rem; }

/* Check Questions (interactive, not graded) */
.check-question {
    background: #faf5ff;
    border: 2px solid #e9d8fd;
    border-radius: 10px;
    padding: 1.25rem;
    margin: 1.5rem 0;
}
.check-label { font-weight: 600; color: #6b46c1; font-size: 0.85rem; margin-bottom: 0.5rem; }
.check-text { font-weight: 500; margin-bottom: 0.75rem; }
.check-options { display: flex; flex-direction: column; gap: 0.4rem; }
.check-option {
    background: white;
    border: 2px solid #e2e8f0;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    text-align: left;
    font-family: inherit;
    transition: all 0.2s;
}
.check-option:hover { border-color: #6b46c1; background: #faf5ff; }
.check-option.selected-correct { border-color: #48bb78; background: #f0fff4; }
.check-option.selected-wrong { border-color: #fc8181; background: #fff5f5; }
.check-option.disabled { pointer-events: none; opacity: 0.7; }
.check-feedback { margin-top: 0.75rem; font-size: 0.9rem; }
.check-correct { color: #276749; }
.check-wrong { color: #c53030; }

/* Module Footer */
.module-footer { margin-top: 2rem; text-align: center; }
.module-completed-badge {
    background: #f0fff4;
    color: #276749;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
}
.module-nav-bottom {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
}

/* ============================================================
   QUIZ PAGE
   ============================================================ */
.quiz-page { max-width: 640px; margin: 0 auto; }
.quiz-header { text-align: center; margin-bottom: 1.5rem; }
.quiz-header h1 { color: var(--primary); }
.quiz-header p { color: #718096; font-size: 0.9rem; }

.quiz-progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}
.quiz-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 6px;
    transition: width 0.3s ease;
}
.quiz-counter { text-align: center; font-size: 0.8rem; color: #a0aec0; margin-bottom: 1.5rem; }

.quiz-question {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}
.question-number { font-size: 0.8rem; color: #a0aec0; font-weight: 600; margin-bottom: 0.5rem; }
.question-text { font-size: 1.1rem; margin-bottom: 1.25rem; line-height: 1.5; }

.question-options { display: flex; flex-direction: column; gap: 0.5rem; }
.option-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.option-label:hover { border-color: var(--primary); background: #f7f8fc; }
.option-label input { display: none; }
.option-label input:checked + .option-marker {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.option-label:has(input:checked) { border-color: var(--primary); background: #ebf8ff; }
.option-marker {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #cbd5e0;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.2s;
}
.option-text { padding-top: 0.15rem; }

.quiz-nav { display: flex; justify-content: space-between; margin-top: 1.5rem; }

/* ============================================================
   RESULT PAGE
   ============================================================ */
.result-page { max-width: 580px; margin: 0 auto; }
.result-card {
    background: white;
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.result-icon { font-size: 3rem; margin-bottom: 0.5rem; }
.result-text { color: #718096; }

.result-score { margin: 1.5rem 0; }
.score-circle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid;
}
.score-pass { border-color: var(--accent); }
.score-fail { border-color: var(--danger); }
.score-number { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.score-total { font-size: 0.85rem; color: #a0aec0; }
.score-percent { font-size: 0.9rem; color: #718096; margin-top: 0.5rem; }

.result-cert { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #e2e8f0; }
.result-cert h2 { margin-top: 0; }
.cert-actions { margin: 1rem 0 1.5rem; }
.cert-email-form { margin-top: 1.5rem; }
.cert-email-form p { font-size: 0.9rem; color: #718096; }
.email-input-group { display: flex; gap: 0.5rem; max-width: 380px; margin: 0.5rem auto; }
.input-email {
    flex: 1;
    padding: 0.6rem 0.85rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
}
.input-email:focus { border-color: var(--primary); outline: none; }
.cert-email-note { font-size: 0.75rem; color: #a0aec0; margin-top: 0.5rem; }
.email-feedback { margin-top: 0.5rem; font-size: 0.85rem; }

.result-bonus {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    text-align: left;
}
.result-bonus h3 { margin-bottom: 0.5rem; }
.result-bonus ul { margin: 0.75rem 0 1rem 1.25rem; }
.result-bonus li { margin-bottom: 0.3rem; font-size: 0.9rem; }

.result-retry { background: #fffff0; padding: 1.25rem; border-radius: 10px; margin: 1.5rem 0; }
.retry-tip { font-size: 0.85rem; color: #718096; margin-top: 0.5rem; }
.result-failed { border: 2px solid #fed7d7; }

/* ============================================================
   DOWNLOADS PAGE
   ============================================================ */
.downloads-page h1 { color: var(--primary); margin-bottom: 0.5rem; }
.download-cards { display: grid; gap: 1rem; margin: 1.5rem 0; }
.download-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid #e2e8f0;
}
.download-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.download-card h3 { margin-bottom: 0.3rem; }
.download-card p { font-size: 0.9rem; color: #4a5568; margin-bottom: 0; }
.download-note { font-size: 0.8rem; color: #a0aec0; font-style: italic; margin-top: 0.5rem !important; }
.downloads-info { font-size: 0.8rem; color: #a0aec0; margin: 1rem 0; }

/* ============================================================
   ADMIN
   ============================================================ */
.admin-body { background: #edf2f7; }
.admin-header { background: #1a202c; }
.admin-nav { margin-left: auto; display: flex; gap: 0.5rem; }
.admin-nav a { color: rgba(255,255,255,0.8); font-size: 0.8rem; padding: 0.3rem 0.6rem; border-radius: 4px; }
.admin-nav a:hover { background: rgba(255,255,255,0.1); color: white; text-decoration: none; }

/* Admin Login */
.admin-login { display: flex; justify-content: center; padding: 3rem 0; }
.login-card {
    background: white;
    border-radius: 12px;
    padding: 2.5rem;
    max-width: 380px;
    width: 100%;
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
    text-align: center;
}

/* Admin Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin: 1.5rem 0;
}
.stat-card {
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    text-align: center;
    border: 1px solid #e2e8f0;
}
.stat-number { display: block; font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 0.8rem; color: #718096; }
.stat-highlight .stat-number { color: var(--accent); }

.completion-rate { margin: 1.5rem 0; }
.completion-rate span { font-size: 0.9rem; color: #4a5568; }

.quick-actions { display: flex; gap: 0.75rem; margin: 1.5rem 0; flex-wrap: wrap; }

/* Tables */
.table-wrapper { overflow-x: auto; margin: 1rem 0; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    font-size: 0.85rem;
}
.data-table th {
    background: #f7f8fc;
    padding: 0.7rem 0.85rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.data-table td { padding: 0.65rem 0.85rem; border-top: 1px solid #edf2f7; }
.data-table tr:hover { background: #f7f8fc; }
.row-completed { background: #f0fff4; }
.token-code { font-size: 0.8rem; }

/* Admin Links */
.generate-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 2px solid #e2e8f0;
}
.generate-card h2 { margin-top: 0; }
.generate-form { margin-top: 1rem; }

/* Admin Links Generated */
.links-list { margin: 1.5rem 0; }
.link-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #edf2f7;
}
.link-number { font-weight: 600; color: #a0aec0; width: 2rem; text-align: right; flex-shrink: 0; }
.link-url { flex: 1; word-break: break-all; font-size: 0.8rem; background: transparent; padding: 0; }
.links-actions { display: flex; gap: 0.75rem; margin-bottom: 1rem; }

.empty-state { text-align: center; color: #a0aec0; padding: 2rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
    .welcome-info { grid-template-columns: 1fr; }
    .module-card { flex-wrap: wrap; }
    .module-link { width: 100%; text-align: center; }
    .form-row { flex-direction: column; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .quiz-nav { flex-direction: column; gap: 0.5rem; }
    .email-input-group { flex-direction: column; }
    .module-body { padding: 1.25rem; }
    h1 { font-size: 1.4rem; }
}
