/* ============================================================
   Digital Character Sheet — Styles
   ============================================================ */

/* --- Print layout -------------------------------------------------------- */
@media print {
  .no-print, .no-print * {
    display: none !important;
  }
  #character-app {
    padding: 0 !important;
    max-width: 100% !important;
  }
  .box {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    break-inside: avoid;
  }
  .button, .delete, .field.has-addons {
    display: none !important;
  }
  input.input, textarea.textarea {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding-left: 0 !important;
  }
  input[type="number"] {
    -moz-appearance: textfield;
  }
}

/* --- Attribute rows ------------------------------------------------------ */
.attr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.attr-row .attr-label {
  width: 180px;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}
.attr-row .attr-control {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}
.attr-row .attr-value {
  width: 64px;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.attr-value {
    -moz-appearance: textfield;
}

/* --- Editable list items ------------------------------------------------- */
.editable-list-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid #f0f0f0;
}
.editable-list-item:last-child {
  border-bottom: none;
}
.editable-list-item .item-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

/* --- Key-value rows (proficiencies, resource pools, class levels) -------- */
.kv-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  padding: 2px 0;
}
.kv-row .kv-key {
  flex: 1;
  font-weight: 500;
  min-width: 0;
}
.kv-row .kv-value {
  width: 50px;
  text-align: center;
  font-weight: 700;
}

/* --- Ability card (inline) ----------------------------------------------- */
.ability-card-edit {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fafafa;
  position: relative;
}
.ability-card-edit .ability-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  padding-right: 30px;
}
.ability-card-edit .ability-header .ability-name {
  flex: 1 1 180px;
  min-width: 120px;
}
.ability-card-edit .ability-header .ability-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ability-card-edit .ability-header .ability-meta .input {
  width: 100px;
}

/* --- Feat card (inline) -------------------------------------------------- */
.feat-card-edit {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fafafa;
  position: relative;
}
.feat-card-edit .feat-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding-right: 30px;
}
.feat-card-edit .feat-header .feat-name {
  flex: 1 1 200px;
  min-width: 120px;
}

/* --- Delete button on cards ---------------------------------------------- */
.card-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
}

/* --- Section boxes ------------------------------------------------------- */
#character-app .box {
  transition: box-shadow 0.15s ease;
}
#character-app .box:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

/* --- Bonus Cap ----------------------------------------------------- */
#prof-cap {
  font-weight: 700;
}

/* --- Toast --------------------------------------------------------------- */
#toast {
  animation: toastIn 0.3s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* --- Load-character modal ------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 1.0);
  animation: fadeIn 0.15s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.load-modal {
  width: 90%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
  background: #000;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.load-modal .modal-card-body {
  overflow-y: auto;
  flex: 1;
}

/* --- Picker modal (search & select abilities/feats) --------------------- */
.picker-modal {
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
  background:#111111
}

.picker-modal .modal-card-body {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.picker-list {
  flex: 1;
  overflow-y: auto;
  margin-top: 0.75rem;
}

.picker-item {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #e8e8e8;
  cursor: pointer;
  transition: background 0.1s ease;
}
.picker-item + .picker-item {
  margin-top: 6px;
}
.picker-item:hover {
  background: #f5f5f5;
  border-color: #d0d0d0;
}

.picker-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.picker-item-name {
  font-weight: 600;
  font-size: 1.05rem;
}

.picker-item-subtitle {
  margin-top: 4px;
  font-size: 0.85rem;
  color: #666;
  line-height: 1.4;
}

.character-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.character-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #e8e8e8;
  transition: background 0.1s ease;
}
.character-list-item:hover {
  background: #f5f5f5;
}

.character-list-name {
  font-weight: 600;
  font-size: 1.05rem;
}

/* --- Toolbar button icon/text alignment --------------------------------- */
.buttons .button .icon {
  vertical-align: middle;
}
.buttons .button > span:not(.icon) {
  vertical-align: middle;
  position: relative;
  top: 2px;
}

/* --- Dark-mode tweaks ---------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  .ability-card-edit,
  .feat-card-edit {
    background: #1a1a1a;
    border-color: #333;
  }
  .editable-list-item {
    border-bottom-color: #2a2a2a;
  }
  .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
  }
  .character-list-item {
    border-color: #333;
  }
  .character-list-item:hover {
    background: #222;
  }
  .picker-item {
    border-color: #333;
  }
  .picker-item:hover {
    background: #222;
    border-color: #555;
  }
  .picker-item-subtitle {
    color: #aaa;
  }
  .picker-item-requires {
    color: #cccccc;
    background-color: #1a1a1a;
  }
}
