/* ==========================================================================
   Loot Distribution Panel — party currency splitting
   Floating modal overlay triggered from the session view.
   ========================================================================== */

/* ---------- Overlay backdrop ---------- */

.loot-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* ---------- Panel container ---------- */

.loot-panel {
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */

.loot-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-primary);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.loot-panel-title {
  margin: 0;
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 600;
}

.loot-panel-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}

.loot-panel-close:hover {
  color: var(--text-primary);
}

/* ---------- Body ---------- */

.loot-panel-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ---------- Field groups ---------- */

.loot-field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.loot-field-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.loot-description-input {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  color: var(--text-primary);
  padding: 0.4rem 0.6rem;
  font-size: 0.9rem;
  width: 100%;
  box-sizing: border-box;
}

.loot-description-input:focus {
  outline: none;
  border-color: var(--accent-red);
}

/* ---------- Currency inputs ---------- */

.loot-currency-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.loot-currency-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.loot-currency-label {
  font-size: 0.85rem;
  color: var(--text-primary);
  min-width: 3rem;
  text-align: right;
}

.loot-currency-input {
  flex: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  color: var(--text-primary);
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.loot-currency-input:focus {
  outline: none;
  border-color: var(--accent-red);
}

/* ---------- Split result ---------- */

.loot-split-result {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  padding: 0.75rem;
}

.loot-split-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.loot-split-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.loot-split-note {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.loot-split-rows {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.loot-split-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border-primary);
}

.loot-split-row:last-child {
  border-bottom: none;
}

.loot-split-denom {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.loot-split-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.loot-split-remainder {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--warning);
  margin-left: 0.25rem;
}

.loot-split-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  text-align: center;
  padding: 0.5rem 0;
}

/* ---------- Action buttons ---------- */

.loot-panel-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

/* ---------- Responsive ---------- */

/* --- Tablet (768px) --- */
@media (max-width: 768px) {
  /* Panel: use more of the screen width on tablet */
  .loot-panel {
    max-width: 90vw;
  }

  /* Action buttons: allow wrapping so they don't overflow */
  .loot-panel-actions {
    justify-content: stretch;
  }
  .loot-panel-actions .button {
    flex: 1;
    text-align: center;
  }
}

/* --- Phone (480px) --- */
@media (max-width: 480px) {
  /* Full-screen sheet-up-from-bottom pattern */
  .loot-panel-overlay {
    padding: 0;
    align-items: flex-end;
  }
  .loot-panel {
    max-width: 100%;
    border-radius: 12px 12px 0 0;
    max-height: 85vh;
  }

  /* Currency label: tighter on small screens */
  .loot-currency-label {
    min-width: 2.5rem;
  }

  /* Inputs: 16px font to prevent iOS auto-zoom */
  .loot-description-input,
  .loot-currency-input {
    font-size: 1rem;
    min-height: 44px;
  }

  /* Action buttons: full-width, tappable */
  .loot-panel-actions {
    flex-direction: column;
  }
  .loot-panel-actions .button {
    width: 100%;
    min-height: 44px;
    text-align: center;
  }

  /* Close button: bigger tap target */
  .loot-panel-close {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
  }
}
