/* ─────────────────────────────────────────────────────────────
   Zaisei Enhanced Modals
   Polished, lively modal styling for create / edit / delete flows
   ───────────────────────────────────────────────────────────── */

/* ─── Base modal overrides ─── */
.modal.z-modal .modal-content {
  border: none;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.12),
    0 4px 20px rgba(0, 0, 0, 0.06);
}

.modal.z-modal .modal-dialog {
  animation: zModalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes zModalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-24px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── Modal Header: Decorative banner ─── */
.modal.z-modal .z-modal-header {
  border-bottom: none;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.z-modal-banner {
  width: 100%;
  padding: 2rem 1.5rem 1rem;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Close button positioned top-right over the banner */
.z-modal-banner .z-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  opacity: 0.7;
}

.z-modal-banner .z-modal-close:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Decorative circles in the banner */
.z-modal-banner::before,
.z-modal-banner::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.z-modal-banner::before {
  width: 140px;
  height: 140px;
  top: -50px;
  right: -30px;
}

.z-modal-banner::after {
  width: 100px;
  height: 100px;
  bottom: -40px;
  left: -20px;
}

/* Icon circle in the banner */
.z-modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
  font-size: 28px;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.z-modal-icon:hover {
  transform: scale(1.08) rotate(-3deg);
}

.z-modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  position: relative;
  z-index: 1;
}

.z-modal-subtitle {
  font-size: 0.8rem;
  margin-top: 0.25rem;
  position: relative;
  z-index: 1;
  opacity: 0.75;
}

/* ─── Create/default variant (Primary / Indigo) ─── */
.z-modal--create .z-modal-banner {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
}

.z-modal--create .z-modal-banner::before {
  background: rgba(255, 255, 255, 0.08);
}

.z-modal--create .z-modal-banner::after {
  background: rgba(255, 255, 255, 0.05);
}

.z-modal--create .z-modal-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
}

.z-modal--create .z-modal-close {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.z-modal--create .z-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ─── Edit variant (Teal) ─── */
.z-modal--edit .z-modal-banner {
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%);
  color: #fff;
}

.z-modal--edit .z-modal-banner::before {
  background: rgba(255, 255, 255, 0.08);
}

.z-modal--edit .z-modal-banner::after {
  background: rgba(255, 255, 255, 0.05);
}

.z-modal--edit .z-modal-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.3);
}

.z-modal--edit .z-modal-close {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.z-modal--edit .z-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ─── Delete / Danger variant (Red) ─── */
.z-modal--danger .z-modal-banner {
  background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
  color: #fff;
}

.z-modal--danger .z-modal-banner::before {
  background: rgba(255, 255, 255, 0.08);
}

.z-modal--danger .z-modal-banner::after {
  background: rgba(255, 255, 255, 0.05);
}

.z-modal--danger .z-modal-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.3);
}

.z-modal--danger .z-modal-close {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.z-modal--danger .z-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ─── Warning variant (Amber) ─── */
.z-modal--warning .z-modal-banner {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%);
  color: #fff;
}

.z-modal--warning .z-modal-banner::before {
  background: rgba(255, 255, 255, 0.08);
}

.z-modal--warning .z-modal-banner::after {
  background: rgba(255, 255, 255, 0.05);
}

.z-modal--warning .z-modal-icon {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.3);
}

.z-modal--warning .z-modal-close {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.z-modal--warning .z-modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ─── Modal Body ─── */
.modal.z-modal .modal-body {
  padding: 1.75rem 1.5rem 1rem;
}

.modal.z-modal .modal-body .form-label {
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #64748b;
  margin-bottom: 0.4rem;
}

.modal.z-modal .modal-body .form-control,
.modal.z-modal .modal-body .form-select {
  border-radius: 12px;
  padding: 0.65rem 1rem;
  border: 1.5px solid #e2e8f0;
  transition: all 0.2s ease;
  font-size: 0.92rem;
  background-color: #f8fafc;
}

.modal.z-modal .modal-body .form-control:focus,
.modal.z-modal .modal-body .form-select:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
  background-color: #fff;
}

.modal.z-modal .modal-body .form-control::placeholder {
  color: #94a3b8;
}

/* Input group styling */
.modal.z-modal .modal-body .input-group .input-group-text {
  border-radius: 12px 0 0 12px;
  border: 1.5px solid #e2e8f0;
  border-right: none;
  background: #f1f5f9;
  color: #64748b;
  font-weight: 600;
}

.modal.z-modal .modal-body .input-group .form-control {
  border-radius: 0 12px 12px 0;
  border-left: none;
}

