/* Overlay */
.popup-template {
  display: none;
}
.popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(15, 23, 42, 0.42);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
  backdrop-filter: blur(3px);
}
.popup-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}
/* Drawer */
.popup-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  width: min(520px, 100vw);
  height: 100dvh;
  background: var(--surface);
  box-shadow: -18px 0 60px rgba(15, 23, 42, 0.14);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] .popup-drawer {
  box-shadow: -18px 0 60px rgba(0, 0, 0, 0.45);
}
.popup-drawer.is-open {
  transform: translateX(0);
}
/* Header */
.drawer-header {
  min-height: 76px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--gray);
}
.drawer-title {
  margin: 0;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.3px;
}
.drawer-subtitle {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}
.drawer-close {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: var(--gray-bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
  flex: 0 0 auto;
}
.drawer-close:hover {
  background: var(--gray);
  color: var(--surface);
  transform: rotate(90deg);
}
/* Body */
.popup-body-form {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 24px;
  min-height: 0;
  scrollbar-width: none;
  background: var(--surface);
}
.field__error {
  display: none;
  margin: 5px 0 0;
  color: #d92d20;
  font-size: 12px;
  line-height: 1.4;
}

.field__error.is-visible {
  display: block;
}

.input.is-invalid,
.custom-select-wrapper.is-invalid {
  border-color: #d92d20 !important;
}

.field.has-error .field__label {
  color: #d92d20;
}

.duplicate-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  margin-bottom: 15px;
  background: var(--warning-bg);
  border: 1px solid var(--yellow-bg);
  border-radius: 8px;
  color: var(--yellow);
}

.duplicate-alert[hidden] {
  display: none !important;
}

.input.is-duplicate {
  border-color: #d92d20 !important;
}
/*.duplicate-alert {
  display: none;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.5;
  margin-top: -7px;
  margin-bottom: 18px;
}
*/
.duplicate-alert.show {
  display: flex;
  gap: 10px;
  animation: alertIn 0.25s ease;
}

.duplicate-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--yellow-bg);
  border-radius: 50%;
  font-size: 11px;
}

.duplicate-alert a {
  color: var(--text);
  font-weight: 700;
  text-decoration: underline;
}

@keyframes alertIn {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Footer */
.drawer-footer {
  flex: 0 0 auto;
  min-height: 72px;
  padding: 14px 26px;
  border-top: 1px solid var(--gray);
  background: var(--bg);
  gap: 10px;
}

.drawer-footer-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

/* Responsive */
@media (max-width: 767px) {
  .common-drawer {
    width: 100%;
    height: 94vh;
    top: auto;
    bottom: 0;
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
  }

  .common-drawer.show {
    transform: translateY(0);
  }

  .drawer-header {
    padding: 16px 20px;
  }

  .drawer-body {
    padding: 22px 20px;
  }

  .drawer-footer {
    padding: 12px 20px;
    flex-wrap: wrap;
  }

  .footer-left {
    width: 100%;
    order: 1;
  }

  .footer-right {
    width: 100%;
    order: 2;
  }

  .footer-right .btn {
    flex: 1;
  }
}

@media (max-width: 480px) {
  .common-drawer {
    height: 96vh;
  }

  .drawer-title {
    font-size: 18px;
  }

  .drawer-body {
    padding: 20px 16px;
  }

  .drawer-footer {
    padding: 12px 16px;
  }

  .footer-right .btn {
    padding: 0 9px;
    font-size: 11px;
  }
}
@media (max-width: 600px) {
  .popup {
    top: auto;
    right: 0;
    bottom: 0;
    width: 100%;
    height: min(92dvh, 760px);
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
  }
  .popup.is-open {
    transform: translateY(0);
  }
  .popup-body-form {
    padding: 20px;
  }
  .drawer-header {
    padding: 18px 20px;
  }
  .drawer-footer {
    padding: 14px 20px;
  }
}

/* =================== DRAWER BODY CSS ===================*/
.input.custom-select-wrapper {
  min-width: 100%;
  padding: 0;
  border: 0;
}
.input .custom-select__trigger {
  width: 100%;
  height: 46px;
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition:
    border-color var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease),
    background-color var(--slow) var(--ease);
  appearance: none;
}
