/**
 * IHK Test System CSS
 * Professionelles Styling für das Testsystem
 */

/* === TOAST NOTIFICATION === */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.ihk-toast {
    position: fixed !important;
    top: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 99999 !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 16px 24px !important;
    min-width: 300px !important;
    max-width: 600px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: white !important;
    animation: slideDown 0.3s ease-out !important;
}

.ihk-toast .toast-icon {
    font-size: 24px !important;
    flex-shrink: 0 !important;
}

.ihk-toast .toast-message {
    flex: 1 !important;
}

/* === BASE STYLING === */
.ihk-test-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* === PROGRESS BAR === */
.ihk-progress-container {
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.ihk-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.ihk-progress-fill {
    height: 100%;
    background: #007bff;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.ihk-progress-text {
    text-align: center;
    font-size: 14px;
    color: #6c757d;
    font-weight: 500;
}

/* === QUESTION CONTAINER === */
.ihk-question-container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.ihk-question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f3f5;
}

.ihk-question-number {
    font-weight: 600;
    color: #007bff;
    font-size: 16px;
}

.ihk-category {
    background: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* === QUESTION TEXT === */
.ihk-question-text h3 {
    margin: 0 0 25px 0;
    font-size: 18px;
    line-height: 1.6;
    color: #212529;
    font-weight: 500;
}

/* === ANSWER OPTIONS === */
.ihk-answer-options {
    margin-bottom: 30px;
}

.ihk-answer-option {
    margin-bottom: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.ihk-answer-option:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.ihk-answer-option.selected {
    border-color: #007bff;
    background: #f8f9ff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.ihk-answer-option.correct-answer {
    border-color: #28a745;
    background: #f1f8f4;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

.ihk-answer-option.wrong-answer {
    border-color: #dc3545;
    background: #fdf2f2;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.2);
}

.ihk-answer-option input[type="radio"] {
    display: none;
}

.ihk-answer-option label {
    display: flex;
    align-items: flex-start;
    padding: 16px 20px;
    cursor: pointer;
    width: 100%;
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
}

.answer-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #e9ecef;
    color: #495057;
    border-radius: 50%;
    font-weight: 600;
    margin-right: 16px;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

/* Mehrfachantwort: Quadrat statt Kreis */
.ihk-answer-option input[type="checkbox"] ~ label .answer-letter {
    border-radius: 4px;
}

.ihk-answer-option:hover .answer-letter,
.ihk-answer-option.selected .answer-letter {
    background: #007bff;
    color: white;
}

.ihk-answer-option.correct-answer .answer-letter {
    background: #28a745;
    color: white;
}

.ihk-answer-option.wrong-answer .answer-letter {
    background: #dc3545;
    color: white;
}

.answer-text {
    flex-grow: 1;
    color: #212529;
    padding-top: 4px;
}

/* === CONTROLS === */
.ihk-question-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.ihk-question-controls button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 160px;
}

.ihk-show-results {
    background: #007bff;
    color: white;
}

.ihk-show-results:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.ihk-show-results:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.ihk-next-question {
    background: #28a745;
    color: white;
}

.ihk-next-question:hover {
    background: #1e7e34;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* === RESULT DISPLAY === */
.ihk-result-display {
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid #f1f3f5;
}

.ihk-result {
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.ihk-result.correct {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.ihk-result.incorrect {
    background: #f8d7da;
    border: 1px solid #f1c2c7;
}

.ihk-result-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.result-icon {
    font-size: 24px;
    margin-right: 10px;
    font-weight: bold;
}

.ihk-result.correct .result-icon {
    color: #155724;
}

.ihk-result.incorrect .result-icon {
    color: #721c24;
}

.result-text {
    font-size: 18px;
    font-weight: 600;
}

.ihk-result.correct .result-text {
    color: #155724;
}

.ihk-result.incorrect .result-text {
    color: #721c24;
}

.ihk-correct-answer,
.ihk-explanation,
.ihk-keywords-highlight,
.ihk-source-reference {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.7);
}

.ihk-keywords-highlight .highlighted-text mark {
    background: linear-gradient(180deg, transparent 40%, #ff69b4 40%);
    padding: 0 2px;
    border-radius: 0;
    font-weight: inherit;
}

.ihk-source-reference em {
    color: #6c757d;
    font-style: italic;
}

/* === FINAL RESULTS === */
.ihk-final-results {
    text-align: center;
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.ihk-final-results h2 {
    margin-bottom: 30px;
    color: #212529;
    font-size: 28px;
}

.ihk-score-summary {
    margin-bottom: 40px;
}

.score-circle {
    display: inline-block;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: #007bff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(0, 123, 255, 0.3);
}

.score-percentage {
    font-size: 36px;
    font-weight: bold;
    line-height: 1;
}

.score-fraction {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 5px;
}

/* === PERFORMANCE ANALYSIS === */
.ihk-performance-analysis h3 {
    margin-bottom: 20px;
    color: #212529;
}

.performance-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.metric-label {
    display: block;
    font-size: 14px;
    color: #6c757d;
    margin-bottom: 5px;
}

.metric-value {
    display: block;
    font-size: 24px;
    font-weight: bold;
    color: #212529;
}

/* === RECOMMENDATIONS === */
.ihk-recommendations {
    margin-bottom: 30px;
}

.recommendation {
    padding: 20px;
    border-radius: 8px;
    text-align: left;
}

.recommendation.excellent {
    background: #d4edda;
    border-left: 4px solid #28a745;
}

.recommendation.good {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
}

.recommendation.needs-improvement {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.recommendation h4 {
    margin-bottom: 10px;
    color: #212529;
}

/* === ACTION BUTTONS === */
.ihk-action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.ihk-action-buttons button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 150px;
}

.ihk-restart-test {
    background: #6c757d;
    color: white;
}

.ihk-restart-test:hover {
    background: #545b62;
    transform: translateY(-1px);
}

.ihk-review-answers {
    background: #17a2b8;
    color: white;
}

.ihk-review-answers:hover {
    background: #117a8b;
    transform: translateY(-1px);
}

/* === HELP OVERLAY === */
.ihk-help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.ihk-help-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 400px;
    text-align: left;
}

.ihk-help-content h3 {
    margin-bottom: 20px;
    color: #212529;
}

.ihk-help-content ul {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
}

.ihk-help-content li {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.ihk-help-content kbd {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    margin-right: 10px;
    min-width: 32px;
    text-align: center;
}

.ihk-close-help {
    background: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .ihk-test-container {
        margin: 10px;
        padding: 15px;
    }
    
    .ihk-question-container {
        padding: 20px;
    }
    
    .ihk-question-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .ihk-question-text h3 {
        font-size: 16px;
    }
    
    .score-circle {
        width: 120px;
        height: 120px;
    }
    
    .score-percentage {
        font-size: 28px;
    }
    
    .performance-metrics {
        grid-template-columns: 1fr;
    }
    
    .ihk-action-buttons {
        flex-direction: column;
    }
    
    .ihk-question-controls {
        flex-direction: column;
    }
    
    .answer-letter {
        width: 28px;
        height: 28px;
        margin-right: 12px;
    }
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.ihk-answer-option:focus-within {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* === PRINT STYLES === */
@media print {
    .ihk-test-container {
        box-shadow: none;
        background: white;
    }
    
    .ihk-question-controls,
    .ihk-action-buttons {
        display: none;
    }
    
    .ihk-result-display {
        page-break-inside: avoid;
    }
}

/* === ANIMATIONS === */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ihk-question-container {
    animation: slideIn 0.3s ease;
}

.ihk-result-display {
    animation: slideIn 0.4s ease;
}

/* === LOADING STATES === */
.ihk-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.ihk-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== GAMIFICATION STYLES (v1.1.0+) ========== */

/* Fragment Display */
.ihk-fragments-display {
    display: block !important;
    background: #f8f9ff;
    border: 2px solid #007bff;
    border-radius: 12px;
    padding: 15px 20px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
    color: #212529;
    width: 100% !important;
    min-height: 80px !important;
    box-sizing: border-box;
    overflow: visible !important;
}

.fragment-header {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: nowrap;
    gap: 15px;
    min-height: 40px;
}

.fragment-count {
    display: flex !important;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    min-height: 40px;
}

.fragment-tts-toggle {
    display: flex !important;
    align-items: center;
    min-height: 40px;
}

.tts-toggle-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    user-select: none;
    min-height: 30px;
    line-height: 30px;
}

.tts-toggle-label input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    cursor: pointer;
    display: inline-block !important;
    accent-color: #007bff;
}

.tts-toggle-text {
    line-height: 30px;
    height: 30px;
    display: inline-block !important;
    color: #212529;
}

.fragment-icon {
    font-size: 32px;
    line-height: 40px;
    height: 40px;
    display: inline-block !important;
}

.fragment-icon img.emoji {
    width: 32px !important;
    height: 32px !important;
    display: inline-block !important;
    vertical-align: middle;
}

.fragment-number {
    font-size: 36px;
    font-weight: 700;
    line-height: 40px;
    height: 40px;
    display: inline-block !important;
    color: #007bff;
}

.fragment-label {
    font-size: 14px;
    line-height: 40px;
    height: 40px;
    display: inline-block !important;
    color: #6c757d;
}

.fragment-hints {
    display: flex !important;
    gap: 10px;
    flex-wrap: nowrap;
    min-height: 45px;
    align-items: center;
}

.hint-button {
    display: inline-block !important;
    background: white;
    border: 2px solid #007bff;
    border-radius: 8px;
    padding: 12px 18px !important;
    color: #007bff !important;
    font-size: 14px !important;
    font-weight: 600;
    line-height: 20px !important;
    cursor: pointer;
    min-height: 44px !important;
    height: auto !important;
    transition: all 0.3s ease;
    flex: 1;
    min-width: 150px;
    box-sizing: border-box !important;
}

.hint-button:hover:not(:disabled) {
    background: #007bff;
    color: white !important;
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.hint-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hint-button:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Keyword Highlighting - Pink Textmarker */
.ihk-keyword-highlight,
mark.ihk-keyword-highlight {
    background: linear-gradient(180deg, transparent 80%, #ff69b4 100%);
    color: inherit;
    padding: 0 2px;
    border-radius: 0;
    font-weight: inherit;
}

.ihk-source-hint {
    background: #f0f8ff;
    border-left: 4px solid #2271b1;
    padding: 15px;
    margin: 15px 0;
    border-radius: 4px;
    animation: slide-down 0.4s ease-out;
}

@keyframes slide-down {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.ihk-source-hint strong {
    color: #2271b1;
}

/* XP Summary */
.ihk-xp-summary {
    background: white;
    border: 2px solid #007bff;
    border-radius: 16px;
    padding: 30px;
    margin: 30px 0;
    box-shadow: 0 8px 24px rgba(0, 123, 255, 0.2);
}

.ihk-xp-summary h2 {
    text-align: center;
    color: #007bff;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 28px;
}

.xp-breakdown {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.xp-breakdown table {
    width: 100%;
    border-collapse: collapse;
}

.xp-breakdown tr {
    border-bottom: 1px solid #f0f0f0;
}

.xp-breakdown tr:last-child {
    border-bottom: none;
}

.xp-breakdown td {
    padding: 12px 8px;
}

.xp-breakdown td:first-child {
    color: #646970;
}

.xp-breakdown td:last-child {
    text-align: right;
    font-weight: 600;
}

.xp-breakdown tr.penalty td:last-child {
    color: #d63638;
}

.xp-breakdown tr.bonus td:last-child {
    color: #00a32a;
}

.xp-breakdown tr.total {
    border-top: 2px solid #007bff;
    font-size: 18px;
}

.xp-breakdown tr.total td {
    padding-top: 15px;
    color: #007bff;
}

.level-info {
    text-align: center;
    padding: 20px;
    background: #007bff;
    color: #fff;
    border-radius: 8px;
    margin-bottom: 15px;
}

.level-info p {
    margin: 8px 0;
    font-size: 16px;
}

.level-info strong {
    font-size: 20px;
}

.fragment-summary {
    text-align: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    color: #646970;
}

.fragment-summary p {
    margin: 0;
}

/* TTS Buttons */
.tts-button {
    background: #2271b1;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 8px;
    font-size: 16px;
}

.tts-button:hover {
    background: #135e96;
    transform: scale(1.1);
}

.tts-button.tts-speaking {
    animation: pulse-tts 1s ease-in-out infinite;
}

@keyframes pulse-tts {
    0%, 100% {
        background: #2271b1;
        transform: scale(1);
    }
    50% {
        background: #135e96;
        transform: scale(1.15);
    }
}

.tts-button-small {
    width: 24px;
    height: 24px;
    font-size: 12px;
    margin-left: 5px;
}

.answer-explanation-item {
    margin: 12px 0;
    padding: 12px;
    background: #f9f9f9;
    border-left: 3px solid #007bff;
    border-radius: 4px;
}

.answer-explanation-item strong {
    display: block;
    margin-bottom: 6px;
    color: #007bff;
}

.ihk-answer-explanations {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px dashed #ddd;
}

/* Leaderboard */
.ihk-leaderboard-container {
    width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    overflow: visible;
    position: relative;
}

.ihk-leaderboard-header {
    text-align: center;
    padding: 0;
    background: #0a0a1e;
    border-radius: 12px 12px 0px 0px;
    margin-bottom: 0;
    overflow: hidden;
    position: relative;
}

.leaderboard-header-img {
    width: 100%;
    height: auto;
    display: block;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ─── Haus-Pokal (House Cup) ─── */
.leaderboard-header-svg-wrap {
    position: relative;
    display: block;
}

.leaderboard-header-svg-wrap svg {
    width: 100%;
    height: auto;
    display: block;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.house-cup-crown-hover {
    position: absolute;
    left: 44%;
    top: 12%;
    width: 12%;
    height: 42%;
    cursor: pointer;
    z-index: 10;
}

.house-cup-tooltip {
    position: absolute;
    transform: translateX(-50%);
    background: #1a2332;
    color: #fff;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid rgba(200, 165, 90, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 1000;
    min-width: 320px;
    max-width: 420px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
}

.house-cup-tooltip.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.house-cup-title {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 700;
    color: #c8a55a;
    border-bottom: 1px solid rgba(200, 165, 90, 0.25);
    padding-bottom: 8px;
    text-align: center;
}

.house-cup-groups {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.house-cup-group {
    padding: 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
}

.house-cup-leader {
    background: rgba(200, 165, 90, 0.12);
    border: 1px solid rgba(200, 165, 90, 0.25);
}

.house-cup-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.house-cup-rank {
    font-weight: 700;
    color: #c8a55a;
    min-width: 24px;
    font-size: 13px;
}

.house-cup-banner-mini {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.house-cup-group-name {
    font-weight: 600;
    color: #e2e8f0;
    flex-grow: 1;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.house-cup-member-count {
    font-size: 11px;
    color: #64748b;
    flex-shrink: 0;
}

.house-cup-xp-breakdown {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #94a3b8;
    padding-left: 32px;
}

.house-cup-xp-breakdown span {
    white-space: nowrap;
}

.house-cup-xp-breakdown .house-cup-total {
    font-weight: 700;
    color: #c8a55a;
    margin-left: auto;
}

.ihk-leaderboard-header h2 {
    margin: 0 0 10px 0;
    font-size: 32px;
    color: #fff;
}

.leaderboard-category {
    margin: 0;
    padding: 8px 0 12px;
    opacity: 0.9;
    font-size: 14px;
    color: #a0b0e0;
}

.ihk-leaderboard-list {
    background: linear-gradient(180deg, #0a0a1e 0%, #141432 100%);
    /* border-radius: 12px 12px 0 0; */
    overflow: visible;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    padding: 20px;
    margin: 0 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-left: 3px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    transition: all 0.3s ease;
    position: relative;
    border-radius: 12px 12px 12px 12px;
}

.leaderboard-entry:first-child {
    /* margin-top: 8px; */
}

.leaderboard-entry:hover {
    background: rgba(255, 255, 255, 0.07);
    border-left-color: #c8a55a;
    box-shadow: 0 0 20px rgba(200, 165, 90, 0.08);
    z-index: 100;
}

.leaderboard-entry:last-child {
    border-bottom: none;
    margin-bottom: 0px;
}

.leaderboard-entry.current-user {
    background: rgba(245, 158, 11, 0.08);
    border-left: 4px solid #f59e0b;
    box-shadow: 0 0 24px rgba(245, 158, 11, 0.1);
    border-radius: 12px 12px 12px 12px;
}

.leaderboard-rank {
    flex-shrink: 0;
    width: 60px;
    text-align: center;
}

.rank-number {
    font-size: 24px;
    font-weight: 700;
    color: #c8a55a;
}

.rank-medal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.rank-medal.rank-gold {
    background: linear-gradient(135deg, #f7d774, #c8a035);
    border: 2px solid #d4a843;
    box-shadow: 0 0 12px rgba(200, 165, 90, 0.4);
}

.rank-medal.rank-silver {
    background: linear-gradient(135deg, #d4d8dc, #9ca3ab);
    border: 2px solid #b0b8c0;
    box-shadow: 0 0 12px rgba(180, 190, 200, 0.3);
}

.rank-medal.rank-bronze {
    background: linear-gradient(135deg, #d4956a, #a0643c);
    border: 2px solid #b87a50;
    box-shadow: 0 0 12px rgba(184, 122, 80, 0.3);
}

.leaderboard-user {
    flex-grow: 1;
    margin: 0 20px;
}

/* Gruppen-Banner */
.leaderboard-banner-wrap {
    flex-shrink: 0;
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.leaderboard-banner-wrap svg.leaderboard-banner {
    width: 24px;
    height: 56px;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Ausbildungs-Tag */
.leaderboard-tag {
    display: inline-block;
    height: 18px;
    width: auto;
    margin-left: 8px;
    vertical-align: middle;
    border: none !important;
    box-shadow: none !important;
}

.user-name {
    font-size: 26px;
    font-weight: 600;
    color: #b89030;
    margin-bottom: 5px;
}

.current-user-badge {
    display: inline-block;
    background: #f59e0b;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 8px;
}

.za-veteran-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #d4a843, #b8860b);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.user-level {
    font-size: 14px;
    color: #94a3b8;
}

.user-level span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, #c8a035, #a07828);
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

.level-crown {
    background: #dc3545 !important;
}

.leaderboard-badges {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin-left: 6px;
    vertical-align: middle;
    background: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    color: inherit !important;
}

.leaderboard-badge-icon {
    display: inline-flex;
    cursor: help;
    transition: transform 0.15s ease;
    background: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    color: inherit !important;
}

.leaderboard-badge-icon:hover {
    transform: scale(1.3);
}

.leaderboard-badge-icon img {
    width: 22px;
    height: 22px;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.tooltip-badges {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.tooltip-badges .label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #94a3b8;
}

.tooltip-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tooltip-badge-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.1);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
}

.tooltip-badge-item img {
    width: 16px;
    height: 16px;
    border: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.leaderboard-stats {
    display: flex;
    gap: 8px;
}

.ihk-leaderboard-container .stat-item {
    flex: 1;
    padding: 2px;
    background: #12394f;
    border-radius: 8px;
    text-align: center;
    border: 2px solid transparent;
    min-width: 80px;
}

.ihk-leaderboard-container .stat-item strong {
    display: block;
    font-size: 20px;
    color: #c8a55a;
}

.ihk-leaderboard-container .stat-item small {
    font-size: 11px;
    color: #cbdae9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.leaderboard-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1a2332;
    color: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid rgba(200, 165, 90, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 1000;
    min-width: 280px;
    max-width: 400px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.leaderboard-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #1a2332;
}

.leaderboard-entry:hover .leaderboard-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-8px);
}

/* Tooltip nach unten klappen wenn oben kein Platz */
.leaderboard-tooltip.tooltip-flipped {
    bottom: auto;
    top: 100%;
}

.leaderboard-tooltip.tooltip-flipped::after {
    top: auto;
    bottom: 100%;
    border-top-color: transparent;
    border-bottom-color: #1a2332;
}

.leaderboard-entry:hover .leaderboard-tooltip.tooltip-flipped {
    transform: translateX(-50%) translateY(8px);
}

.tooltip-content h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 8px;
}

.tooltip-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tooltip-stat {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 13px;
    gap: 12px;
}

.tooltip-stat .label {
    opacity: 0.8;
    white-space: nowrap;
    flex-shrink: 0;
}

.tooltip-stat .value {
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

.ihk-leaderboard-footer {
    text-align: center;
    padding: 16px 20px;
    background: #0a0a1e;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0 0 12px 12px;
    margin-top: 0;
}

.leaderboard-count {
    margin: 0 0 10px 0;
    color: #94a3b8;
    font-size: 14px;
}

.leaderboard-login-hint {
    margin: 0;
    color: #5dade2;
    font-style: italic;
    font-size: 13px;
}

.ihk-leaderboard-empty {
    text-align: center;
    padding: 60px 20px;
    background: linear-gradient(180deg, #0a0a1e 0%, #141432 100%);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.ihk-leaderboard-empty h3 {
    margin: 0 0 10px 0;
    color: #e2e8f0;
}

.ihk-leaderboard-empty p {
    margin: 0;
    color: #94a3b8;
}

/* Notifications */
.ihk-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #fff;
    border-left: 4px solid #2271b1;
    padding: 15px 20px;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    max-width: 350px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.ihk-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.ihk-notification-success {
    border-left-color: #00a32a;
    background: #f0f9f4;
}

.ihk-notification-info {
    border-left-color: #2271b1;
    background: #f0f6fc;
}

.ihk-notification-error {
    border-left-color: #d63638;
    background: #fcf0f1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .ihk-fragments-display {
        padding: 15px;
    }

    .fragment-hints {
        flex-direction: column;
    }

    .hint-button {
        min-width: 100%;
    }

    .ihk-xp-summary {
        padding: 20px 15px;
    }

    .leaderboard-entry {
        flex-wrap: wrap;
        padding: 15px;
    }

    .leaderboard-stats {
        flex-basis: 100%;
        justify-content: center;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    .leaderboard-tooltip {
        left: 10px;
        right: 10px;
        transform: translateX(0) translateY(10px);
        min-width: auto;
    }

    .leaderboard-entry:hover .leaderboard-tooltip {
        transform: translateX(0) translateY(-8px);
    }

    .house-cup-tooltip {
        left: 10px !important;
        right: 10px;
        transform: none !important;
        min-width: auto;
        max-width: none;
    }

    .house-cup-xp-breakdown {
        gap: 8px;
        padding-left: 24px;
        font-size: 11px;
    }

    .ihk-notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .fragment-count {
        font-size: 14px;
    }

    .fragment-number {
        font-size: 28px;
    }

    .ihk-xp-summary h2 {
        font-size: 22px;
    }

    .user-name {
        font-size: 16px;
    }

    .rank-number {
        font-size: 20px;
    }

    .leaderboard-banner-wrap {
        display: none;
    }

    .leaderboard-tag {
        height: 14px;
    }
}