/* =========================================================
   1. BASE & SHARED COMPONENTS
   ========================================================= */

:root {
    --mx-success: #198754;
    --mx-danger: #dc3545;
    --mx-border: #dee2e6;
    --mx-bg-light: #f8f9fa;
}

/* =========================================================
   ITEMS
   ========================================================= */

.mx-item {
    cursor: grab;
    border-radius: .5rem;
    padding: 8px 16px;
    position: relative;
    background: #fff;
    border: 1px solid #d9dee3;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    transition: transform .15s ease,
                background-color .15s ease,
                box-shadow .15s ease;
    user-select: none;
    font-size: .92rem;

    display: flex;              /* <-- stable */
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.mx-item:active {
    cursor: grabbing;
}

.mx-item:hover {
    background: #f8fafc;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.mx-item-img {
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
    border-radius: .25rem;
    display: block;
    margin: 0 auto;
}

.mx-item-caption {
    font-size: .85rem;
    font-weight: 600;
    margin-top: 6px;
    text-align: center;
}

/* =========================================================
   DROPZONES
   ========================================================= */

.mx-dropzone {
    min-height: 50px;
    border: 2px dashed #c6cbd1;
    background: #fff;
    border-radius: .6rem;
    padding: 5px;
    transition: background-color .2s ease,
                border-color .2s ease;
}

.mx-dropzone.over {
    background-color: #e9f2ff !important;
    border-color: #0d6efd !important;
}

/* =========================================================
   CLASSIFY
   ========================================================= */

.classify-layout {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.classify-zones {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
}

.classify-zones .mx-dropzone {
    min-height: 150px;
}

.mx-zone-card {
    border: 1px solid var(--mx-border);
    border-radius: .75rem;
    flex: 1 1 240px;
    max-width: 320px;
    overflow: hidden;
    background: var(--mx-bg-light);
    
    display: flex;
    flex-direction: column;
}

.mx-zone-card .mx-dropzone {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-content: flex-start;
}

.mx-zone-header {
    text-align: center;
    font-weight: 700;
    padding: .75rem;
    background: #495057;
    color: #fff;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.classify-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-content: flex-start;
}
/* =========================================================
   ORDER
   ========================================================= */
.order-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-content: flex-start;
}

.order-line {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    padding: 10px;
    border: 1px solid var(--mx-border);
    border-radius: .75rem;
    background: var(--mx-bg-light);
    min-height: 76px;
}

.order-slot {
    flex: 0 0 16px;
    height: 52px;
    border: 2px dashed #adb5bd;
    border-radius: .5rem;
    background: #fff;
}

/* =========================================================
   PAIRS
   ========================================================= */

.pairs-bank {
    margin-top: 20px;
    padding: 16px;
    border-radius: .75rem;
    background: linear-gradient(180deg,#eef4ff,#f8fbff);
    border: 1px solid var(--mx-border);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.pairs-rows {
    display: grid;
    row-gap: 12px;
}

.pairs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.pairs-static {
    background: var(--mx-bg-light);
    border: 1px solid var(--mx-border);
    border-radius: .75rem;
    padding: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   FEEDBACK
   ========================================================= */

.mx-item.mx-correct-soft {
    border-color: var(--mx-success) !important;
    background: #e6f4ea !important;
}

.mx-item.mx-wrong-soft {
    border-color: var(--mx-danger) !important;
    background: #fdf2f2 !important;
}

.mx-item.mx-correct-strong {
    background: var(--mx-success) !important;
    border-color: #146c43 !important;
    color: #fff !important;
    animation: mxPulse .3s ease-in-out;
}

.mx-item.mx-wrong-strong {
    background: var(--mx-danger) !important;
    border-color: #b02a37 !important;
    color: #fff !important;
    animation: mxShake .2s ease-in-out 0s 2;
}

.mx-item, .mx-dropzone{
  touch-action: none;
}

/* Animations */
@keyframes mxShake {
    0%,100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes mxPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.04); }
    100% { transform: scale(1); }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 992px) {
    .pairs-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .mx-zone-card {
        max-width: 100%;
    }

    .classify-zones {
        flex-direction: column;
        align-items: center;
    }
}

/* =========================================
   CLASSIFY — portrait / mobile fix
========================================= */

@media (max-width: 992px) {

  .classify-zones {
    flex-direction: column;
    align-items: stretch; /* ← important */
  }

  .mx-zone-card {
    flex: 1 1 auto;       /* annule le 240px */
    max-width: 100%;      /* pleine largeur */
    width: 100%;
  }

}

/* =========================================
   PAIRS — portrait lisible
========================================= */

@media (max-width: 992px) {

  .pairs-row {
    display: flex;            /* on quitte grid */
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--mx-border);
    border-radius: .75rem;
    background: var(--mx-bg-light);
  }

  .pairs-static {
    background: #fff;         /* plus contrasté */
    font-size: 1rem;
  }

  .pairs-slot {
    min-height: 60px;
  }

}