/*
  Tool-spezifisches Stylesheet für den Initiative-Tracker.
  Ablage: /tools/initiative-tracker/style.css
  Setzt tokens.css + shared.css voraus (Farben, Schrift, Radius, Buttons, Inputs).
*/

:root{
  /* Semantische Farben, die nur dieses Tool nutzt */
  --hero: #4caf6d;
  --hero-bg: rgba(76,175,109,0.10);
  --monster: #d9685f;
  --monster-bg: rgba(217,104,95,0.10);
  --hp-good: #4caf6d;
  --hp-mid: #d9a13e;
  --hp-low: #d9685f;
  --hp-track: #3d4250;
  --ac: #4eb4e8;
  --ac-bg: rgba(78,180,232,0.14);

  /* Init-Badges bleiben bewusst gold, unabhängig von --accent (tokens.css) */
  --init-gold: #c9a24c;
  --init-gold-text: #1a1508;
}

#listHead{
  display:grid;
  grid-template-columns: 28px 64px 40px 1fr 64px 68px 100px 32px;
  gap: 10px;
  padding: 0 12px 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

#list{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row{
  display:grid;
  grid-template-columns: 28px 64px 40px 1fr 64px 68px 100px 32px;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.row.hero{ border-left-color: var(--hero); background: linear-gradient(90deg, var(--hero-bg), var(--surface) 18%); }
.row.monster{ border-left-color: var(--monster); background: linear-gradient(90deg, var(--monster-bg), var(--surface) 18%); }
.row.dragging{ opacity: 0.4; }
.row.down .rowname{ text-decoration: line-through; color: var(--text-muted); }
.row.down,
.row.hero.down,
.row.monster.down{
  background: var(--bg);
}

.drag-handle{
  cursor: grab;
  color: var(--text-muted);
  display:flex;
  align-items:center;
  justify-content:center;
  height: 100%;
  user-select: none;
  touch-action: none;
}
.drag-handle:active{ cursor: grabbing; }

.init-badge{
  position: relative;
  width: 52px;
  height: 46px;
  display:flex;
  align-items:center;
  justify-content:center;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: var(--init-gold);
}
.init-badge.down{
  background: var(--text-muted);
}
.init-badge::before{
  content: "";
  position: absolute;
  inset: 2px;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  background: var(--surface-2);
  z-index: 0;
}
.init-badge input{
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  text-align:center;
  background: transparent;
  border: none;
  color: var(--init-gold);
  font-weight: 700;
  font-size: 0.95rem;
  -moz-appearance: textfield;
}
.init-badge.down input{
  color: var(--text-muted);
}
.init-badge input::-webkit-outer-spin-button,
.init-badge input::-webkit-inner-spin-button{ -webkit-appearance:none; margin:0; }
.init-badge input:focus{ outline: none; }

.toggle{
  position: relative;
  width: 40px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--monster-bg);
  border: 1px solid var(--monster);
  cursor: pointer;
  flex-shrink: 0;
}
.toggle.on{
  background: var(--hero-bg);
  border-color: var(--hero);
}
.toggle .knob{
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--monster);
  transition: left 0.15s ease, background 0.15s ease;
  display:flex;
  align-items:center;
  justify-content:center;
}
.toggle.on .knob{
  left: 18px;
  background: var(--hero);
}
.toggle svg{ width: 11px; height: 11px; fill: var(--surface); }
.toggle input{ display:none; }

.hp-cell{
  display:flex;
  flex-direction: column;
  gap: 4px;
}
.hp-inputs{
  display:flex;
  align-items:center;
  gap: 3px;
  font-size: 0.82rem;
}
.hp-inputs .field-num{ padding: 6px 4px; font-size: 0.85rem; }
.hp-sep{ color: var(--text-muted); }
.hp-bar{
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--hp-track);
  overflow: hidden;
}
.hp-bar-fill{
  height: 100%;
  background: var(--hp-good);
  transition: width 0.15s ease, background 0.15s ease;
}

.ac-cell label, .hp-cell label{ display: none; }

.ac-cell{
  display:flex;
  align-items:center;
  justify-content:center;
}
.ac-cell .field-num{
  width: 42px;
  height: 40px;
  padding: 0;
  background: var(--ac-bg);
  border: 2px solid var(--ac);
  border-radius: 4px 4px 22px 22px;
  color: var(--ac);
  font-weight: 700;
  box-shadow: 0 0 6px rgba(78,180,232,0.35);
}
.ac-cell .field-num:focus{
  outline: none;
  border-color: var(--ac);
  box-shadow: 0 0 10px rgba(78,180,232,0.55);
}
.ac-cell .field-num::placeholder{ color: rgba(78,180,232,0.55); }

.del-row{
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  padding: 4px;
  line-height: 1;
  border-radius: var(--radius-sm);
}
.del-row:hover{ color: var(--danger); background: rgba(179,71,71,0.12); border-color: transparent; }

@media (max-width: 720px){
  #listHead{ display:none; }
  .row{
    grid-template-columns: 24px 52px 34px 1fr 32px;
    grid-template-areas:
      "handle init toggle name del"
      "handle ac ac maxhp curhp";
    row-gap: 8px;
  }
  .row > .drag-handle{ grid-area: handle; }
  .row > .init-badge{ grid-area: init; width: 44px; height: 40px; }
  .row > .toggle{ grid-area: toggle; }
  .row > .name-cell{ grid-area: name; }
  .row > .del-row{ grid-area: del; }
  .row > .ac-cell{ grid-area: ac; display:flex; align-items:center; justify-content:flex-start; gap:6px; }
  .row > .hp-cell{ grid-area: curhp; }
  .ac-cell label, .hp-cell label{
    display: block;
    font-size: 0.68rem; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.05em;
  }
}