/* pbCommon.css - Extracted styles for pBCommon dialog/menu system */
/* Theme variables defined in pbCommon_[theme].css */

:root {
  /* Toast defaults - semantic colors, overridden by themes */
  --pbc-toast-text-info: #88ddff;
  --pbc-toast-text-success: #a8e6a8;
  --pbc-toast-text-warning: #f3dcff;
  --pbc-toast-text-danger: #ffb0b0;
  --pbc-toast-bg-info: #000;
  --pbc-toast-bg-success: rgba(20, 40, 20, 0.95);
  --pbc-toast-bg-warning: rgba(30, 20, 30, 0.95);
  --pbc-toast-bg-danger: rgba(40, 15, 15, 0.95);
  --pbc-toast-icon-bg-info: #0088bb;
  --pbc-toast-icon-bg-success: #007744;
  --pbc-toast-icon-bg-warning: #e8a000;
  --pbc-toast-icon-bg-danger: #c00;
  --pbc-toast-icon-fg: #fff;
}

/* ===== OVERLAY ===== */
.pbc-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--pbc-overlay-bg);
  z-index: 999998;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== DIALOG CONTAINER ===== */
.pbc-dialog {
  background-color: var(--pbc-dialog-bg);
  color: var(--pbc-dialog-fg);
  border: 2px solid var(--pbc-dialog-border);
  border-radius: 6px;
  width: 500px;
  max-width: 90vw;
  box-shadow: var(--pbc-dialog-shadow);
  font-family: Segoe UI, sans-serif;
  overflow: hidden;
}

.pbc-dialog-lg {
  width: 50vw;
  height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  font-size: 16px;
}

/* ===== DIALOG HEADER ===== */
.pbc-dialog-header {
  background: var(--pbc-header-bg);
  padding: 10px 15px;
  font-weight: bold;
  font-size: 18px;
  border-bottom: 1px solid var(--pbc-header-border);
  margin-bottom: 5px;
}

.pbc-dialog-header-full {
  width: 100%;
  text-align: left;
  margin-bottom: 10px;
}

/* ===== DIALOG BODY ===== */
.pbc-dialog-body {
  padding: 20px 15px;
  font-size: 16px;
}

/* ===== DIALOG DIVIDER ===== */
.pbc-dialog-hr {
  border: none;
  border-top: 1px solid var(--pbc-divider);
  margin: 0 15px;
}