.modal.z-modal .modal-body .input-group .form-control:focus {
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.modal.z-modal .modal-body .input-group:focus-within .input-group-text {
  border-color: #4f46e5;
  color: #4f46e5;
}

/* Switch styling */
.modal.z-modal .modal-body .form-check.form-switch {
  padding: 0.7rem 1rem 0.7rem 3.5rem;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  transition: all 0.2s ease;
}

.modal.z-modal .modal-body .form-check.form-switch:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.modal.z-modal .modal-body .form-check.form-switch .form-check-input:checked ~ .form-check-label,
.modal.z-modal .modal-body .form-check.form-switch:has(.form-check-input:checked) {
  border-color: rgba(79, 70, 229, 0.3);
  background: rgba(79, 70, 229, 0.04);
}

.modal.z-modal .modal-body .form-check.form-switch .form-check-input {
  margin-left: -2.5rem;
}

.modal.z-modal .modal-body .form-check.form-switch .form-check-label {
  font-weight: 500;
  color: #475569;
  font-size: 0.9rem;
}

/* Color input */
.modal.z-modal .modal-body .form-control-color {
  width: 48px;
  height: 44px;
  border-radius: 12px !important;
  padding: 4px;
}

/* Alert styling inside modals */
.modal.z-modal .alert {
  border-radius: 12px;
  font-size: 0.875rem;
  border: none;
}

.modal.z-modal .alert-danger {
  background: #fef2f2;
  color: #991b1b;
}

.modal.z-modal .alert-info {
  background: #eff6ff;
  color: #1e40af;
}

/* Textarea */
.modal.z-modal .modal-body textarea.form-control {
  border-radius: 12px;
}

/* ─── Modal Footer ─── */
.modal.z-modal .modal-footer {
  border-top: 1px solid #f1f5f9;
  padding: 1rem 1.5rem 1.25rem;
  gap: 0.5rem;
}

.modal.z-modal .modal-footer .btn {
  border-radius: 12px;
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.modal.z-modal .modal-footer .btn-primary {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  border: none;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
}

.modal.z-modal .modal-footer .btn-primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.modal.z-modal .modal-footer .btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.modal.z-modal .modal-footer .btn-danger {
  background: linear-gradient(135deg, #dc2626, #ef4444);
  border: none;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.25);
}

.modal.z-modal .modal-footer .btn-danger:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(220, 38, 38, 0.35);
  transform: translateY(-1px);
}

.modal.z-modal .modal-footer .btn-warning {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  border: none;
  color: #fff;
  box-shadow: 0 4px 14px rgba(217, 119, 6, 0.25);
}

.modal.z-modal .modal-footer .btn-warning:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(217, 119, 6, 0.35);
  transform: translateY(-1px);
  color: #fff;
}

.modal.z-modal .modal-footer .btn-outline-secondary {
  border: 1.5px solid #e2e8f0;
  color: #64748b;
  background: transparent;
}

.modal.z-modal .modal-footer .btn-outline-secondary:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

.modal.z-modal .modal-footer .btn-secondary {
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  color: #64748b;
}

.modal.z-modal .modal-footer .btn-secondary:hover {
  background: #e2e8f0;
  color: #475569;
}

/* ─── Delete modal body text ─── */
.z-modal-delete-body {
  text-align: center;
  padding: 0.5rem 0;
}

.z-modal-delete-body p {
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.6;
}

.z-modal-delete-body strong {
  color: #1e293b;
}

/* ─── Responsive ─── */
@media (max-width: 576px) {
  .modal.z-modal .modal-content {
    border-radius: 16px;
    margin: 0.5rem;
  }

  .z-modal-banner {
    padding: 1.5rem 1rem 0.75rem;
  }

  .z-modal-icon {
    width: 52px;
    height: 52px;
    font-size: 24px;
    border-radius: 14px;
  }

  .modal.z-modal .modal-body {
    padding: 1.25rem 1rem 0.75rem;
  }

  .modal.z-modal .modal-footer {
    padding: 0.75rem 1rem 1rem;
  }
}

/* ─── Dark mode support ─── */
[data-bs-theme="dark"] .modal.z-modal .modal-content {
  background: #1e293b;
}

[data-bs-theme="dark"] .modal.z-modal .modal-body .form-control,
[data-bs-theme="dark"] .modal.z-modal .modal-body .form-select {
  background-color: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

[data-bs-theme="dark"] .modal.z-modal .modal-body .form-control:focus,
[data-bs-theme="dark"] .modal.z-modal .modal-body .form-select:focus {
  background-color: #1e293b;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

[data-bs-theme="dark"] .modal.z-modal .modal-body .form-label {
  color: #94a3b8;
}

[data-bs-theme="dark"] .modal.z-modal .modal-body .input-group .input-group-text {
  background: #334155;
  border-color: #334155;
  color: #94a3b8;
}

[data-bs-theme="dark"] .modal.z-modal .modal-body .form-check.form-switch {
  background: #0f172a;
  border-color: #334155;
}

[data-bs-theme="dark"] .modal.z-modal .modal-body .form-check.form-switch:hover {
  background: #1e293b;
  border-color: #475569;
}

[data-bs-theme="dark"] .modal.z-modal .modal-body .form-check.form-switch .form-check-label {
  color: #cbd5e1;
}

[data-bs-theme="dark"] .modal.z-modal .modal-footer {
  border-top-color: #334155;
}

[data-bs-theme="dark"] .modal.z-modal .modal-footer .btn-outline-secondary {
  border-color: #334155;
  color: #94a3b8;
}

[data-bs-theme="dark"] .modal.z-modal .modal-footer .btn-outline-secondary:hover {
  background: #334155;
  color: #e2e8f0;
}

[data-bs-theme="dark"] .modal.z-modal .modal-footer .btn-secondary {
  background: #334155;
  border-color: #475569;
  color: #94a3b8;
}

[data-bs-theme="dark"] .z-modal-delete-body p {
  color: #94a3b8;
}

[data-bs-theme="dark"] .z-modal-delete-body strong {
  color: #e2e8f0;
}
