/* Basic Interactive Elements */
.interactive-choice,
.interactive-match,
.interactive-answer-view,
.interactive-fill {
    margin: 20px 0;
    padding: 20px;
    background: var(--background-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Choice Question */
.choice-question {
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.choice-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.choice-option {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    /* Reduced padding from 12px 15px to ~2px visual equivalent */
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.choice-option:hover {
    background: var(--background-secondary);
    transform: translateX(2px);
}

.option-marker {
    font-weight: bold;
    margin-right: 10px;
    color: var(--text-secondary);
    width: 25px;
}

.option-content {
    flex: 1;
}

/* Choice States */
.choice-option.correct {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.choice-option.incorrect {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Match Question */
.interactive-match {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    user-select: none;
}

.match-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.match-item {
    padding: 8px 10px;
    /* Reduced padding from 15px */
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 40px;
    /* Reduced min-height slightly */
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.match-item:hover {
    background: var(--background-secondary);
    border-color: var(--text-tertiary);
}

.match-item.selected {
    border-color: var(--primary-color);
    background-color: #e7f1ff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
    color: var(--primary-color);
}

.match-item.matched {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
    cursor: default;
    opacity: 0.8;
}

.match-item.error {
    animation: shake 0.5s;
    background-color: #f8d7da;
    border-color: #dc3545;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}

/* Image scaling inside options */
.choice-option img,
.match-item img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 4px;
}

/* Answer After View */
.view-question {
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 1.1em;
}

.view-controls {
    margin: 10px 0;
}

.view-answer {
    margin-top: 15px;
    padding: 15px;
    background: var(--background-color);
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fill in the Blank */
.fill-question {
    margin-bottom: 15px;
    line-height: 2.2;
    font-size: 1.05em;
}

.fill-input-wrapper {
    position: relative;
    display: inline-block;
    margin: 0 5px;
}

.fill-input {
    border: none;
    border-bottom: 2px solid var(--text-tertiary);
    background: transparent;
    padding: 2px 5px;
    outline: none;
    text-align: center;
    color: var(--text-primary);
    min-width: 80px;
    font-family: inherit;
    font-size: inherit;
    transition: all 0.2s;
}

.fill-input:focus {
    border-bottom-color: var(--primary-color);
}

.fill-input.correct {
    border-bottom-color: #28a745;
    background-color: rgba(40, 167, 69, 0.1);
    color: #155724;
}

.fill-input.incorrect {
    border-bottom-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.1);
    color: #721c24;
}

.fill-controls {
    margin-top: 20px;
    display: flex;
    gap: 15px;
}

/* General Interactive Buttons */
.interactive-btn {
    padding: 8px 18px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.interactive-btn:hover {
    background-color: var(--primary-hover);
}

.interactive-btn.secondary {
    background-color: var(--text-tertiary);
}

/* Toast Notification */
#interactive-toast {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    z-index: 1000;
    transition: opacity 0.5s;
    pointer-events: none;
    font-size: 14px;
    opacity: 0;
}

/* Summary Modal */
.summary-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.summary-modal-content {
    background: var(--background-color, #fff);
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
}

.summary-modal-title {
    margin: 0;
    font-size: 1.25em;
    font-weight: 600;
}

.summary-textarea {
    width: 100%;
    height: 300px;
    font-family: inherit;
    /* Use site font usually, or monospace if specialized */
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    resize: vertical;
    background: var(--background-secondary);
    color: var(--text-primary);
    font-size: 0.9em;
    line-height: 1.5;
}

.summary-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Floating FAB */
.interactive-fab {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 50px;
    padding: 10px 20px;
    font-weight: 500;
    transition: all 0.2s;
}

.interactive-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    /* Base Overrides via variables handled mostly, but states need specific colors */

    .choice-option.correct {
        background-color: rgba(46, 160, 67, 0.15);
        border-color: rgba(46, 160, 67, 0.4);
        color: #7ee787;
    }

    .choice-option.incorrect {
        background-color: rgba(255, 123, 114, 0.15);
        border-color: rgba(255, 123, 114, 0.4);
        color: #ff7b72;
    }

    .match-item.selected {
        background-color: rgba(56, 139, 253, 0.15);
        border-color: #388bfd;
        color: #c9d1d9;
        box-shadow: 0 0 0 2px rgba(56, 139, 253, 0.25);
    }

    .match-item.matched {
        background-color: rgba(46, 160, 67, 0.15);
        border-color: rgba(46, 160, 67, 0.4);
        color: #7ee787;
    }

    .match-item.error {
        background-color: rgba(255, 123, 114, 0.15);
        border-color: rgba(255, 123, 114, 0.4);
    }

    .fill-input.correct {
        border-bottom-color: #2ea043;
        background-color: rgba(46, 160, 67, 0.15);
        color: #7ee787;
    }

    .fill-input.incorrect {
        border-bottom-color: #f85149;
        background-color: rgba(255, 123, 114, 0.15);
        color: #ff7b72;
    }
}