/* EVBro — Modals and dialogs.
   Standalone sheet: the load ORDER (templates/index.html) follows the original cascade; do not change it. */

/* ========================================================
   MODAL OVERLAY & ADAPTIVE RESPONSIVE DIALOGS
   ======================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  padding: 1.25rem 1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 2.5rem);
  max-height: calc(100dvh - 2.5rem);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-deep);
  margin: auto;
  box-sizing: border-box;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 600px) {
  .modal-overlay {
    padding: 0.6rem 0.4rem;
    align-items: center;
  }
  .modal-card {
    padding: 1.25rem 0.95rem;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 20px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
}

[data-theme="light"] .modal-card {
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.18);
}

.modal-card::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.modal-card h3 {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.pin-input {
  width: 100%;
  padding: 0.9rem;
  border: 1px solid var(--border-color);
  background: var(--surface-secondary);
  border-radius: 16px;
  color: var(--text-primary);
  font-size: 1.3rem;
  text-align: center;
  letter-spacing: 6px;
  margin: 1.25rem 0;
  outline: none;
  font-weight: 700;
  transition: var(--transition);
}

.pin-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* App dialog (core/feedback.js): above every other modal and the action sheet */
.app-dialog { z-index: 12000; }
.app-dialog-card { max-width: 420px; padding: 1.4rem 1.4rem 1.1rem; }
.app-dialog-card h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.app-dialog-card h3[hidden] { display: none; }
.app-dialog-message { margin: 0; font-size: 0.95rem; line-height: 1.45; color: var(--text-primary); white-space: pre-wrap; overflow-wrap: anywhere; }
.app-dialog-input { margin-top: 0.9rem; width: 100%; box-sizing: border-box; }
.app-dialog-input[hidden] { display: none; }
.app-dialog-actions { margin-top: 1.1rem; }
.app-dialog-actions button { min-height: 44px; min-width: 6.5rem; }
.app-dialog-actions button[hidden] { display: none; }
.btn-danger { background: var(--danger, #dc2626); color: #fff; border: 0; border-radius: var(--radius-pill); padding: 0.65rem 1.1rem; font: inherit; font-weight: 600; cursor: pointer; }
.btn-danger:hover { filter: brightness(1.08); }
