/* DM Dashboard — Dark Theme
   Colors extracted from dm_dashboard_mock.html */

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 14px -apple-system, system-ui, sans-serif;
  background: #1a1614;
  color: #e8e4dc;
  height: 100vh;
  overflow: hidden;
}

/* --- Three-column layout --- */
.app {
  display: grid;
  grid-template-columns: 180px 1fr 320px;
  height: 100vh;
}

.col {
  border-right: 1px solid #3a332d;
  overflow-y: auto;
  padding: 12px;
}

.col:last-child {
  border-right: none;
}

/* --- Typography --- */
h1 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #8a7f70;
  margin: 0 0 8px;
  font-weight: 600;
}

h2 {
  font-size: 16px;
  margin: 0 0 2px;
  color: #f4e4c1;
}

.sub {
  color: #8a7f70;
  font-size: 12px;
  margin-bottom: 12px;
}

/* --- Roster (left column) --- */
.roster button {
  display: block;
  width: 100%;
  text-align: left;
  background: #2a241f;
  border: 1px solid #3a332d;
  color: #e8e4dc;
  padding: 10px;
  margin-bottom: 6px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
}

.roster button:hover {
  background: #3a2a1a;
}

.roster button.active {
  background: #5c3a1f;
  border-color: #8a5a2f;
}

.roster button .char-class {
  color: #8a7f70;
  font-size: 11px;
  display: block;
  margin-top: 2px;
}

.roster .combat-ref-btn {
  margin-top: auto;
  background: #2a241f;
  border: 1px solid #3a332d;
  color: #c9a876;
  padding: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

.roster .combat-ref-btn:hover {
  background: #3a2a1a;
  border-color: #c9a876;
}

/* --- Ability Scores grid --- */
.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.stat {
  background: #2a241f;
  border: 1px solid #3a332d;
  border-radius: 4px;
  padding: 6px;
  text-align: center;
  cursor: default;
}

.stat .lbl {
  font-size: 9px;
  color: #8a7f70;
  text-transform: uppercase;
}

.stat .val {
  font-size: 18px;
  font-weight: 600;
  color: #f4e4c1;
}

.stat .mod {
  font-size: 11px;
  color: #c9a876;
}

/* --- Combat stats row --- */
.row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.box {
  background: #2a241f;
  border: 1px solid #3a332d;
  border-radius: 4px;
  padding: 8px;
}

.box .lbl {
  font-size: 9px;
  color: #8a7f70;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.box .big {
  font-size: 16px;
  font-weight: 600;
  color: #f4e4c1;
}

/* --- Turn summary --- */
.turn {
  background: #3a2a1a;
  border-left: 3px solid #c9a876;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 3px;
  font-size: 13px;
  line-height: 1.5;
}

.turn b {
  color: #f4e4c1;
}

/* --- Chips (features, spells) --- */
.chip {
  display: inline-block;
  background: #2a241f;
  border: 1px solid #3a332d;
  padding: 5px 9px;
  margin: 2px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 12px;
}

.chip:hover {
  background: #3a2a1a;
  border-color: #c9a876;
}

.chip.slot {
  font-size: 9px;
  color: #8a7f70;
  margin-left: 4px;
  cursor: default;
}

.chip.domain {
  background: #4a3a2a;
  color: #c9a876;
  border-color: #6a5030;
}

.chip.domain:hover {
  background: #5a4a3a;
  border-color: #c9a876;
}

.chip.spellbook {
  background: #2a241f;
  border-color: #3a332d;
}

/* .chip.available removed — pips now handle resource tracking (P5) */

/* --- Spell level headers --- */
.spell-lvl {
  font-size: 10px;
  color: #8a7f70;
  text-transform: uppercase;
  margin: 10px 0 4px;
  border-bottom: 1px solid #3a332d;
  padding-bottom: 2px;
}

/* --- Attacks --- */
.atk {
  background: #2a241f;
  padding: 6px 8px;
  border-radius: 3px;
  margin-bottom: 4px;
  font-size: 12px;
  cursor: pointer;
}

.atk:hover {
  background: #3a2a1a;
}

.atk b {
  color: #f4e4c1;
}

/* --- Saving throws --- */
.save-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.save-item {
  background: #2a241f;
  border: 1px solid #3a332d;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: default;
  white-space: nowrap;
}

.save-item.save-prof {
  color: #c9a876;
  border-color: #6a5030;
  font-weight: 600;
}

/* --- Skills --- */
.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 10px;
}

