.popup-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 50;
}

html.dark .popup-overlay {
    background-color: rgba(0, 0, 0, 0.6);
}


.popup-box {
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 2rem;
    max-width: 24rem;
    width: 100%;
    text-align: center;
    animation: fadeIn 0.3s ease-out forwards;
    overflow: hidden;
}


html.dark .popup-overlay {
    background-color: rgba(0, 0, 0, 0.6);
}

html.dark .popup-box {
    background-color: #1f2937 !important;
    color: #f9fafb !important;
    box-shadow: 0 4px 8px rgba(255, 255, 255, 0.1) !important;
}

html.dark .popup-box h2 {
    color: #4ade80 !important;
}

html.dark .popup-box p {
    color: #d1d5db !important;
}

.btn-primary {
  padding: 0.75rem 1.5rem;
  background-color: #3b82f6;
  color: #ffffff;
  font-weight: 600;
  border-radius: 0.5rem;
  cursor: pointer;
  border: none;
  margin-left: 1rem;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn-secondary {
  padding: 0.75rem 1.5rem;
  color: #ffffff;
  font-weight: 600;
  border-radius: 0.5rem;
  cursor: pointer;
  border: none;
  margin-left: 1rem;
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.btn-secondary:hover {
  transform: translateY(-2px);
}

.btn-primary:hover {
  background-color: #2563eb;
  transform: translateY(-2px);
}

html.dark .btn-primary {
  background-color: #2563eb !important;
  color: #ffffff !important;
}
html.dark .btn-primary:hover {
  background-color: #1e40af !important;
}

/* Make buttons inside popup-box equal width */
.popup-box .popup-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Ensure buttons inside popups share width and consistent height */
.popup-box .btn,
.popup-box .btn-primary,
.popup-box .btn-secondary {
  display: inline-flex;       /* ensure flex centering inside the button */
  align-items: center;        /* vertical centering */
  justify-content: center;    /* horizontal centering */
  flex: 1 1 0;
  min-width: 120px;
  height: 44px;
  padding: 0.6rem 0.75rem;
  line-height: 1;             /* avoid extra line-height pushing content */
  margin-left: 0; /* remove global left margin inside popup */
  box-sizing: border-box;
  margin-bottom: 1rem;
}

/* If you want the primary button to stand out, keep its colors but not margin */
.popup-box .btn-primary {
  border-radius: 0.5rem;
}

/* On very small screens stack buttons */
@media (max-width: 420px) {
  .popup-box .popup-actions { flex-direction: column; }
  .popup-box .btn { width: 100%; }
}

/* Popup confirm styling improvements */
.popup-box.popup-confirm {
  max-width: 28rem;
  padding: 1.5rem 1.25rem;
}

.popup-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  justify-content: center;
}

.popup-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #fff 0%, #eef2ff 100%);
  color: #1f2937;
  font-size: 1.1rem;
  box-shadow: 0 2px 6px rgba(37,99,235,0.12);
}

.popup-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
  color: #111827;
}

.popup-desc {
  color: #374151;
  margin-bottom: 1rem;
  text-align: center;
}

/* Make actions right aligned on wide screens but centered in narrow widths */
.popup-box .popup-actions {
  display: flex;
  gap: 0.6rem;
  justify-content: center;
  margin-top: 0.25rem;
}



.popup-box .btn-secondary {
  background: transparent;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.popup-box .btn-primary {
  background: #2563eb;
  color: #fff;
  border: 1px solid #2563eb;
}

@media (min-width: 640px) {
  .popup-box .popup-actions { justify-content: flex-end; }
}