﻿/*
==============================================
COMPONENTS (Buttons, Cards, Forms, Quiz, etc.)
==============================================
*/

/* --- KEYFRAME ANIMATIONS --- */
@keyframes pulse-arrow {
    0% {
        transform: scale(1);
        text-shadow: 0 0 5px var(--accent-color);
    }
    50% {
        transform: scale(1.1);
        text-shadow: 0 0 20px var(--accent-color);
    }
    100% {
        transform: scale(1);
        text-shadow: 0 0 5px var(--accent-color);
    }
}

/* --- GENERAL COMPONENT STYLES --- */
.card,
.diagram-item,
.platform-card,
.accordion-item,
.org-unit-item {
    background: var(--bg-light);
    transition: background-color 0.3s ease;
}

/* --- BUTTONS --- */
.cta-button {
    padding: var(--space-s) var(--space-l);
    background: var(--primary-color);
    border: 2px solid var(--primary-color);
    color: var(--bg-dark);
    font-weight: 700;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.cta-button:hover {
    background-color: transparent;
    color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--primary-color);
}

.submit-btn {
    display: inline-block;
    width: 100%;
    padding: var(--space-s) var(--space-l);
    background: var(--primary-color);
    border: 2px solid var(--primary-color);
    color: var(--bg-dark);
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}

.submit-btn:hover {
    background-color: transparent;
    color: var(--primary-color);
    transform: scale(1.02);
    box-shadow: 0 0 20px var(--primary-color);
}

/* --- CARDS --- */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: var(--space-m);
}

.card {
    padding: var(--space-l);
    border: 1px solid var(--secondary-color);
    text-align: center;
}

.card h3 {
    margin-bottom: var(--space-xs);
}

.card h4 {
    margin-bottom: var(--space-s);
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: 400;
    opacity: 0.9;
}

.card a {
    display: inline-block;
    margin-top: var(--space-m);
    padding: 0.8rem 1.5rem;
    background: var(--secondary-color);
    color: var(--bg-dark);
    font-weight: 600;
    text-decoration: none;
}

/* --- FORMS & DROPDOWNS --- */
.header-search {
    position: relative;
    width: clamp(150px, 25vw, 350px);
}

#siteSearchInput {
    width: 100%;
    padding: var(--space-xs) var(--space-s);
    background-color: transparent;
    border: 1px solid var(--secondary-color);
    color: var(--text-color);
    font-family: var(--font-family);
    font-size: var(--fs-400);
}

#siteSearchInput:focus {
    outline: none;
    box-shadow: 0 0 10px var(--secondary-color);
}

.search-controls {
    position: absolute;
    right: 5px;
    top: 50%;
    z-index: 1;
    display: flex;
    align-items: center;
    padding: 4px 6px;
    background-color: rgba(0, 0, 0, 0.25);
    border-radius: 4px;
    gap: var(--space-xs);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-50%);
    transition: opacity 0.3s ease;
}

.search-controls.visible {
    opacity: 1;
    visibility: visible;
}

