/* ============================================================
   CSS COG: level_manager.css - Level Up / De-Level Modal
   Author:   Steven J. Cook (Shinra.Engineer)
   Date:     2026-04-25
   Time:     16:00 UTC
   Model:    Claude Opus 4.7
   Chat:     Level Manager Summary Panel
   Revision: 1.1.0
   Changes:
     v1.1.0 - Added two-column modal body layout (.lm-body-wrap)
              with sticky right-side .lm-summary-rail. Modal
              expands to 1100px (.lm-modal-wide) when the rail
              is showing. Rail collapses to single-column under
              900px viewport width. Color tokens for delta rows:
              green for gains (level-up), red for losses
              (de-level), amber for attribute swings.
     v1.0.0 - Initial Level Manager modal.
   ============================================================ */

/* Modal shell */
.lm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9500;
  padding: 1.5em 1em;
}

.lm-modal {
  background: var(--bg-dark, #2b2d31);
  border: 1px solid var(--border-thin, #3f4147);
  border-radius: var(--radius-lg, 10px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.lm-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9em 1.2em;
  border-bottom: 1px solid var(--border-thin);
  flex-shrink: 0;
  background: var(--bg-darkest);
}
.lm-header h2 {
  font-family: var(--font-display);
  font-size: 1.15em;
  color: var(--accent-amber);
  margin: 0;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.5em;
}
.lm-header .lm-close {
  background: #111;
  border: 1px solid #3a3a3a;
  color: #aaa;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lm-header .lm-close:hover {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}

.lm-body {
  padding: 1.2em 1.5em;
  overflow-y: auto;
  flex: 1;
  min-width: 0;
}
.lm-footer {
  padding: 0.9em 1.2em;
  border-top: 1px solid var(--border-thin);
  flex-shrink: 0;
  background: var(--bg-darkest);
  display: flex;
  justify-content: space-between;
  gap: 0.5em;
  flex-wrap: wrap;
}

/* Sheet header buttons (Add/Remove level) */
.btn-level-add {
  background: rgba(87,242,135,0.12);
  border: 1px solid rgba(87,242,135,0.35);
  color: var(--accent-green);
}
.btn-level-add:hover {
  background: rgba(87,242,135,0.25);
  color: #8fff9f;
}
.btn-level-remove {
  background: rgba(237,66,69,0.12);
  border: 1px solid rgba(237,66,69,0.35);
  color: var(--accent-red);
}
.btn-level-remove:hover {
  background: rgba(237,66,69,0.25);
  color: #ff8a8a;
}

/* Warning banner (yellow, used in fallback de-level) */
.lm-warning {
  background: rgba(240,178,50,0.1);
  border: 1px solid rgba(240,178,50,0.35);
  border-radius: var(--radius-sm);
  padding: 0.7em 0.9em;
  margin-bottom: 1em;
  color: var(--accent-amber);
  font-size: 0.9em;
  line-height: 1.5;
}
.lm-warning i { margin-right: 0.4em; }

/* Section headers inside body */
.lm-section-label {
  font-family: var(--font-display);
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-amber);
  margin-bottom: 0.6em;
  padding-bottom: 0.3em;
  border-bottom: 1px solid rgba(240,178,50,0.2);
}
.lm-section-label i { margin-right: 0.4em; }

/* Summary review cards */
.lm-summary-line {
  display: flex;
  justify-content: space-between;
  padding: 0.4em 0.7em;
  background: var(--bg-darkest);
  border: 1px solid var(--border-thin);
  border-radius: var(--radius-sm);
  margin-bottom: 0.3em;
  font-size: 0.92em;
}
.lm-summary-line .lm-summary-label {
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.8em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.lm-summary-line .lm-summary-value {
  color: var(--text-primary);
  font-weight: 700;
}

/* Safe-to-save warning, bold italic yellow */
.lm-safe-prompt {
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 1.05em;
  color: var(--accent-amber);
  letter-spacing: 0.04em;
  margin: 1.2em 0 0.8em;
  padding: 0.7em;
  background: rgba(240,178,50,0.06);
  border-top: 1px solid rgba(240,178,50,0.2);
  border-bottom: 1px solid rgba(240,178,50,0.2);
}

/* Rest / IP action row */
.lm-action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75em;
  flex-wrap: wrap;
  margin-bottom: 1em;
}
.lm-action-sep {
  color: var(--text-faint);
  font-family: var(--font-display);
  font-size: 0.85em;
  font-style: italic;
  letter-spacing: 0.04em;
}
.lm-action-status {
  text-align: center;
  font-size: 0.8em;
  color: var(--accent-green);
  font-style: italic;
  margin-top: -0.4em;
  margin-bottom: 0.8em;
  min-height: 1.2em;
}

/* Separator line */
.lm-separator {
  border: 0;
  border-top: 1px solid var(--border-thin);
  margin: 1em 0;
}

/* Progress dots for the multi-step wizard */
.lm-progress {
  display: flex;
  gap: 0.4em;
  justify-content: center;
  margin-bottom: 1em;
}
.lm-progress .lm-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-lighter);
  transition: all 0.3s;
}
.lm-progress .lm-dot.done { background: var(--accent-green); }
.lm-progress .lm-dot.current {
  background: var(--accent-blue);
  box-shadow: 0 0 6px rgba(88,101,242,0.5);
}

/* De-level class/skill row */
.lm-delevel-row {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.6em 0.8em;
  background: var(--bg-darkest);
  border: 1px solid var(--border-thin);
  border-radius: var(--radius-sm);
  margin-bottom: 0.4em;
}
.lm-delevel-row .lm-dl-minus,
.lm-delevel-row .lm-dl-plus {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border-thin);
  background: var(--bg-lighter);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1em;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}
