/* =========================================================
   DCAK Custom Dialog System
   Replaces browser confirm(), alert(), prompt()
   Uses each portal's existing CSS variables for auto-theming
   ========================================================= */

/* Backdrop overlay */
.dcak-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(46, 42, 38, .55);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity .2s ease;
}
.dcak-backdrop.dcak-show {
  opacity: 1;
}

/* Dialog card */
.dcak-dialog {
  background: var(--color-surface-elevated, #fff);
  border-radius: 20px;
  box-shadow: 0 20px 60px -16px rgba(0, 0, 0, .25);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  z-index: 1;
  transform: scale(.92);
  transition: transform .2s ease;
}
.dcak-backdrop.dcak-show .dcak-dialog {
  transform: scale(1);
}

/* Dialog body */
.dcak-body {
  padding: 28px 28px 0;
}

/* Icon */
.dcak-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.dcak-icon.dcak-icon-info {
  background: var(--color-primary-soft, #FDF3E0);
}
.dcak-icon.dcak-icon-info svg {
  stroke: var(--color-primary, #C99A45);
}
.dcak-icon.dcak-icon-danger {
  background: var(--danger-light, #FFF5F5);
}
.dcak-icon.dcak-icon-danger svg {
  stroke: var(--danger, #B03A3A);
}

/* Title */
.dcak-title {
  font-family: 'Nunito', sans-serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--color-text-primary, #111827);
  margin: 0 0 8px;
}

/* Message */
.dcak-msg {
  font-family: 'Nunito', sans-serif;
  font-size: .92rem;
  color: var(--color-text-secondary, #4B5563);
  line-height: 1.55;
  margin: 0 0 4px;
}

/* Prompt input */
.dcak-input {
  width: 100%;
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--color-border, #E7DDCB);
  border-radius: 12px;
  background: var(--color-input-background, #F3EFE8);
  color: var(--color-text-primary, #111827);
  font-family: 'Nunito', sans-serif;
  font-size: .92rem;
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
}
.dcak-input:focus {
  border-color: var(--color-primary, #C99A45);
  background: var(--color-surface-elevated, #fff);
}

/* Button row */
.dcak-actions {
  display: flex;
  gap: 10px;
  padding: 20px 28px 24px;
}

/* Base button */
.dcak-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: .88rem;
  border: none;
  cursor: pointer;
  transition: background .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.dcak-btn:active {
  transform: scale(.97);
}

/* Cancel / ghost button */
.dcak-btn-cancel {
  background: transparent;
  color: var(--color-text-primary, #111827);
  border: 1px solid var(--color-border, #E7DDCB);
}
.dcak-btn-cancel:hover {
  background: var(--color-hover, #FBF8F2);
}

/* OK / primary button */
.dcak-btn-ok {
  background: var(--color-primary, #C99A45);
  color: #fff;
}
.dcak-btn-ok:hover {
  background: var(--color-primary-hover, #A37A2E);
}

/* Danger variant (for destructive confirms) */
.dcak-btn-danger {
  background: var(--danger, #B03A3A);
  color: #fff;
}
.dcak-btn-danger:hover {
  background: var(--danger-dark, #8F2A2A);
}

/* Single button (alert only) */
.dcak-actions.dcak-single {
  justify-content: stretch;
}
.dcak-actions.dcak-single .dcak-btn-ok {
  flex: 1;
}

/* ── Dark mode ── */
html[data-theme="dark"] .dcak-backdrop {
  background: rgba(0, 0, 0, .65);
}
html[data-theme="dark"] .dcak-dialog {
  box-shadow: 0 20px 60px -16px rgba(0, 0, 0, .6);
}
html[data-theme="dark"] .dcak-btn-cancel {
  border-color: var(--color-border, #3A3228);
  color: var(--color-text-primary, #F9FAFB);
}
html[data-theme="dark"] .dcak-btn-cancel:hover {
  background: var(--color-hover, #2E281F);
}

/* ── Mobile: bottom-sheet ── */
@media (max-width: 540px) {
  .dcak-backdrop {
    align-items: flex-end;
    padding: 0;
  }
  .dcak-dialog {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 88vh;
    transform: translateY(40px);
  }
  .dcak-backdrop.dcak-show .dcak-dialog {
    transform: translateY(0);
  }
  .dcak-body {
    padding: 24px 20px 0;
  }
  .dcak-actions {
    padding: 16px 20px 28px;
  }
  .dcak-btn {
    padding: 14px 20px;
    font-size: .92rem;
  }
}
