/* ============================================================
   DIAGRAMMING — Shared Styles
   Used by both diagramming/index.php and quiz/index.php
   ============================================================ */

/* ---- Card ---- */
.diagramming-card {
    background: #fff;
    border-radius: 8px;
    padding: 2rem 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    border-top: 3px solid #8ea4be;
}
.diagramming-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}
.diagramming-card .card-label {
    font-size: 0.75rem;
    color: #a08060;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

/* ---- Diagram Area ---- */
.diagram-area {
    min-height: 220px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 2.5rem;
    padding: 2rem 1rem 0;
    margin-bottom: 1.5rem;
}
.slot-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

/* ---- Modifier tree (side-by-side branches) ---- */
.mod-branches {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    position: relative;
    margin-bottom: 20px;
}
.mod-branches::after {
    content: '';
    position: absolute;
    bottom: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 10px;
    background: #b0bfd0;
}
.mod-branches.single::after {
    height: 16px;
}
.mod-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 8px;
    position: relative;
}
.mod-branch::before {
    content: '';
    position: absolute;
    bottom: -6px;
    height: 2px;
    background: #b0bfd0;
    left: 0;
    right: 0;
}
.mod-branch:first-child::before { left: 50%; }
.mod-branch:last-child::before  { right: 50%; }
.mod-branch:only-child::before  { display: none; }
.mod-branch::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 6px;
    background: #b0bfd0;
}
.mod-branch:only-child::after { display: none; }

