/* ============================================================
   VALIDATION ENGINE — Styles for rules enforcement UI
   ============================================================ */

/* Validation Issues Panel (inside roster) */
.val-panel {
    background: rgba(255, 60, 60, 0.08);
    border: 1px solid rgba(255, 60, 60, 0.3);
    border-radius: 8px;
    margin: 8px 0;
    padding: 10px 12px;
    display: none;
}
.val-panel.has-errors {
    display: block;
}
.val-panel.all-legal {
    display: block;
    background: rgba(60, 200, 100, 0.08);
    border-color: rgba(60, 200, 100, 0.3);
}
.val-heading {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.val-heading .val-icon {
    font-size: 1rem;
}
.val-panel.has-errors .val-heading {
    color: #ff5c5c;
}
.val-panel.all-legal .val-heading {
    color: #4cda7a;
}
.val-panel.has-warnings {
    display: block;
    background: rgba(60, 200, 100, 0.06);
    border-color: rgba(255, 180, 40, 0.3);
}
.val-panel.has-warnings .val-heading {
    color: #4cda7a;
}
.val-error {
    font-size: 0.76rem;
    color: #ff8888;
    padding: 3px 0 3px 18px;
    position: relative;
    line-height: 1.4;
}
.val-error::before {
    content: '\2022';
    position: absolute;
    left: 6px;
    color: #ff5c5c;
}
.val-legal-msg {
    font-size: 0.76rem;
    color: #7be89a;
    padding: 2px 0 2px 18px;
}
.val-warning {
    font-size: 0.76rem;
    color: #ffb347;
    padding: 3px 0 3px 18px;
    position: relative;
    line-height: 1.4;
}
.val-warning::before {
    content: '\2022';
    position: absolute;
    left: 6px;
    color: #ffb347;
}

/* Validity badge in header — enhanced */
.validity.illegal {
    background: rgba(255, 60, 60, 0.15) !important;
    color: #ff5c5c !important;
    border: 1px solid rgba(255, 60, 60, 0.4) !important;
    cursor: pointer;
}
.validity.legal {
    background: rgba(60, 200, 100, 0.15) !important;
    color: #4cda7a !important;
    border: 1px solid rgba(60, 200, 100, 0.4) !important;
}
.validity.empty {
    background: rgba(255, 255, 255, 0.05) !important;
    color: rgba(255, 255, 255, 0.3) !important;
}

/* Roster entry warnings */
.rentry.val-warn {
    border-left: 3px solid #ff5c5c !important;
}
.rentry .val-tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
    vertical-align: middle;
}
.rentry .val-tag.duplicate {
    background: rgba(255, 60, 60, 0.2);
    color: #ff7777;
}
.rentry .val-tag.over-limit {
    background: rgba(255, 160, 40, 0.2);
    color: #ffb347;
}

/* Library unit card — greyed out when at limit */
.ucard.at-limit {
    opacity: 0.45;
    pointer-events: none;
    position: relative;
}
.ucard.at-limit::after {
    content: 'MAX';
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #ff5c5c;
    background: rgba(255, 60, 60, 0.15);
    padding: 1px 6px;
    border-radius: 3px;
}

/* Toast notification for blocked additions */
.val-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1a1a2e;
    border: 1px solid rgba(255, 60, 60, 0.5);
    color: #ff8888;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    z-index: 99999;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
    max-width: 90vw;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.val-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Enhancement warnings */
.enh-warning {
    font-size: 0.7rem;
    color: #ff8888;
    margin-top: 2px;
    padding-left: 4px;
}

/* Slot counter in roster header */
.slot-counters {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
    padding: 4px 0;
}
.slot-counter {
    font-size: 0.68rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}
.slot-counter.near-limit {
    background: rgba(255, 160, 40, 0.15);
    color: #ffb347;
}
.slot-counter.at-limit {
    background: rgba(255, 60, 60, 0.15);
    color: #ff5c5c;
}
.slot-counter .slot-label {
    font-weight: 600;
}

/* Phase 2: Leader attachment info on roster entries */
.val-leader-info {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.4);
    padding: 2px 0 4px 0;
    line-height: 1.4;
}
.val-leader-info.unattached {
    color: rgba(255, 180, 40, 0.6);
}
.val-leader-info.attached {
    color: rgba(100, 200, 120, 0.6);
}
.val-leader-label {
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.val-bg-name {
    opacity: 0.6;
}
.val-bg-name.in-roster {
    opacity: 1;
    color: #7be89a;
    font-weight: 500;
}
.val-bg-name.val-bg-suggest {
    cursor: pointer;
    text-decoration: underline dotted;
    opacity: 0.7;
    transition: opacity 0.15s;
}
.val-bg-name.val-bg-suggest:hover {
    opacity: 1;
    color: #9ecaed;
}

/* Fix: mobile bottom tabs overlapping content */
@media (max-width: 768px) {
    .main {
        padding-bottom: 56px;
    }
}
