/* ═══════════════════════════════════════
   Origamia – Visual Theme
   Font: Andika 18pt · Color: #003973
   ═══════════════════════════════════════ */

/* ── Page Layout (68 / 32) ───────── */

.origamia-page {
    display: flex;
    width: 100%;
    min-height: calc(100vh - 60px);
    background-color: #fffeed;
    font-family: 'Andika', sans-serif;
    font-size: 18px;
    color: #003973;
    line-height: 1.55;
}

.origamia-exercise-zone {
    width: 68%;
    padding: 28px 36px;
    box-sizing: border-box;
    overflow-y: auto;
}

.origamia-feedback-zone {
    width: 32%;
    /* réservée à la superposition feedback du site hôte – doit rester vide en prod.
       (seul le sélecteur de dev temporaire y est posé, voir ci-dessous) */
}

/* ── Exercise Selector (dev temporaire, en haut à droite) ───────────── */

.exercise-selector-wrapper {
    display: flex;
    justify-content: flex-end;
    padding: 28px 36px 0;
}

.exercise-selector {
    width: 100%;
    max-width: 320px;
    padding: 10px 16px;
    font-family: 'Andika', sans-serif;
    font-size: 16px;
    color: #003973;
    border: 1.5px solid #003973;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.exercise-selector:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 57, 115, 0.12);
}

/* ── Fade-in ─────────────────────── */

.exercise-content {
    animation: origamiaFadeIn 0.4s ease;
}

@keyframes origamiaFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Consigne ────────────────────── */

.consigne-main {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 6px 0;
    margin-bottom: 12px;
    /* consigne principale : texte simple sur le fond crème (pas d'encadré) */
}

.consigne-highlight {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 22px;
    margin-bottom: 16px;
    background: #fff4be;
    border: 1px solid #e8d88a;
    border-radius: 12px;
}

.consigne-text {
    flex: 1;
    line-height: 1.55;
}

/* ── Speaker Icon ────────────────── */

.speaker-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    background: #003973;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    margin-top: 2px;
    cursor: pointer;
    transition: background 0.2s;
}

.speaker-icon:hover {
    background: #002a52;
}

/* État « en cours de lecture » (TTS) */
.speaker-icon.speaking {
    background: #428623;
    animation: speakerPulse 1s ease-in-out infinite;
}

@keyframes speakerPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(66, 134, 35, 0.5); }
    50%      { box-shadow: 0 0 0 6px rgba(66, 134, 35, 0); }
}

/* ── Iframe & Image ──────────────── */

.iframe-section {
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
}

#vittascience-iframe {
    width: 100%;
    height: 500px;
    border: none;
    display: block;
}

.image-section {
    margin-bottom: 20px;
    border-radius: 10px;
    overflow: hidden;
    border: 1.5px solid #c5d5e8;
}

#exercise-image {
    width: 100%;
    height: auto;
    display: block;
}

/* ═══════════════════════════════════════
   QCM / QCU
   ═══════════════════════════════════════ */

.qcm-section {
    margin-bottom: 20px;
}

/* Grid: 2 columns for cards, 1 for simple */
.responses-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
}

.responses-container.simple-options {
    grid-template-columns: 1fr;
    max-width: 420px;
}

/* ── Card variant (A / B / C / D) ── */

.response-card {
    position: relative;
    background: #fff;
    border: 1.5px solid #c5d5e8;
    border-radius: 12px;
    padding: 26px 18px 16px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0, 57, 115, 0.06);
}

.response-card:hover {
    border-color: #003973;
    box-shadow: 0 4px 14px rgba(0, 57, 115, 0.12);
}

.response-card.selected {
    border-color: #003973;
    background: #e6eef7;
    border-width: 2px;
}

.response-card.correct {
    border-color: #428623;
    background: #edf7e4;
    border-width: 2.5px;
}

.response-card.incorrect {
    border-color: #d14905;
    background: #fde8de;
    border-width: 2.5px;
}

.response-card-label {
    position: absolute;
    top: -14px;
    left: 14px;
    width: 30px;
    height: 30px;
    background: #003973;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
}

