/* ============================================
   FIX BADGES (white-space + min-width)
   ============================================ */

.act-status,
.role-badge {
    white-space: nowrap;
    display: inline-block;
}

.data-table th:nth-child(5),
.data-table td:nth-child(5) {
    min-width: 90px;
}

/* ============================================
   DRAWER LATÉRAL D'ÉDITION (page Loot)
   ============================================ */

.loot-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 6, 18, 0.65);
    backdrop-filter: blur(2px);
    z-index: 100;
    animation: fadeIn 0.18s ease-out;
    cursor: pointer;
    display: block;
}

.loot-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    max-width: 92vw;
    background: linear-gradient(180deg, var(--panel-from), var(--panel-to));
    border-left: 1px solid var(--gold);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.5);
    z-index: 101;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    overflow: hidden;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.loot-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 22px 18px;
    border-bottom: 1px solid var(--line);
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.loot-drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: var(--paper-mute);
    text-decoration: none;
    font-size: 20px;
    line-height: 1;
    background: transparent;
    border: 1px solid var(--line);
    transition: all 0.15s;
    flex-shrink: 0;
    margin-left: 12px;
}

.loot-drawer-close:hover {
    background: var(--abyss);
    color: var(--crimson);
    border-color: rgba(255, 107, 107, 0.4);
}

.loot-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 22px;
}

/* ============================================
   STATUS RADIOS (cartes à cliquer)
   ============================================ */

.status-radios {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.status-radio {
    cursor: pointer;
    position: relative;
    display: block;
}

.status-radio input[type=radio] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.status-radio-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 14px 12px;
    background: var(--abyss);
    border: 1px solid var(--line);
    border-radius: 6px;
    transition: all 0.15s;
}

.status-radio-icon {
    font-size: 18px;
    margin-bottom: 6px;
}

.status-radio-label > span:nth-of-type(2) {
    font-family: 'Cinzel', serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--paper);
}

.status-radio-label small {
    font-size: 10px;
    color: var(--paper-faint);
    text-transform: none;
    letter-spacing: 0;
}

.status-radio:hover .status-radio-label {
    border-color: var(--gold);
    background: rgba(240, 196, 99, 0.05);
}

.status-radio input[type=radio]:checked + .status-radio-label {
    border-color: var(--gold-bright);
    background: linear-gradient(135deg, rgba(240, 196, 99, 0.12), rgba(232, 82, 138, 0.06));
    box-shadow: inset 0 0 0 1px var(--gold-bright);
}

.status-radio input[type=radio]:checked + .status-radio-label > span:nth-of-type(2) {
    color: var(--gold-bright);
}

/* ============================================
   FORMULAIRE DRAWER : inputs lisibles
   ============================================ */

.loot-drawer .field input,
.loot-drawer .field select {
    width: 100%;
    padding: 11px 13px;
    background: var(--night-deep);
    border: 1px solid var(--line);
    color: var(--paper);
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.15s;
}

.loot-drawer .field input:focus,
.loot-drawer .field select:focus {
    border-color: var(--gold);
    outline: none;
}

.loot-drawer .field label {
    display: block;
    color: var(--paper-mute);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 6px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 600px) {
    .loot-drawer {
        width: 100%;
        max-width: 100%;
    }
    .status-radios {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   FIX : drawer doit passer AU-DESSUS du header

   Le sélecteur .page a `position: relative; z-index: 1` (cf. app.css), ce qui crée un
   stacking context isolé. Du coup le drawer (position: fixed; z-index: 101) est trappé
   dans ce contexte et perd la bataille face au header sticky (z-index: 10) qui est dans
   le contexte parent (body). Solution : quand un drawer est ouvert (détecté via :has),
   on neutralise le z-index de .page pour libérer le drawer, et on rabaisse explicitement
   le header et la status-strip pour qu'ils passent dessous.
   ============================================ */
body:has(.loot-drawer) .page {
    z-index: auto;
}
body:has(.loot-drawer) .site-header,
body:has(.loot-drawer) .status-strip {
    z-index: 1;
}

/* Garde-fou : la pile interne du drawer reste cohérente. */
.loot-drawer-overlay { z-index: 9998; }
.loot-drawer         { z-index: 9999; }
