/* ── ConfirmDialog: themed replacements for native confirm/alert/prompt ── */

.cd-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: cd-fade-in 0.15s ease-out;
}

.cd-overlay.cd-closing {
  animation: cd-fade-out 0.12s ease-in forwards;
}

.cd-modal {
  width: min(400px, calc(100vw - 32px));
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: cd-scale-in 0.15s ease-out;
}

.cd-closing .cd-modal {
  animation: cd-scale-out 0.12s ease-in forwards;
}

.cd-message {
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
  white-space: pre-line;
}

.cd-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md, 8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.cd-input:focus {
  border-color: rgba(99, 102, 241, 0.6);
}

.cd-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.cd-btn {
  padding: 8px 18px;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid transparent;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.cd-btn:active {
  transform: scale(0.97);
}

.cd-btn:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.6);
  outline-offset: 2px;
}

.cd-btn-cancel {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.7);
}

.cd-btn-cancel:hover {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.9);
}

.cd-btn-confirm {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.4);
  color: #A5B4FC;
}

.cd-btn-confirm:hover {
  background: rgba(99, 102, 241, 0.35);
  border-color: rgba(99, 102, 241, 0.55);
}

.cd-btn-danger {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.35);
  color: #FCA5A5;
}

.cd-btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: rgba(239, 68, 68, 0.5);
}

/* ── Animations ── */

@keyframes cd-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes cd-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes cd-scale-in {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

@keyframes cd-scale-out {
  from { transform: scale(1);    opacity: 1; }
  to   { transform: scale(0.92); opacity: 0; }
}

/* ── Mobile: bottom sheet ── */

@media (max-width: 480px) {
  .cd-overlay {
    align-items: flex-end;
  }

  .cd-modal {
    width: 100%;
    border-radius: var(--radius-lg, 16px) var(--radius-lg, 16px) 0 0;
    padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px)) 20px;
    animation: cd-slide-up 0.2s ease-out;
  }

  .cd-closing .cd-modal {
    animation: cd-slide-down 0.15s ease-in forwards;
  }

  @keyframes cd-slide-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  @keyframes cd-slide-down {
    from { transform: translateY(0); }
    to   { transform: translateY(100%); }
  }
}
