/* ============================================================
   ER-Trainer – Stylesheet
   Chen-Notation: Rechtecke (Entitäten), Rauten (Beziehungen),
   Ovale (Attribute), Drag & Drop Pool
   ============================================================ */

/* ----------------------------------------------------------
   Diagramm-Container
   ---------------------------------------------------------- */
.er-canvas-outer {
    width: 100%;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: visible;
    position: relative;
    user-select: none;
}

/* ----------------------------------------------------------
   Entitäts-Rechteck
   ---------------------------------------------------------- */
.er-entity {
    position: absolute;
    background: #fff;
    border: 2px solid #212529;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    text-align: center;
    padding: 4px 8px;
    box-sizing: border-box;
    transform: translate(-50%, -50%);
    min-width: 100px;
    height: 42px;
    white-space: nowrap;
    z-index: 10;
}

/* Doppeltes Rechteck für schwache Entitäten */
.er-entity.weak {
    box-shadow: inset 0 0 0 3px #212529;
}

/* Slot-Variante: gestrichelter Rand */
.er-entity.er-slot {
    border-style: dashed;
    border-color: #6c757d;
    background: #f8f9fa;
    color: #adb5bd;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

/* ----------------------------------------------------------
   Attribut-Oval
   ---------------------------------------------------------- */
.er-attribute {
    position: absolute;
    background: #fff;
    border: 2px solid #212529;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    text-align: center;
    padding: 4px 10px;
    box-sizing: border-box;
    transform: translate(-50%, -50%);
    min-width: 80px;
    height: 32px;
    z-index: 10;
    white-space: nowrap;
}

/* Primärschlüssel: unterstrichener Text */
.er-attribute.primary span,
.er-attribute.primary {
    text-decoration: underline;
    font-weight: 600;
}

/* Mehrwertiges Attribut: doppeltes Oval */
.er-attribute.multivalued {
    box-shadow: inset 0 0 0 3px #212529;
}

/* Abgeleitetes Attribut: gestrichelter Rand */
.er-attribute.derived {
    border-style: dashed;
    border-color: #212529;
}

/* Slot-Variante */
.er-attribute.er-slot {
    border-style: dashed;
    border-color: #6c757d;
    background: #f8f9fa;
    color: #adb5bd;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

/* ----------------------------------------------------------
   Beziehungs-Raute (Diamond)
   Technik: äußerer Container positioniert + inneres
   rotiertes Quadrat + darüber liegendes Label
   ---------------------------------------------------------- */
.er-rel-outer {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 10;
    cursor: default;
}

.er-rel-shape {
    position: absolute;
    background: #fff;
    border: 2px solid #212529;
    transform: rotate(45deg);
    transform-origin: center center;
    box-sizing: border-box;
}

.er-rel-label {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    word-break: break-word;
    line-height: 1.2;
    pointer-events: none;
    padding: 4px;
    top: 0;
    left: 0;
}

/* Slot-Variante */
.er-rel-outer.er-slot .er-rel-shape {
    border-style: dashed;
    border-color: #6c757d;
    background: #f8f9fa;
}
.er-rel-outer.er-slot .er-rel-label {
    color: #adb5bd;
}
.er-rel-outer.er-slot {
    cursor: pointer;
}

/* Identifizierende Beziehung (doppelte Raute) */
.er-rel-outer.identifying .er-rel-shape {
    box-shadow: inset 0 0 0 3px #212529;
}

/* ----------------------------------------------------------
   Kardinalitäts-Label
   ---------------------------------------------------------- */
.er-cardinality {
    position: absolute;
    transform: translate(-50%, -50%);
    font-size: 15px;
    font-weight: 700;
    background: #fff;
    padding: 1px 5px;
    z-index: 20;
    line-height: 1;
}

.er-cardinality.er-slot {
    border: 1px dashed #6c757d;
    border-radius: 4px;
    background: #f8f9fa;
    color: #adb5bd;
    min-width: 26px;
    min-height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

/* ----------------------------------------------------------
   Drag-Highlight-Zustände
   ---------------------------------------------------------- */
.er-slot.drag-highlight {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.35) !important;
}

.er-rel-outer.drag-highlight .er-rel-shape {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.35) !important;
}

/* Korrekt (grün) */
.er-slot.slot-correct,
.er-slot.slot-correct .er-rel-shape {
    border-color: #198754 !important;
    border-style: solid !important;
    background: #d1e7dd !important;
}
.er-rel-outer.slot-correct .er-rel-label { color: #0f5132; }

/* Falsch (rot) */
.er-slot.slot-wrong,
.er-slot.slot-wrong .er-rel-shape {
    border-color: #dc3545 !important;
    border-style: solid !important;
    background: #f8d7da !important;
}
.er-rel-outer.slot-wrong .er-rel-label { color: #842029; }

/* Gefüllt (neutral) */
.er-slot.slot-filled {
    border-style: solid;
    border-color: #495057;
    background: #fff;
    color: #212529;
}
.er-rel-outer.slot-filled .er-rel-shape {
    border-style: solid;
    border-color: #495057;
    background: #fff;
}
.er-rel-outer.slot-filled .er-rel-label { color: #212529; }

/* ----------------------------------------------------------
   Token-Pool
   ---------------------------------------------------------- */
.er-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 14px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    min-height: 52px;
}

.er-pool-item {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border-radius: 20px;
    border: 2px solid;
    font-size: 13px;
    font-weight: 500;
    cursor: grab;
    user-select: none;
    transition: opacity 0.15s, transform 0.1s;
    white-space: nowrap;
}

.er-pool-item:active {
    cursor: grabbing;
    transform: scale(1.05);
}

.er-pool-item.used {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Pool-Farben nach Element-Typ */
.er-pool-item[data-item-type="entity"] {
    background: #fff3e0;
    border-color: #e65100;
    color: #bf360c;
}
.er-pool-item[data-item-type="attribute"] {
    background: #e3f2fd;
    border-color: #1565c0;
    color: #0d47a1;
}
.er-pool-item[data-item-type="relationship"] {
    background: #fce4ec;
    border-color: #ad1457;
    color: #880e4f;
}
.er-pool-item[data-item-type="cardinality"] {
    background: #e8f5e9;
    border-color: #2e7d32;
    color: #1b5e20;
    font-size: 15px;
    font-weight: 700;
    padding: 3px 12px;
}

/* ----------------------------------------------------------
   Pool-Beschriftung
   ---------------------------------------------------------- */
.er-pool-header {
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

/* ----------------------------------------------------------
   Hoverable Scenario Cards
   ---------------------------------------------------------- */
.er-hover-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.er-hover-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12) !important;
}