.skill-item {
  background: #2a241f;
  border: 1px solid #3a332d;
  border-radius: 3px;
  padding: 3px 7px;
  font-size: 11px;
  cursor: default;
  white-space: nowrap;
}

.skill-item.skill-prof {
  color: #c9a876;
  border-color: #6a5030;
}

.skill-item.skill-expert {
  color: #f4e4c1;
  border-color: #c9a876;
  font-weight: 600;
}

/* --- Resource trackers (P5) --- */
.resource-section {
  margin-bottom: 12px;
  padding: 8px;
  background: #2a241f;
  border: 1px solid #3a332d;
  border-radius: 4px;
}

.resource-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.resource-row + .resource-row {
  border-top: 1px solid #3a332d;
}

.resource-label {
  font-size: 11px;
  color: #c9a876;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.resource-pips {
  display: inline-flex;
  gap: 3px;
}

/* --- Pips (resource and spell slot trackers, P5) --- */
.pip {
  display: inline-block;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
}

.pip.available {
  color: #c9a876;
}

.pip.used {
  color: #3a332d;
}

.pip:hover {
  transform: scale(1.2);
}

.slot-pips {
  display: inline-flex;
  gap: 2px;
  margin-left: 4px;
}

.slot-pips .pip {
  font-size: 12px;
}

/* --- Name editable (P5) --- */
.name-editable {
  cursor: text;
  border-bottom: 1px dashed #3a332d;
  outline: none;
  transition: border-color 0.2s;
}

.name-editable:hover {
  border-bottom-color: #c9a876;
}

.name-editable:focus {
  border-bottom-color: #c9a876;
  border-bottom-style: solid;
}

/* --- Prepared spell counter (P5) --- */
.prep-counter {
  font-size: 11px;
  color: #8a7f70;
  margin-bottom: 8px;
  padding: 4px 8px;
  background: #2a241f;
  border-radius: 3px;
  border: 1px solid #3a332d;
}

/* --- Change Prepared button (P5) --- */
.prep-btn {
  font-size: 9px;
  color: #c9a876;
  background: #2a241f;
  border: 1px solid #3a332d;
  border-radius: 3px;
  padding: 2px 6px;
  cursor: pointer;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  font-family: inherit;
}

.prep-btn:hover {
  background: #3a2a1a;
  border-color: #c9a876;
}

/* --- Browse All Wizard Spells button (P5) --- */
.browse-btn {
  display: block;
  width: 100%;
  font-size: 10px;
  color: #c9a876;
  background: #2a241f;
  border: 1px solid #3a332d;
  border-radius: 3px;
  padding: 6px 10px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-family: inherit;
  margin-bottom: 8px;
}

.browse-btn:hover {
  background: #3a2a1a;
  border-color: #c9a876;
}

/* --- Preparation panel (P5) --- */
.prep-panel,
.browse-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.prep-panel.open {
  max-height: 600px;
  overflow-y: auto;
}

.browse-panel.open {
  max-height: 2000px;
  overflow-y: auto;
}

.prep-panel-inner,
.browse-panel-inner {
  background: #1a1614;
  border: 1px solid #6a5030;
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 8px;
}

.prep-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #3a332d;
}

.prep-panel-count {
  font-size: 11px;
  color: #8a7f70;
}

.prep-done-btn {
  font-size: 9px;
  color: #c9a876;
  background: #2a241f;
  border: 1px solid #3a332d;
  border-radius: 3px;
  padding: 2px 8px;
  cursor: pointer;
  text-transform: uppercase;
  font-family: inherit;
}

.prep-done-btn:hover {
  background: #3a2a1a;
  border-color: #c9a876;
}

/* --- Spell rows in prep panel (P5) --- */
.prep-spell-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  font-size: 12px;
  border-radius: 3px;
  cursor: default;
}

.prep-spell-row:hover {
  background: #2a241f;
}

.prep-spell-row input[type="checkbox"] {
  accent-color: #c9a876;
  cursor: pointer;
}

.prep-spell-name {
  cursor: pointer;
  color: #e8e4dc;
}

.prep-spell-name:hover {
  color: #c9a876;
  text-decoration: underline;
}

.prep-domain {
  opacity: 0.7;
}

.prep-domain-tag {
  font-size: 9px;
  color: #c9a876;
}

