/**
 * LibZen Dialog — centered modal with header, scrollable body, and footer.
 * Uses host app CSS variables when present; includes dark-theme fallbacks.
 */

:root {
  --libzen-dg-surface: var(--surface, #1a2332);
  --libzen-dg-bg: var(--bg, #0f1419);
  --libzen-dg-text: var(--text, #e8edf4);
  --libzen-dg-muted: var(--text-muted, #8b9cb3);
  --libzen-dg-border: var(--border, #2d3a4f);
  --libzen-dg-accent: var(--accent, #3b82f6);
  --libzen-dg-accent-hover: var(--accent-dim, #2563eb);
  --libzen-dg-danger: var(--danger, #ef4444);
  --libzen-dg-radius: 12px;
  --libzen-dg-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.libzen-dg-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.55);
}

.libzen-dg-panel {
  display: flex;
  flex-direction: column;
  width: min(100%, 400px);
  max-height: min(90vh, 720px);
  background: var(--libzen-dg-surface);
  color: var(--libzen-dg-text);
  border: 1px solid var(--libzen-dg-border);
  border-radius: var(--libzen-dg-radius);
  box-shadow: var(--libzen-dg-shadow);
  overflow: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.libzen-dg-panel-wide {
  width: min(100%, 480px);
}

.libzen-dg-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding: 14px 16px;
  border-bottom: 1px solid var(--libzen-dg-border);
}

.libzen-dg-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.libzen-dg-close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: -6px -8px -6px 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--libzen-dg-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.libzen-dg-close:hover {
  color: var(--libzen-dg-text);
  background: rgba(255, 255, 255, 0.06);
}

.libzen-dg-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.libzen-dg-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--libzen-dg-border);
  background: color-mix(in srgb, var(--libzen-dg-bg) 40%, var(--libzen-dg-surface));
}

.libzen-dg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--libzen-dg-border);
  background: transparent;
  color: var(--libzen-dg-text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.libzen-dg-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
}

.libzen-dg-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.libzen-dg-btn-primary {
  border-color: var(--libzen-dg-accent);
  background: var(--libzen-dg-accent);
  color: #fff;
}

.libzen-dg-btn-primary:hover:not(:disabled) {
  background: var(--libzen-dg-accent-hover);
  border-color: var(--libzen-dg-accent-hover);
}

.libzen-dg-message {
  margin: 0;
  white-space: pre-wrap;
}

.libzen-dg-inline-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