/* ---- Prepositional phrase ---- */
.prep-phrase-col {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.prep-box {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.45rem 0.9rem;
    background: #fff;
    border: 2px solid #8ea4be;
    border-radius: 6px;
    font-family: 'Georgia', serif;
    font-size: 1.05rem;
    font-weight: bold;
    color: #2c1810;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    user-select: none;
    white-space: nowrap;
}
.prep-box.correct { border-color: #4a8c3f; background: #eaf5e8; }
.prep-box.incorrect { border-color: #c0392b; background: #fdeaea; }
.prep-box-word {
    cursor: pointer;
    transition: color 0.15s;
}
.prep-box-word:hover { color: #c0392b; }
.prep-box.drag-over {
    border-color: #3b6fa0;
    background: rgba(142, 164, 190, 0.12);
    box-shadow: 0 0 0 3px rgba(59, 111, 160, 0.18);
}

/* ---- Compound phrase (conjunction "et") ---- */
.compound-col {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.compound-box {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.45rem 0.9rem;
    background: #fff;
    border: 2px solid #8ea4be;
    border-radius: 6px;
    font-family: 'Georgia', serif;
    font-size: 1.05rem;
    font-weight: bold;
    color: #2c1810;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    user-select: none;
    white-space: nowrap;
}
.compound-box.correct { border-color: #4a8c3f; background: #eaf5e8; }
.compound-box.incorrect { border-color: #c0392b; background: #fdeaea; }
.compound-box.drag-over {
    border-color: #3b6fa0;
    background: rgba(142, 164, 190, 0.12);
    box-shadow: 0 0 0 3px rgba(59, 111, 160, 0.18);
}
.compound-box-word {
    cursor: pointer;
    transition: color 0.15s;
}
.compound-box-word:hover { color: #c0392b; }
.compound-box-et {
    font-style: italic;
    color: #6b5544;
    font-weight: normal;
    cursor: pointer;
    transition: color 0.15s;
}
.compound-box-et:hover { color: #c0392b; }
.compound-box.waiting {
    border-style: dashed;
    color: #a08060;
}
.compound-item-anchor {
    width: 0;
    height: 0;
}

/* ---- Relative clause ---- */
.relative-clause-box {
    border: 2px solid #d4c5b0;
    border-radius: 8px;
    padding: 1rem 0.75rem 0.5rem;
    background: #faf8f4;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.relative-clause-box .clause-slots {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1.5rem;
}
.relative-clause-box .slot-column { min-width: 80px; }
.relative-clause-box .slot-drop { width: 90px; height: 40px; }
.clause-unassigned {
    margin-bottom: 0.75rem;
    text-align: center;
}
.clause-unassigned-hint {
    font-size: 0.65rem;
    color: #a08060;
    font-style: italic;
    margin-top: 0.25rem;
}

/* ---- Third-slot toggle ---- */
.slot-label-toggle {
    cursor: pointer;
    transition: color 0.15s;
}
.slot-label-toggle:hover {
    color: #3b6fa0;
    text-decoration: underline;
}
.slot-label-toggle.correct-label { color: #4a8c3f; }
.slot-label-toggle.incorrect-label { color: #c0392b; }

/* ---- Third-slot choice (both options shown) ---- */
.slot-label-choices {
    display: flex;
    gap: 0.3rem;
    justify-content: center;
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 2px solid #d4c5b0;
    width: 100%;
}
.slot-label-choice {
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #6b5544;
    font-weight: 600;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border: 1.5px solid #d4c5b0;
    border-radius: 3px;
    transition: all 0.15s;
    background: #fff;
    white-space: nowrap;
}
.slot-label-choice:hover {
    color: #3b6fa0;
    border-color: #8ea4be;
    background: rgba(142, 164, 190, 0.08);
}
.slot-label-choices.needs-choice .slot-label-choice {
    border-color: #c0392b;
    color: #c0392b;
}

/* ---- Drop zone (empty slot) ---- */
.slot-drop {
    width: 110px;
    height: 48px;
    border: 2px dashed #d4c5b0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #faf8f4;
    transition: all 0.15s;
}
.slot-drop.drag-over {
    border-color: #3b6fa0;
    background: rgba(142, 164, 190, 0.12);
    box-shadow: 0 0 0 3px rgba(59, 111, 160, 0.18);
}

/* ---- Slot label ---- */
.slot-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #a08060;
    font-weight: 600;
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 2px solid #d4c5b0;
    width: 100%;
    text-align: center;
}

/* ---- Placed word chip in diagram ---- */
.diagram-chip {
    display: inline-block;
    padding: 0.45rem 0.9rem;
    background: #fff;
    border: 2px solid #8ea4be;
    border-radius: 6px;
    font-family: 'Georgia', serif;
    font-size: 1.05rem;
    font-weight: bold;
    color: #2c1810;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    user-select: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.diagram-chip:hover {
    border-color: #c0392b;
    background: #fef5f5;
}
.diagram-chip.drag-over {
    border-color: #3b6fa0;
    background: rgba(142, 164, 190, 0.12);
    box-shadow: 0 0 0 3px rgba(59, 111, 160, 0.18);
}
.diagram-chip.correct { border-color: #4a8c3f; background: #eaf5e8; }
.diagram-chip.incorrect { border-color: #c0392b; background: #fdeaea; }

/* ---- Sentence area ---- */
.sentence-area {
    border-top: 1px solid #e8e2d8;
    padding-top: 1.25rem;
    margin-bottom: 1.25rem;
}
.sentence-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #a08060;
    font-weight: 600;
    margin-bottom: 0.75rem;
}
.sentence-words {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

/* ---- Draggable word chip in sentence ---- */
.word-chip {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    background: #fff;
    border: 2px solid #d4c5b0;
    border-radius: 20px;
    font-family: 'Georgia', serif;
    font-size: 1rem;
    color: #2c1810;
    cursor: grab;
    user-select: none;
    transition: all 0.2s;
}
.word-chip:hover {
    border-color: #8ea4be;
    color: #3b6fa0;
}
.word-chip.placed {
    opacity: 0.35;
    background: #e8e2d8;
    border-color: #c0b8a8;
    color: #8a7a6a;
    cursor: default;
}
.word-chip.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}
.sentence-period {
    font-size: 1rem;
    color: #6b5544;
}

/* ---- Instructions ---- */
.dg-instructions {
    font-size: 0.85rem;
    color: #6b5544;
    font-style: italic;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

/* ---- Buttons ---- */
.dg-button-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}
.dg-action-btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background: #3b6fa0;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-family: 'Georgia', serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
}
.dg-action-btn:hover { background: #2d5a84; }
.dg-action-btn:disabled { background: #ccc; cursor: default; }
.dg-action-btn.secondary {
    background: #fff;
    color: #6b5544;
    border: 2px solid #d4c5b0;
}
.dg-action-btn.secondary:hover { border-color: #8b6914; color: #8b6914; }

/* ---- Result panel ---- */
.dg-result-panel {
    margin-top: 1.25rem;
    padding: 1rem 1.25rem;
    border-radius: 6px;
    text-align: left;
}
.dg-result-panel.answer {
    background: #eaf5e8;
    border: 1px solid #b8d4b0;
}
.dg-result-panel.feedback {
    background: #f0f4f8;
    border: 1px solid #b0bfd0;
}
.dg-result-panel.error {
    background: #fdeaea;
    border: 1px solid #e0b0b0;
}
.dg-panel-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6b5544;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.dg-panel-text {
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ---- Touch drag clone ---- */
.drag-clone {
    opacity: 0.85;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    pointer-events: none;
    z-index: 1000;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    .diagram-area { gap: 1.25rem; padding: 1.5rem 0.5rem 0; }
    .diagram-chip { font-size: 0.9rem; padding: 0.35rem 0.7rem; }
    .word-chip { font-size: 0.85rem; padding: 0.3rem 0.65rem; }
    .slot-drop { width: 85px; height: 40px; }
    .slot-column { min-width: 80px; }
}