.lm-delevel-row .lm-dl-minus:hover:not(:disabled) {
  background: var(--accent-red);
  border-color: var(--accent-red);
  color: #fff;
}
.lm-delevel-row .lm-dl-plus:hover:not(:disabled) {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #000;
}
.lm-delevel-row .lm-dl-minus:disabled,
.lm-delevel-row .lm-dl-plus:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}
.lm-delevel-row .lm-dl-info {
  flex: 1;
  min-width: 0;
}
.lm-delevel-row .lm-dl-name {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.95em;
}
.lm-delevel-row .lm-dl-meta {
  font-family: var(--font-code);
  font-size: 0.8em;
  color: var(--text-muted);
  margin-top: 0.1em;
}
.lm-delevel-row .lm-dl-delta {
  font-family: var(--font-code);
  font-weight: 700;
  font-size: 0.9em;
  padding: 0.2em 0.5em;
  border-radius: 4px;
  background: rgba(237,66,69,0.12);
  color: var(--accent-red);
  flex-shrink: 0;
}
.lm-delevel-row .lm-dl-delta.lm-dl-no-change {
  background: var(--bg-lighter);
  color: var(--text-faint);
}

/* Points remaining per class (de-level skill step) */
.lm-dl-classgroup {
  margin-bottom: 1em;
  padding: 0.7em 0.8em;
  background: var(--bg-darkest);
  border: 1px solid var(--border-thin);
  border-radius: var(--radius-sm);
}
.lm-dl-classgroup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5em;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--border-thin);
}
.lm-dl-classgroup-title {
  font-family: var(--font-display);
  font-size: 0.9em;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 0.04em;
}
.lm-dl-points-badge {
  font-family: var(--font-code);
  font-size: 0.8em;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  background: rgba(240,178,50,0.12);
  border: 1px solid rgba(240,178,50,0.3);
  color: var(--accent-amber);
}
.lm-dl-points-badge.lm-dl-points-zero {
  background: rgba(255,255,255,0.04);
  border-color: var(--border-thin);
  color: var(--text-faint);
}