#searchCounter {
    padding-inline: var(--space-xs);
    color: var(--text-color);
    font-size: var(--fs-300);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.search-controls button {
    padding: 0 var(--space-xs);
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.search-controls button:hover {
    color: var(--primary-color);
}

.dropdown {
    position: relative;
}

.dropdown-toggle {
    padding: var(--space-xs) var(--space-s);
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--text-color);
    cursor: pointer;
    font-family: var(--font-family);
    font-size: var(--fs-400);
    font-weight: 600;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 120%;
    left: 0;
    z-index: 102;
    min-width: 250px;
    background-color: var(--bg-light);
    border: 1px solid var(--primary-color);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.dropdown-content.show {
    display: block;
}

.dropdown-content a {
    display: block;
    padding: 12px 16px;
    color: var(--text-color);
    font-weight: 600;
    text-decoration: none;
}

.dropdown-content a:hover {
    background-color: var(--primary-color);
    color: var(--bg-dark) !important;
}

.dropdown-content hr {
    height: 1px;
    margin: 5px 0;
    background-color: var(--primary-color);
    border: 0;
    opacity: 0.3;
}

.dropdown-quiz-header {
    padding: 10px 16px;
    margin-top: 5px;
    border-top: 1px solid var(--primary-color);
    color: var(--secondary-color);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.dropdown-quiz-links a {
    padding-left: 2rem;
    font-size: 0.95rem !important;
    font-weight: 400 !important;
}

/* --- DIAGRAMS & FLOWS --- */
.fiori-flow-container {
    display: flex;
    flex-direction: row; /* Fix: Basis auf row gesetzt, Container Query übernimmt column! */
    align-items: stretch;
    gap: var(--space-s);
    padding: var(--space-m);
    margin-block: var(--space-xl);
    background: rgba(0, 0, 0, 0.1);
    border: 1px solid var(--primary-color);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.flow-step {
    width: 100%;
    flex: 1;
    padding: var(--space-m);
    text-align: center;
    background: var(--bg-light);
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(255, 255, 255, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.flow-step:hover {
    transform: translateY(-8px) scale(1.03);
    border-color: var(--secondary-color);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4), 0 0 25px var(--secondary-color);
}

.flow-step h4 {
    color: var(--primary-color);
    margin: 0;
}

.flow-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    font-size: 2.5rem;
    font-weight: bold;
    animation: pulse-arrow 2.5s ease-in-out infinite;
}

/* --- ACCORDION --- */
.principles-accordion {
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
}

.accordion-item {
    overflow: hidden;
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.accordion-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: var(--space-m);
    gap: var(--space-m);
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    text-align: left;
}

.accordion-header h4 {
    flex-grow: 1;
    margin: 0;
    color: var(--accent-color);
}

.accordion-icon {
    flex-shrink: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 300;
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.accordion-header.active .accordion-icon {
    transform: rotate(45deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
}

.accordion-content .content-inner {
    padding: 0 var(--space-m) var(--space-m) var(--space-m);
    padding-top: var(--space-m);
    margin-top: calc(-1 * var(--space-m));
    border-top: 1px solid var(--secondary-color);
}

/* --- QUIZ (15% kleiner skaliert) --- */
.quiz-container {
    width: 90%;
    max-width: 1020px; /* Reduziert von 1200px (-15%) */
    margin: var(--space-l) auto;
    padding: calc(var(--space-l) * 0.85) calc(var(--space-xl) * 0.85); /* Innenabstand -15% */
    background: var(--bg-light);
    border: 1px solid var(--primary-color);
    font-size: 0.85em; /* Basis-Textgröße -15% */
}

.quiz-container h1 {
    font-size: calc(var(--fs-800) * 0.85); /* h1 ebenfalls skaliert */
    margin-bottom: calc(var(--space-l) * 0.85);
}

.question-block {
    padding-bottom: calc(var(--space-m) * 0.85);
    margin-bottom: calc(var(--space-m) * 0.85);
    border-bottom: 1px solid var(--bg-dark);
}

.question-block p {
    margin-bottom: calc(var(--space-s) * 0.85);
    color: var(--accent-color);
    font-size: 1.02rem; /* 1.2rem * 0.85 */
    font-weight: 600;
}

.options div {
    margin-bottom: var(--space-xs);
}

.options label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.68rem 0.85rem; /* 0.8rem 1rem * 0.85 */
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.options label:hover {
    background-color: rgba(240, 240, 240, 0.05);
    border-left: 3px solid var(--accent-color);
}

input[type="radio"],
input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
    accent-color: var(--primary-color);
}

.result-box {
    padding: var(--space-m);
    margin-bottom: var(--space-l);
    border: 1px solid;
    text-align: center;
}

.result-box.success {
    border-color: var(--secondary-color);
}

.result-box.fail {
    border-color: var(--primary-color);
}

.result-box h2 {
    margin-top: 0;
    color: var(--secondary-color);
}

.result-box.fail h2 {
    color: var(--primary-color);
}

.correct-answer {
    background-color: rgba(168, 230, 207, 0.1);
    border-left: 3px solid var(--secondary-color) !important;
}

.wrong-answer {
    background-color: rgba(248, 180, 217, 0.1);
    border-left: 3px solid var(--primary-color) !important;
}

.solution-wrapper {
    margin-top: 15px;
    padding: 0.8rem;
    background: rgba(168, 230, 207, 0.08);
}

.solution {
    display: block;
    color: var(--secondary-color);
    font-weight: bold;
}

/* --- DRAG & DROP QUIZ STYLES (MATCHING) --- */
.matching-question-container {
    display: flex;
    gap: var(--space-xl);
    align-items: start;
    margin-top: var(--space-m);
}

.stems-container {
    flex: 1 1 33%;
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
    border: 1px dashed var(--bg-dark);
    min-height: 150px;
    border-radius: 4px;
}

.responses-container {
    flex: 1 1 67%;
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
}

.draggable-option {
    padding: var(--space-s);
    background-color: var(--bg-light);
    border: 2px solid var(--secondary-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: grab;
    transition: all 0.2s ease;
    text-align: center;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70px;
    word-break: break-word;
}

.draggable-option.dragging {
    opacity: 0.5;
    transform: scale(1.05);
    cursor: grabbing;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.response-item {
    display: flex;
    align-items: center;
    gap: var(--space-l);
}

.drop-zone {
    flex-shrink: 0;
    flex-basis: 250px;
    min-height: 70px;
    padding: var(--space-xs);
    border: 2px dashed var(--accent-color);
    transition: background-color 0.2s ease, border-color 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
}

.drop-zone.drag-over {
    background-color: rgba(163, 217, 233, 0.1);
    border-color: var(--primary-color);
    border-style: solid;
}

.drop-zone .draggable-option {
    cursor: default;
    box-shadow: none;
    width: 100%;
    margin: 0;
}

.response-text {
    flex-grow: 1;
    line-height: 1.7;
    opacity: 0.9;
}

.drop-zone .draggable-option.correct-answer {
    border-color: var(--secondary-color) !important;
}

.drop-zone .draggable-option.wrong-answer {
    border-color: var(--primary-color) !important;
}

/* --- ORDERING QUIZ STYLES --- */
.ordering-question-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-s);
    border: 1px dashed var(--bg-dark);
    padding: var(--space-m);
    border-radius: 4px;
}

.orderable-item {
    padding: var(--space-s);
    background-color: var(--bg-light);
    border: 2px solid var(--secondary-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    cursor: grab;
    transition: all 0.2s ease;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: var(--space-m);
}

.orderable-item::before {
    content: '☰';
    font-size: 1.5rem;
    opacity: 0.5;
}

.orderable-item.dragging {
    opacity: 0.5;
    transform: scale(1.02);
    cursor: grabbing;
    background-color: var(--primary-color);
    color: var(--bg-dark);
}

.orderable-item.drag-over {
    border-top: 3px solid var(--primary-color);
}

.orderable-item.correct-answer {
    border-color: var(--secondary-color) !important;
}

.orderable-item.wrong-answer {
    border-color: var(--primary-color) !important;
}

.solution-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.9rem;
    font-weight: 600;
}

.chapter-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-m);
    margin-top: var(--space-l);
}

.chapter-card {
    position: relative;
    padding: var(--space-m);
    background-color: var(--bg-dark);
    border: 2px solid var(--secondary-color);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease-in-out;
}

.chapter-card input[type="checkbox"] {
    display: none;
}

.chapter-card .chapter-title {
    color: var(--text-color);
    font-size: 1.5rem;
    font-weight: 700;
    transition: color 0.2s ease-in-out;
}

.chapter-card .chapter-icon {
    margin-bottom: 1rem;
    color: var(--secondary-color);
    font-size: 2.5rem;
    transition: transform 0.2s ease-in-out;
}

.chapter-card.selected {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.chapter-card.selected .chapter-title,
.chapter-card.selected .chapter-icon {
    color: var(--bg-dark);
}

.chapter-card.selected .chapter-icon {
    transform: scale(1.1);
}

.quiz-progress-bar-container {
    width: 100%;
    height: 10px;
    margin-bottom: 0.5rem;
    background-color: var(--bg-dark);
    border: 1px solid var(--secondary-color);
}

.quiz-progress-bar {
    width: 0%;
    height: 100%;
    background-color: var(--secondary-color);
    transition: width 0.3s ease;
}

#quiz-progress-text {
    margin-bottom: var(--space-l);
    color: var(--accent-color);
    font-size: 0.9rem;
    font-weight: 600;
    text-align: right;
}

#question-text {
    margin-bottom: var(--space-m);
}

.quiz-navigation {
    margin-top: var(--space-m);
}

#quiz-result-screen {
    padding: var(--space-l);
    margin-top: var(--space-xl);
    border-top: 2px solid var(--secondary-color);
    text-align: center;
}

