/* Finale Version */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-color: #333;
    --border-color: #dee2e6;
    --box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    --border-radius: 8px;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background-color: var(--surface-color);
    padding: 20px 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

header {
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

header h1 {
    color: var(--primary-color);
    font-size: 2.5em;
    margin: 0;
}

header .emoji {
    display: inline-block;
    transform: rotate(-10deg);
}

.intro-text {
    font-size: 1.1em;
    color: var(--secondary-color);
    max-width: 80%;
    margin: 10px auto 0;
}

.input-area {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.input-section h2 {
    margin-top: 0;
    font-size: 1.2em;
    color: var(--text-color);
}

textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-family: 'Poppins', sans-serif;
    font-size: 1em;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.class-management {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

.class-management select, .class-management button {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    background-color: #f1f1f1;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
}

.class-management select {
    flex-grow: 1;
}

.info-tooltip {
    position: relative;
    display: inline-block;
}
.info-icon {
    cursor: pointer;
    font-size: 1.2em;
}
.tooltip-text {
    visibility: hidden;
    width: 250px;
    background-color: #555;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 101; 
    bottom: 125%;
    left: 50%;
    margin-left: -125px;
    opacity: 0;
    transition: opacity 0.3s;
}
.info-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}


.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-link {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background-color: transparent;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--secondary-color);
    position: relative;
    bottom: -2px;
}

.tab-link.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.action-btn {
    display: block;
    margin: 15px auto;
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: 600;
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.action-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.action-btn:disabled {
    background-color: var(--secondary-color);
    cursor: not-allowed;
    transform: none;
}

.result-box {
    margin-top: 20px;
    padding: 20px;
    background-color: #e9f4ff;
    border: 1px solid #cce0ff;
    border-radius: var(--border-radius);
    text-align: center;
}

.single-result {
    font-size: 2em;
    font-weight: 600;
    color: var(--primary-color);
}

.controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background-color: #f1f1f1;
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

.slider-container {
    width: 45%;
}

.slider-container label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

input[type="range"] {
    width: 100%;
}

.info-box {
    text-align: center;
    font-style: italic;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.output-area {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

#puzzle-output h2 {
    text-align: center;
    width: 100%;
    grid-column: 1 / -1; 
    margin-bottom: 20px;
}

.group-box {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: background-color 0.2s;
    display: flex;
    flex-direction: column;
}

.group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.group-header h3 {
    margin: 0;
    font-size: 1.1em;
}

.topic-container {
    min-width: 80px;
    min-height: 28px;
}

.topic-item {
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: 600;
    color: white;
    cursor: grab;
    user-select: none;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.student-list {
    min-height: 50px;
    flex-grow: 1; 
    position: relative; 
}

.add-drop-zone {
    padding: 10px;
    margin-top: 8px;
    border: 2px dashed #cce0ff;
    border-radius: var(--border-radius);
    text-align: center;
    color: var(--primary-color);
    font-weight: 600;
    background-color: #f8f9fa;
}
.add-drop-zone.drop-zone-active {
    background-color: #e9f4ff;
}

.student-item {
    background-color: #e9f4ff;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 5px;
    cursor: grab;
    user-select: none;
    transition: all 0.2s ease-in-out;
    position: relative;
    z-index: 1; 
}

.sortable-ghost {
    display: none !important; 
}

.sortable-drag {
    opacity: 1 !important;
}

.student-fallback {
    position: fixed; 
    opacity: 0.7 !important;
    transform: rotate(5deg);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    background-color: #cce0ff;
    z-index: 9999;
    pointer-events: none; 
}

.student-item.swap-target {
    transform: scale(1.05);
    background-color: #a3d1ff;
}
.student-item.swap-target::after {
    content: '🔄';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    animation: spin 1s infinite linear;
    z-index: 2;
}

.student-expertise {
    font-size: 0.8em;
    color: #555;
    padding-left: 10px;
}

@keyframes spin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}
.modal-content {
    background: white;
    padding: 20px 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    position: relative;
}
.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2em;
    cursor: pointer;
    color: #aaa;
}
.modal-close-btn:hover {
    color: #333;
}
#delete-class-list .delete-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}
#delete-class-list .delete-item:last-child {
    border-bottom: none;
}
#delete-class-list .delete-icon {
    cursor: pointer;
    font-size: 1.2em;
}


footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
    color: var(--secondary-color);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* NEU: Styling für den Drag & Drop Hinweis */
.dnd-hint {
    text-align: center;
    padding: 12px;
    background-color: #e9f4ff;
    border-radius: var(--border-radius);
    margin-top: -5px; /* Etwas näher an die Boxen rücken */
    margin-bottom: 20px;
    font-style: italic;
    color: #0056b3;
    border: 1px solid #cce0ff;
    animation: fadeIn 0.5s;
}

@media (max-width: 768px) {
    .input-area {
        grid-template-columns: 1fr;
    }
    .optional-topics {
        margin-top: 10px;
    }
    .controls {
        flex-direction: column;
        gap: 20px;
    }
    .slider-container {
        width: 100%;
    }
}