/* Reuse existing wizard .pick-list styles for class/skill/spell pickers */
/* We don't override them, we just use the same markup */

/* ============================================================
   v1.1.0 - TWO-COLUMN BODY + SUMMARY RAIL
   ============================================================ */

/* Wider modal when the rail is showing */
.lm-modal-wide {
  max-width: 1100px;
}

/* Flex wrapper holding [.lm-body | .lm-summary-rail] */
.lm-body-wrap {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Sticky right-side rail */
.lm-summary-rail {
  width: 280px;
  flex-shrink: 0;
  border-left: 1px solid var(--border-thin);
  background: var(--bg-darkest);
  padding: 1em 1.1em;
  overflow-y: auto;
  font-size: 0.88em;
  line-height: 1.4;
}

.lm-rail-title {
  font-family: var(--font-display);
  font-size: 0.95em;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-amber);
  margin: 0 0 0.6em 0;
  padding-bottom: 0.4em;
  border-bottom: 1px solid rgba(240,178,50,0.25);
}
.lm-rail-title i { margin-right: 0.35em; }

.lm-rail-empty {
  color: var(--text-faint);
  font-size: 0.9em;
  margin: 0.5em 0;
}

/* Section divider inside the rail */
.lm-rail-section {
  font-family: var(--font-display);
  font-size: 0.7em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.9em;
  margin-bottom: 0.3em;
  padding-bottom: 0.2em;
  border-bottom: 1px dashed var(--border-thin);
}
.lm-rail-section:first-of-type { margin-top: 0.3em; }

/* One delta row */
.lm-rail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.4em;
  padding: 0.25em 0;
  border-bottom: 1px solid rgba(63,65,71,0.35);
}
.lm-rail-row:last-child { border-bottom: none; }

.lm-rail-label {
  color: var(--text-secondary);
  font-size: 0.92em;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.lm-rail-value {
  font-family: var(--font-code);
  font-size: 0.85em;
  white-space: nowrap;
  flex-shrink: 0;
}
.lm-rail-value strong {
  font-weight: 700;
}

/* Color variants by row kind / mode */
.lm-rail-gain .lm-rail-value strong {
  color: var(--accent-green);
}
.lm-rail-gain .lm-rail-add {
  color: var(--accent-green);
  font-weight: 700;
}
.lm-rail-loss .lm-rail-value strong {
  color: var(--accent-red);
}
.lm-rail-loss .lm-rail-rem {
  color: var(--accent-red);
  font-weight: 700;
  font-style: italic;
}
.lm-rail-attr .lm-rail-value strong {
  color: var(--accent-amber);
}
.lm-rail-attr .lm-rail-label {
  color: var(--accent-amber);
}

/* Custom scrollbar inside the rail to match the rest of the app */
.lm-summary-rail::-webkit-scrollbar { width: 6px; }
.lm-summary-rail::-webkit-scrollbar-track { background: transparent; }
.lm-summary-rail::-webkit-scrollbar-thumb {
  background: var(--bg-lighter);
  border-radius: 3px;
}
.lm-summary-rail::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* Collapse to single column on smaller viewports.
   Stack the rail below the body so it stays useful but
   doesn't crush the pick lists. */
@media (max-width: 900px) {
  .lm-modal-wide { max-width: 96%; }
  .lm-body-wrap { flex-direction: column; }
  .lm-summary-rail {
    width: auto;
    border-left: none;
    border-top: 1px solid var(--border-thin);
    max-height: 30vh;
  }
}

@media (max-width: 700px) {
  .lm-modal { max-width: 96%; }
  .lm-header h2 { font-size: 1em; }
  .lm-body { padding: 1em; }
  .lm-action-row { flex-direction: column; gap: 0.5em; }
  .lm-summary-rail { padding: 0.7em 0.9em; font-size: 0.85em; }
}