/* ===== DIALOG FOOTER / BUTTON BAR ===== */
.pbc-dialog-footer {
  padding: 10px 15px;
  margin-top: 10px;
  margin-bottom: 5px;
  text-align: right;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== BUTTONS ===== */
.pbc-btn {
  /* Inherits from existing btn_solid if present, or standalone */
}

.pbc-btn + .pbc-btn {
  margin-left: 8px;
}

/* ===== PROMPT INPUT ===== */
.pbc-prompt-input-wrap {
  padding: 0 15px;
}

.pbc-prompt-input {
  width: 100%;
  padding: 8px;
  font-size: 16px;
  border: 1px solid var(--pbc-input-border);
  background: var(--pbc-input-bg);
  color: var(--pbc-dialog-fg);
  box-sizing: border-box;
}

.pbc-prompt-input-maxed {
  border-color: var(--pbc-input-error);
}

/* ===== SPINNER / PROGRESS ===== */
.pbc-progress-indicator {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 999999999;  /* near max */
}

.spinner {
  width: 175px;
  height: 175px;
  border-radius: 50%;
  border: 2px solid var(--pbc-spinner-border);
  box-shadow: 0 0 0 2px var(--pbc-spinner-shadow);
  margin: 0 auto;
  background: conic-gradient( rgba(0, 0, 255, 0) 0%, rgba(128, 128, 255, 0.2) 16.6%, rgba(102, 153, 255, 0.4) 33.2%, rgba(77, 179, 255, 0.6) 49.8%, rgba(51, 204, 255, 0.8) 66.4%, rgba(204, 234, 255, 1) 83%, rgba(255, 255, 255, 1) 100% );
  mask: radial-gradient(circle, transparent 60%, black 40%);
  -webkit-mask: radial-gradient(circle, transparent 60%, black 40%);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.pbc-processing-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 10px 20px 20px;
}

.pbc-processing-container .spinner {
  margin: auto;
}

.pbc-processing-message {
  text-align: center;
}

/* ===== TOAST NOTIFICATIONS ===== */
.pbc-toast-container {
  position: fixed;
  bottom: 10px;
  right: 10px;
  z-index: 999995;
}

.pbc-toast {
  padding: 15px;
  margin-bottom: 10px;
  width: 400px;
  font-size: 1.1rem;
  font-weight: bold;
  line-height: 1.4;
  color: var(--pbc-dialog-fg);
  background-color: var(--pbc-dialog-bg);
  border: 2px solid var(--pbc-dialog-border);
  border-radius: 8px;
  box-shadow: 0 2px 8px var(--pbc-overlay-bg);
  overflow-wrap: break-word;
  position: absolute;
  right: 10px;
  opacity: 0;
  transition: opacity 0.3s;
}

.pbc-toast-icon {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  margin-right: 10px;
  background-color: var(--pbc-hover-bg);
  color: var(--pbc-dialog-fg);
  font-weight: bold;
  font-size: 14px;
  font-family: sans-serif;
}

/* Toast level variants */
.pbc-toast-info {
  color: var(--pbc-toast-text-info);
  background-color: var(--pbc-toast-bg-info);
}

.pbc-toast-info .pbc-toast-icon {
  background-color: var(--pbc-toast-icon-bg-info);
  color: var(--pbc-toast-icon-fg);
}

.pbc-toast-success {
  color: var(--pbc-toast-text-success);
  background-color: var(--pbc-toast-bg-success);
}

.pbc-toast-success .pbc-toast-icon {
  background-color: var(--pbc-toast-icon-bg-success);
  color: var(--pbc-toast-icon-fg);
}

.pbc-toast-warning {
  color: var(--pbc-toast-text-warning);
  background-color: var(--pbc-toast-bg-warning);
}

.pbc-toast-warning .pbc-toast-icon {
  background-color: var(--pbc-toast-icon-bg-warning);
  color: var(--pbc-toast-icon-fg);
}

.pbc-toast-danger {
  color: var(--pbc-toast-text-danger);
  background-color: var(--pbc-toast-bg-danger);
}

.pbc-toast-danger .pbc-toast-icon {
  background-color: var(--pbc-toast-icon-bg-danger);
  color: var(--pbc-toast-icon-fg);
}

/* ===== DROPDOWN MENU ===== */
.pbc-menu {
  position: absolute;
  background-color: var(--pbc-dialog-bg);
  color: var(--pbc-dialog-fg);
  border: 2px solid var(--pbc-dialog-border);
  border-radius: 6px;
  box-shadow: var(--pbc-dialog-shadow);
  font-size: 16px;
  font-family: Segoe UI, sans-serif;
  min-width: 180px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 99999;
}

.pbc-menu:focus {
  outline: none;
}

.pbc-menu-item {
  padding: 10px 15px;
  cursor: pointer;
  user-select: none;
}

.pbc-menu-item:hover,
.pbc-menu-item-highlight {
  background-color: var(--pbc-hover-bg);
}

.pbc-menu-item-disabled {
  color: var(--pbc-muted);
  cursor: default;
}

.pbc-menu-item-disabled:hover {
  background-color: transparent;
}

.pbc-menu-divider {
  height: 1px;
  background-color: var(--pbc-divider);
  margin: 4px 0;
}

/* ===== CUSTOM DIALOG WRAPPER (dlg) ===== */
.pbc-dlg-overlay {
  /* Inherits from .pbc-overlay, add specifics here if needed */
}

.pbc-dlg-wrapper {
  position: fixed;
  background-color: var(--pbc-dialog-bg);
  color: var(--pbc-dialog-fg);
  border: 2px solid var(--pbc-dialog-border);
  border-radius: 6px;
  box-shadow: var(--pbc-dialog-shadow);
  font-family: Segoe UI, sans-serif;
  min-width: 200px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pbc-dlg-titlebar {
  background: var(--pbc-header-bg);
  padding: 0;
  font-weight: bold;
  font-size: 16px;
  border-bottom: 1px solid var(--pbc-header-border);
  cursor: grab;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  flex-shrink: 0;
}

.pbc-dlg-title {
  flex: 1;
  margin: 8px 12px;
}

.pbc-dlg-close {
  background: var(--pbc-close-bg, rgba(0, 0, 0, 0.1));
  border: none;
  border-left: 1px solid var(--pbc-header-border);
  color: var(--pbc-close-fg);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  margin: 0;
}

.pbc-dlg-close:hover {
  color: var(--pbc-close-hover);
  background: var(--pbc-close-bg-hover);
}

.pbc-dlg-content {
  flex: 1;
  overflow: auto;
  padding: 20px;
}

.pbc-dlg-buttonbar {
  padding: 10px 12px;
  text-align: right;
  border-top: 1px solid var(--pbc-divider);
  flex-shrink: 0;
}

.pbc-dlg-buttonbar button + button {
  margin-left: 8px;
}

.pbc-dlg-btn-primary {
  /* Optional: style for primary button if distinct from btn_solid */
}

/* Resize handles */
.pbc-dlg-resize {
  position: absolute;
  background: transparent;
}

.pbc-dlg-resize-n {
  top: 0; left: 8px; right: 8px; height: 6px;
  cursor: n-resize;
}

.pbc-dlg-resize-s {
  bottom: 0; left: 8px; right: 8px; height: 6px;
  cursor: s-resize;
}

.pbc-dlg-resize-e {
  right: 0; top: 8px; bottom: 8px; width: 6px;
  cursor: e-resize;
}

.pbc-dlg-resize-w {
  left: 0; top: 8px; bottom: 8px; width: 6px;
  cursor: w-resize;
}

.pbc-dlg-resize-ne {
  top: 0; right: 0; width: 12px; height: 12px;
  cursor: ne-resize;
}

.pbc-dlg-resize-se {
  bottom: 0; right: 0; width: 12px; height: 12px;
  cursor: se-resize;
}

.pbc-dlg-resize-sw {
  bottom: 0; left: 0; width: 12px; height: 12px;
  cursor: sw-resize;
}

.pbc-dlg-resize-nw {
  top: 0; left: 0; width: 12px; height: 12px;
  cursor: nw-resize;
}

/* ===== DIALOG FIELDSET/LEGEND ===== */
.pbc-dlg-wrapper fieldset {
  border: 2px solid var(--pbc-fieldset-border, black);
  background-color: var(--pbc-fieldset-bg, transparent);
  padding: 0.75rem 1rem 1rem 1rem;
}

.pbc-dlg-wrapper fieldset legend {
  border: 2px solid var(--pbc-legend-border, black);
  background-color: var(--pbc-legend-bg, transparent);
  padding: 0.2rem 0.5rem;
  font-size: 1.5rem;
  margin-left: 0.5rem;
}