#quiz-result-screen h2 {
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

#quiz-result-screen p {
    margin-bottom: var(--space-l);
    font-size: 1.2rem;
}

.quiz-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-m);
    margin-top: var(--space-xl);
}

.quiz-actions .cta-button,
.quiz-actions .submit-btn {
    flex-grow: 1;
    flex-basis: 100%;
    max-width: 300px;
    margin: 0;
}

@media (min-width: 768px) {
    .quiz-actions .cta-button,
    .quiz-actions .submit-btn {
        flex-basis: auto;
    }
}

/* --- MODAL & POPOVER --- */
.user-selection-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.user-selection-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.user-selection-modal {
    width: 90%;
    height: 90%;
    max-width: 500px;
    padding: var(--space-l);
    background: var(--bg-light);
    border: 1px solid var(--primary-color);
    text-align: center;
}

.user-selection-modal .user-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: var(--space-l) 0;
    list-style: none;
    text-align: left;
}

.diagram-popover {
    display: block;
    position: absolute;
    z-index: 110;
    width: clamp(250px, 30vw, 320px);
    padding: var(--space-s) var(--space-m);
    background-color: var(--bg-light);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    font-size: var(--fs-300);
    line-height: 1.5;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -100%) translateY(-25px);
    transition: opacity 0.2s ease-out, transform 0.2s ease-out;
}

