/**
 * dialog.css
 * ----------------------------------------------------------------------
 * Styles for the general-purpose Dialog module (dialog.js). Relies on
 * core.css being loaded first for design tokens (--bg,
 * --accent, --cyan, etc.) and the .panel / .panel-header classes.
 * ----------------------------------------------------------------------
 */

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(9, 6, 13, 0.72);
  backdrop-filter: blur(3px);
  padding: 20px;
}

.dialog-box {
  width: 100%;
  max-width: 380px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  animation: dialog-in 0.14s ease;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dialog-header h2 {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  color: #fff;
}

.dialog-body {
  padding: 18px 18px 4px;
}

.dialog-text {
  margin: 0 0 14px;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
}

.dialog-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 6px;
}

.dialog-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dialog-field-label {
  font-family: var(--font-data);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.dialog-input {
  width: 100%;
  font-family: var(--font-data);
  font-size: 14px;
  color: var(--text);
  background: var(--panel-bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 10px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dialog-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan);
}

/* Dropdown trigger inside a dialog. The base trigger styling in
   character-sheet.css is scoped to .meta-field (the sheet's meta strip),
   so give it the same look as .dialog-input here. */
.dialog-field .meta-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 9px 10px;
  font-family: var(--font-data);
  font-size: 14px;
  color: var(--text);
  background: var(--panel-bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dialog-field .meta-select:hover,
.dialog-field .meta-select:focus,
.dialog-field .meta-select[aria-expanded='true'] {
  border-color: var(--cyan);
  outline: none;
}

.dialog-field .meta-select:focus {
  box-shadow: 0 0 0 1px var(--cyan);
}

/* A disabled dropdown stays drawn, dimmed and inert. */
.dialog-field .meta-select.is-disabled,
.dialog-field .meta-select.is-disabled:hover {
  cursor: not-allowed;
  opacity: 0.5;
  border-color: var(--border);
}

/* Tick box with its label beside it (field type 'checkbox'). */
.dialog-field.dialog-check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.dialog-check-label {
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--text);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px 18px;
}

.dialog-btn {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: var(--radius);
  padding: 9px 18px;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.dialog-btn-cancel {
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border);
}

.dialog-btn-cancel:hover {
  border-color: var(--text-dim);
  color: var(--text);
}

.dialog-btn-ok {
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
}

.dialog-btn-ok:hover {
  background: var(--accent-dim);
  box-shadow: 0 0 16px var(--accent-glow);
}

.dialog-btn:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .dialog-box {
    animation: none;
  }
}