.prep-conc-tag {
  font-size: 9px;
  color: #8a7f70;
  background: #2a241f;
  border: 1px solid #3a332d;
  border-radius: 2px;
  padding: 0 3px;
}

.prep-ritual-tag {
  font-size: 9px;
  color: #8a7f70;
  background: #2a241f;
  border: 1px solid #3a332d;
  border-radius: 2px;
  padding: 0 3px;
}

/* --- Browse panel rows (P5) --- */
.browse-level-header {
  font-size: 10px;
  color: #c9a876;
  text-transform: uppercase;
  margin: 8px 0 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid #3a332d;
}

.browse-spell-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  font-size: 12px;
  border-radius: 3px;
}

.browse-spell-row:hover {
  background: #2a241f;
}

.browse-spell-row.in-spellbook {
  opacity: 0.7;
}

.browse-spell-name {
  cursor: pointer;
  color: #e8e4dc;
}

.browse-spell-name:hover {
  color: #c9a876;
  text-decoration: underline;
}

.in-book-tag {
  font-size: 9px;
  color: #6a5030;
  margin-left: auto;
}

.add-to-book-btn {
  font-size: 9px;
  color: #c9a876;
  background: #2a241f;
  border: 1px solid #3a332d;
  border-radius: 3px;
  padding: 1px 6px;
  cursor: pointer;
  margin-left: auto;
  font-family: inherit;
}

.add-to-book-btn:hover {
  background: #3a2a1a;
  border-color: #c9a876;
}

/* --- Feature cards (for barbarian right column) --- */
.feature-card {
  background: #2a241f;
  border: 1px solid #3a332d;
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 12px;
}

.feature-card:hover {
  background: #3a2a1a;
  border-color: #c9a876;
}

.feature-card .fc-name {
  color: #f4e4c1;
  font-weight: 600;
  margin-bottom: 2px;
}

.feature-card .fc-brief {
  color: #8a7f70;
  font-size: 11px;
  line-height: 1.4;
}

/* --- Tooltip --- */
.tooltip {
  position: fixed;
  background: #2a241f;
  border: 1px solid #8a5a2f;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.4;
  color: #e8e4dc;
  max-width: 300px;
  pointer-events: none;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.tooltip.show {
  display: block;
}

/* --- Modal --- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  z-index: 900;
}

.modal.show {
  display: flex;
}

.modal-box {
  background: #1a1614;
  border: 1px solid #8a5a2f;
  border-radius: 6px;
  max-width: 600px;
  width: 100%;
  padding: 20px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h3 {
  margin: 0 0 10px;
  color: #c9a876;
}

.modal p {
  line-height: 1.6;
  white-space: pre-wrap;
}

.modal .spell-meta {
  color: #8a7f70;
  font-size: 12px;
  margin-bottom: 10px;
  line-height: 1.6;
}

.modal .spell-meta b {
  color: #c9a876;
}

.modal .source-line {
  color: #8a7f70;
  font-size: 11px;
  margin-bottom: 8px;
}

.modal .at-higher-levels {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #3a332d;
  font-style: italic;
  color: #8a7f70;
}

/* --- Combat reference modal sections --- */
.combat-section {
  margin-bottom: 16px;
}

.combat-section h4 {
  color: #c9a876;
  margin: 0 0 6px;
  font-size: 13px;
}

.combat-section p {
  line-height: 1.6;
  white-space: pre-wrap;
}

.combat-section .item-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.combat-section .item-list li {
  padding: 4px 0;
  border-bottom: 1px solid #3a332d;
  font-size: 13px;
  line-height: 1.5;
}

.combat-section .item-list li:last-child {
  border-bottom: none;
}

.combat-section .item-list b {
  color: #f4e4c1;
}

/* --- Right column header --- */
.right-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #8a7f70;
  margin: 0 0 8px;
  font-weight: 600;
}

/* --- Spell footer note --- */
.spell-footer {
  margin-top: 12px;
  font-size: 10px;
  color: #8a7f70;
}

/* --- Rogue abilities section --- */
.rogue-abilities {
  margin-top: 16px;
  padding-top: 10px;
  border-top: 1px solid #3a332d;
}

/* --- Roster flex column --- */
.roster {
  display: flex;
  flex-direction: column;
}

.roster .roster-chars {
  flex: 1;
}

/* Scrollbar styling for dark theme */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #1a1614;
}

::-webkit-scrollbar-thumb {
  background: #3a332d;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #5c3a1f;
}