.diagram-popover.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -100%) translateY(-15px);
}

.diagram-popover::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-top: -1px;
    border-width: 10px;
    border-style: solid;
    border-color: var(--bg-light) transparent transparent transparent;
    transform: translateX(-50%);
}

.diagram-popover::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    border-width: 11px;
    border-style: solid;
    border-color: var(--primary-color) transparent transparent transparent;
    transform: translateX(-50%);
}

/* --- GLOSSAR --- */
.glossary-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-m);
}

.glossary-list dl {
    background: var(--bg-light);
    padding: var(--space-l);
    border-left: 4px solid var(--primary-color);
    display: grid;
    grid-template-columns: minmax(150px, 25%) 1fr;
    gap: var(--space-s) var(--space-l);
    align-items: start;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.glossary-list dl:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    border-left-color: var(--secondary-color);
}

.glossary-list dt {
    font-size: var(--fs-500);
    font-weight: 700;
    color: var(--accent-color);
    line-height: 1.4;
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: none;
}

.glossary-list dd {
    margin: 0;
    line-height: 1.7;
    opacity: 0.9;
}

/* --- GLOSSAR FILTER --- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-s);
    margin-bottom: var(--space-l);
    background-color: rgba(0, 0, 0, 0.1);
    border: 1px solid var(--secondary-color);
    backdrop-filter: blur(5px);
}

.filter-link {
    padding: var(--space-xs) var(--space-s);
    color: var(--text-color);
    font-weight: 700;
    text-decoration: none;
    border: 2px solid transparent;
    transition: all 0.2s ease-in-out;
}

.filter-link:hover {
    color: var(--primary-color);
    border-color: var(--primary-color);
    text-decoration: none;
}

.filter-link.active {
    background-color: var(--primary-color);
    color: var(--bg-dark);
    border-color: var(--primary-color);
}

#quiz-result-screen .result-pass {
    color: var(--secondary-color);
}

#quiz-result-screen .result-fail {
    color: var(--primary-color);
}

.result-percentage {
    font-weight: 700;
    font-size: 1.2em;
}

/* --- NEXT LEVEL: CONTAINER QUERIES --- 
   Anstatt auf die generelle Fensterbreite zu achten, 
   reagieren diese Komponenten ab sofort auf ihren tatsächlichen Platz! 
*/
@container main (max-width: 600px) {
    .card-container {
        grid-template-columns: 1fr;
    }
    
    .matching-question-container {
        flex-direction: column;
        gap: var(--space-m);
    }
    
    .stems-container, .responses-container {
        width: 100%;
        min-height: auto;
    }
    
    /* Fiori Flow klappt auf vertikal um, wenn der Container eng ist */
    .fiori-flow-container {
        flex-direction: column;
    }
    
    .flow-arrow {
        margin: -0.5rem 0;
        transform: rotate(90deg);
    }
}