.response-card.correct .response-card-label { background: #428623; }
.response-card.incorrect .response-card-label { background: #d14905; }

.response-card-content {
    font-size: 16px;
    white-space: pre-line;
    line-height: 1.45;
}

/* ── Simple option variant ───────── */

.response-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    background: #fff;
    border: 1.5px solid #c5d5e8;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.response-option:hover {
    border-color: #003973;
}

.response-option.selected {
    border-color: #003973;
    background: #e6eef7;
    font-weight: 700;
    border-width: 2px;
}

.response-option.correct {
    border-color: #428623;
    background: #edf7e4;
    border-width: 2.5px;
}

.response-option.incorrect {
    border-color: #d14905;
    background: #fde8de;
    border-width: 2.5px;
}

.response-option-label {
    width: 30px;
    height: 30px;
    min-width: 30px;
    background: #003973;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
}

.response-option.correct .response-option-label { background: #428623; }
.response-option.incorrect .response-option-label { background: #d14905; }

/* ═══════════════════════════════════════
   Drag & Drop (ordering)
   ═══════════════════════════════════════ */

.dd-section {
    margin-bottom: 20px;
}

.dd-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px;
    background: #f0ebe0;
    border: 2px dashed #c5b88a;
    border-radius: 12px;
    min-height: 60px;
    margin-bottom: 14px;
}

.dd-target-header {
    font-size: 15px;
    color: #003973;
    opacity: 0.55;
    margin-bottom: 8px;
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dd-target {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    background: #fff;
    border: 2px dashed #428623;
    border-radius: 12px;
    min-height: 80px;
    margin-bottom: 16px;
    counter-reset: dd-counter;
}

.dd-item {
    display: flex;
    align-items: center;
    padding: 12px 18px;
    background: #6C63FF;
    color: #fff;
    border-radius: 10px;
    cursor: move;
    font-size: 16px;
    user-select: none;
    transition: transform 0.15s, box-shadow 0.15s;
    gap: 10px;
}

.dd-target .dd-item {
    counter-increment: dd-counter;
}

.dd-target .dd-item::before {
    content: counter(dd-counter);
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: #003973;
    color: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

.dd-item:hover {
    transform: scale(1.01);
    box-shadow: 0 3px 10px rgba(108, 99, 255, 0.3);
}

.dd-item.sortable-ghost {
    opacity: 0.35;
}

.dd-item.sortable-drag {
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.35);
}

/* ═══════════════════════════════════════
   Free Response
   ═══════════════════════════════════════ */

.free-section {
    margin-bottom: 20px;
}

.free-input {
    width: 100%;
    max-width: 400px;
    padding: 14px 18px;
    font-family: 'Andika', sans-serif;
    font-size: 18px;
    color: #003973;
    border: 1.5px solid #c5d5e8;
    border-radius: 10px;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.free-input:focus {
    outline: none;
    border-color: #003973;
    box-shadow: 0 0 0 3px rgba(0, 57, 115, 0.1);
}

.free-input::placeholder {
    color: #8a9bb0;
}

/* ═══════════════════════════════════════
   DDC (Drag & Drop – Categories)
   ═══════════════════════════════════════ */

.ddc-section {
    margin-bottom: 20px;
}

.ddc-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px;
    background: #f0ebe0;
    border: 2px dashed #c5b88a;
    border-radius: 12px;
    min-height: 60px;
    margin-bottom: 18px;
}

.categories-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.category-box {
    background: #fff;
    border: 1.5px solid #003973;
    border-radius: 10px;
    overflow: hidden;
}

.category-header {
    font-weight: 700;
    text-align: center;
    padding: 10px;
    background: #e6eef7;
    border-bottom: 1.5px solid #003973;
}

.category-dropzone {
    min-height: 90px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ddc-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    background: #6C63FF;
    color: #fff;
    border-radius: 8px;
    cursor: move;
    font-size: 16px;
    user-select: none;
    transition: transform 0.15s;
    text-align: center;
}

.ddc-item:hover {
    transform: scale(1.02);
}

.ddc-item.sortable-ghost {
    opacity: 0.35;
}

.ddc-item.sortable-drag {
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.35);
}

/* ═══════════════════════════════════════
   Submit Row
   ═══════════════════════════════════════ */

.submit-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 28px 0 18px;
}

.submit-label {
    font-size: 18px;
    font-weight: 700;
}

.submit-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #428623;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s, transform 0.15s;
}

