/* ============================================================
   BuscarPDF Web - Sistema Unificado de Diálogos & Modais In-App
   Substitui window.alert, window.prompt e window.confirm
   Padrão: Apple Glass Luxury & Linear Dark
   ============================================================ */

.app-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background-color: rgba(5, 10, 24, 0.75);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  box-sizing: border-box;
  animation: appDialogFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-dialog-overlay.hidden {
  display: none !important;
}

@keyframes appDialogFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes appDialogPop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.app-dialog-card {
  width: 100%;
  max-width: 480px;
  background: rgba(17, 24, 39, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.85), 0 0 30px rgba(37, 99, 235, 0.2);
  padding: 1.75rem 2rem;
  box-sizing: border-box;
  animation: appDialogPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color: #f8fafc;
  position: relative;
}

.app-dialog-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.app-dialog-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.app-dialog-icon.success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.app-dialog-icon.error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.app-dialog-icon.info {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.app-dialog-icon.gold,
.app-dialog-icon.brand {
  background: rgba(37, 99, 235, 0.18);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.app-dialog-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin: 0;
}

.app-dialog-message {
  font-size: 0.92rem;
  color: #cbd5e1;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.app-dialog-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Modal de Criar / Editar Perfil */
.profile-edit-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-preview-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  transition: all 0.3s ease;
}

.profile-color-picker {
  display: flex;
  gap: 0.65rem;
  margin: 0.5rem 0 1.25rem;
  flex-wrap: wrap;
}

.color-option-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.color-option-btn:hover {
  transform: scale(1.15);
}

.color-option-btn.selected {
  border-color: #ffffff;
  box-shadow: 0 0 12px currentColor;
  transform: scale(1.15);
}

/* Modal de Gerenciamento de Perfis */
.manage-profiles-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  padding-right: 0.35rem;
}

.manage-profile-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  gap: 0.75rem;
}

.manage-profile-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.manage-profile-tag {
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-weight: 700;
}

/* ============================================================
   Modal de PIN de 4 Dígitos (Apple Luxury)
   ============================================================ */
.pin-modal-card {
  max-width: 340px !important;
  padding: 2rem 1.75rem !important;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pin-dots-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0 0.85rem;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.pin-dot.filled {
  background: #ffffff;
  border-color: #ffffff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.6);
  transform: scale(1.15);
}

.pin-dot.success {
  background: #10b981 !important;
  border-color: #10b981 !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.8) !important;
}

.pin-dot.error {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.8) !important;
}

.pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  width: 100%;
  max-width: 260px;
  margin-top: 0.5rem;
}

.pin-key {
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-size: 1.35rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  outline: none;
  user-select: none;
  transition: all 0.12s ease;
}

.pin-key:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
  transform: scale(1.05);
}

.pin-key:active {
  background: rgba(59, 130, 246, 0.3);
  transform: scale(0.95);
}

.pin-key-action {
  font-size: 1rem;
  color: #94a3b8;
  background: transparent;
  border-color: transparent;
}

.pin-key-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* Animação Shake para PIN Incorreto */
@keyframes shakeCard {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.shake-card {
  animation: shakeCard 0.45s ease;
}
