/* Protech21 — حوارات وإشعارات موحّدة (أسود / أحمر، RTL، فاتح/داكن) */

.ptx-dialog-host,
.ptx-toast-host {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10050;
}

.ptx-toast-host {
  inset: auto 16px 18px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 10060;
}

.ptx-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ptx-dialog-root {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) 14px max(12px, env(safe-area-inset-bottom));
  pointer-events: auto;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.ptx-dialog-root.is-open {
  opacity: 1;
}

.ptx-dialog-root.is-closing {
  opacity: 0;
  pointer-events: none;
}

.ptx-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

html[data-theme="light"] .ptx-dialog-backdrop {
  background: rgb(15 15 18 / 0.48);
}

.ptx-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px 16px;
  padding: 20px 18px 16px;
  border-radius: 18px;
  border: 1px solid var(--line, #2e2e2e);
  background:
    linear-gradient(165deg, rgb(var(--accent-rgb, 225 6 0) / 0.1), transparent 42%),
    var(--panel-elev, #1c1c1c);
  box-shadow:
    0 24px 60px rgb(0 0 0 / 0.45),
    0 0 0 1px rgb(var(--accent-rgb, 225 6 0) / 0.12);
  color: var(--text, #f4f4f5);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.2s ease;
  outline: none;
}

.ptx-dialog-root.is-open .ptx-dialog {
  transform: translateY(0) scale(1);
}

.ptx-dialog-root.is-closing .ptx-dialog {
  transform: translateY(8px) scale(0.98);
}

.ptx-dialog-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgb(var(--accent-rgb, 225 6 0) / 0.92);
  box-shadow: 0 8px 18px rgb(var(--accent-rgb, 225 6 0) / 0.28);
}

.ptx-dialog-icon svg {
  width: 22px;
  height: 22px;
}

.ptx-dialog-root.tone-success .ptx-dialog-icon {
  background: var(--ok, #0f766e);
  box-shadow: 0 8px 18px rgb(15 118 110 / 0.28);
}

.ptx-dialog-root.tone-info .ptx-dialog-icon {
  background: #2563eb;
  box-shadow: 0 8px 18px rgb(37 99 235 / 0.25);
}

.ptx-dialog-root.tone-warn .ptx-dialog-icon {
  background: #b45309;
  box-shadow: 0 8px 18px rgb(180 83 9 / 0.28);
}

.ptx-dialog-root.tone-error .ptx-dialog-icon,
.ptx-dialog-root.tone-danger .ptx-dialog-icon {
  background: #e10600;
  box-shadow: 0 8px 18px rgb(225 6 0 / 0.32);
}

.ptx-dialog-content {
  min-width: 0;
  display: grid;
  gap: 10px;
}

.ptx-dialog-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.35;
  color: var(--text, #f4f4f5);
}

.ptx-dialog-body {
  display: grid;
  gap: 4px;
  color: var(--muted, #9a9a9a);
  font-size: 0.92rem;
  line-height: 1.55;
}

.ptx-dialog-body p {
  margin: 0;
}

.ptx-dialog-field {
  display: block;
  margin-top: 2px;
}

.ptx-dialog-input {
  width: 100%;
  box-sizing: border-box;
  border-radius: 12px;
  border: 1px solid var(--line, #2e2e2e);
  background: var(--input-bg, #121212);
  color: var(--text, #f4f4f5);
  padding: 11px 12px;
  font: inherit;
  outline: none;
}

.ptx-dialog-input:focus {
  border-color: rgb(var(--accent-rgb, 225 6 0) / 0.7);
  box-shadow: 0 0 0 3px rgb(var(--accent-rgb, 225 6 0) / 0.16);
}

.ptx-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.ptx-btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.ptx-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.ptx-btn-ghost {
  background: transparent;
  border-color: var(--line, #2e2e2e);
  color: var(--text-soft, #d4d4d8);
}

.ptx-btn-ghost:hover:not(:disabled) {
  border-color: rgb(var(--accent-rgb, 225 6 0) / 0.4);
  background: rgb(var(--accent-rgb, 225 6 0) / 0.06);
}

.ptx-btn-solid {
  color: #fff;
  background: var(--btn-bg, linear-gradient(180deg, #ff3a32 0%, #e10600 46%, #b80500 100%));
  border-color: #b80500;
  box-shadow: var(--btn-shadow, 0 8px 22px rgb(225 6 0 / 0.28));
}

.ptx-btn-solid:hover:not(:disabled) {
  filter: brightness(1.05);
}

.ptx-dialog-root.tone-danger .ptx-btn-solid {
  background: linear-gradient(180deg, #ff3a32 0%, #c40600 100%);
}

.ptx-dialog-root.tone-success .ptx-btn-solid {
  background: linear-gradient(180deg, #14b8a6 0%, #0f766e 100%);
  border-color: #0f766e;
  box-shadow: 0 8px 18px rgb(15 118 110 / 0.25);
}

.ptx-dialog-root.is-busy .ptx-dialog {
  cursor: progress;
}

.ptx-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line, #2e2e2e);
  background: var(--panel-elev, #1c1c1c);
  color: var(--text, #f4f4f5);
  box-shadow: 0 14px 36px rgb(0 0 0 / 0.35);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ptx-toast.is-show {
  opacity: 1;
  transform: translateY(0);
}

.ptx-toast-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  background: #e10600;
}

.ptx-toast-icon svg {
  width: 16px;
  height: 16px;
}

.ptx-toast.tone-success .ptx-toast-icon { background: var(--ok, #0f766e); }
.ptx-toast.tone-info .ptx-toast-icon { background: #2563eb; }
.ptx-toast.tone-warn .ptx-toast-icon { background: #b45309; }
.ptx-toast.tone-error .ptx-toast-icon,
.ptx-toast.tone-danger .ptx-toast-icon { background: #e10600; }

.ptx-toast-text {
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
}

@media (max-width: 520px) {
  .ptx-dialog {
    width: min(100%, calc(100vw - 20px));
    grid-template-columns: 1fr;
    justify-items: start;
    padding: 16px 14px 14px;
  }

  .ptx-dialog-actions {
    width: 100%;
  }

  .ptx-dialog-actions .ptx-btn {
    flex: 1 1 auto;
    text-align: center;
  }
}