.submit-btn:hover {
    background: #367018;
    transform: scale(1.08);
}

.submit-btn:active {
    transform: scale(0.95);
}

/* ═══════════════════════════════════════
   Feedback
   ═══════════════════════════════════════ */

.feedback-container {
    padding: 18px 22px;
    border-radius: 12px;
    margin-bottom: 16px;
    animation: origamiaFadeIn 0.3s ease;
}

.feedback-container.success {
    background: #edf7e4;
    border: 1.5px solid #428623;
    color: #2b5a14;
}

.feedback-container.error {
    background: #fde8de;
    border: 1.5px solid #d14905;
    color: #8c2f03;
}

.feedback-container p {
    margin: 0;
    font-size: 16px;
    line-height: 1.55;
}

/* ═══════════════════════════════════════
   Contenu HTML enrichi (énoncés, réponses…)
   ═══════════════════════════════════════ */

.origamia-page p { margin: 0 0 8px; }
.origamia-page p:last-child { margin-bottom: 0; }

.consigne-text ul,
.response-card-content ul,
.ddc-item ul {
    margin: 8px 0;
    padding-left: 22px;
}

.consigne-text li { margin-bottom: 4px; }

/* code en ligne (balise <code>) */
.origamia-page code {
    font-family: 'Menlo', 'Consolas', 'Courier New', monospace;
    font-size: 0.92em;
    background: #eef2f7;
    color: #003973;
    border: 1px solid #d3deeb;
    border-radius: 5px;
    padding: 1px 6px;
}

/* images inline dans les énoncés / réponses */
.consigne-text img {
    max-width: 100%;
    height: auto;
    margin: 8px 0;
    border-radius: 8px;
}

.response-card-content img,
.response-option img { max-width: 100%; height: auto; }

.dd-item img { max-height: 46px; width: auto; display: block; }

/* Étiquettes-images (drag & drop) : on retire le conteneur violet pour donner
   l'impression de manipuler le bloc lui-même, pas une image dans une boîte. */
.dd-item--image,
.ddc-item--image,
.ddt-frag--image {
    background: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    color: inherit;
}

.dd-item--image:hover,
.ddc-item--image:hover,
.ddt-frag--image:hover {
    box-shadow: none;
}

.dd-item--image img,
.ddc-item--image img,
.ddt-frag--image img {
    max-height: none;
    width: auto;
    display: block;
}

/* ═══════════════════════════════════════
   DDT (texte à trous)
   ═══════════════════════════════════════ */

.ddt-section {
    margin-bottom: 20px;
}

.ddt-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px;
    background: #f0ebe0;
    border: 2px dashed #c5b88a;
    border-radius: 12px;
    min-height: 56px;
    margin-bottom: 18px;
}

.ddt-text {
    background: #fff;
    border: 1.5px solid #c5d5e8;
    border-radius: 12px;
    padding: 18px 22px;
    line-height: 2.2;
}

.ddt-frag {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: #6C63FF;
    color: #fff;
    border-radius: 8px;
    cursor: move;
    font-size: 16px;
    user-select: none;
    transition: transform 0.15s;
}

.ddt-frag p { margin: 0; }
.ddt-frag:hover { transform: scale(1.02); }
.ddt-frag.sortable-ghost { opacity: 0.35; }
.ddt-frag.sortable-drag { box-shadow: 0 6px 20px rgba(108, 99, 255, 0.35); }

.ddt-blank {
    display: inline-block;
    min-width: 90px;
    min-height: 30px;
    padding: 2px 8px;
    margin: 0 3px;
    vertical-align: middle;
    background: #fff4be;
    border: 1.5px dashed #c5b88a;
    border-radius: 8px;
}

.ddt-blank .ddt-frag { margin: 2px; }

/* ═══════════════════════════════════════
   Responsive
   ═══════════════════════════════════════ */

@media (max-width: 900px) {
    .origamia-exercise-zone {
        width: 100%;
        padding: 18px;
    }

    .origamia-feedback-zone {
        display: none;
    }

    .responses-container {
        grid-template-columns: 1fr;
    }
}
