/* ============================================================
   FINANCEL MODAL FIXES v3.1 FINAL
   Sistema universal de modais / Bottom Sheet iOS 26
   ============================================================ */

/* ==========================
   ROOT CONTROL
========================== */

body.modal-open {
  overflow: hidden;
  touch-action: none;
}

/* ==========================
   OVERLAY GLOBAL
========================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgb(var(--blue-950-rgb, 2 6 23) / 0.72);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: calc(var(--z-modal, 50) + 99950);
  transition: opacity .25s ease;
  opacity: 0;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

/* ==========================
   BOTTOM SHEET (PADRÃO LANÇAMENTOS)
========================== */

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 540px;
  padding: 1.2rem 1.6rem 1.8rem;
  border-radius: 1.45rem 1.45rem 0 0;
  background:
    radial-gradient(circle at 0% 0%, rgb(var(--cyan-400-rgb, 56 189 248) / 0.14), transparent 55%),
    radial-gradient(circle at 120% 140%, rgb(var(--gold-400-rgb, 250 204 21) / 0.14), transparent 55%),
    linear-gradient(155deg, rgb(15 23 42 / 0.99), rgb(15 23 42 / 0.94));
  border: 1px solid rgb(var(--slate-400-rgb, 148 163 184) / 0.45);
  box-shadow: 0 -22px 65px rgba(0,0,0,0.95);
  transform: translateY(100%);
  transition: transform .32s cubic-bezier(.29,.77,.58,1);
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

/* barra superior de arrastar */
.modal-close-bar {
  width: 48px;
  height: 5px;
  border-radius: 999px;
  background: rgb(var(--slate-400-rgb, 148 163 184) / 0.48);
  margin: 0 auto 1rem;
}

/* ==========================
   FULL MODAL (CENTRAL)
========================== */

.modal-center {
  position: relative;
  width: 100%;
  max-width: 520px;
  padding: 1.6rem 1.8rem;
  border-radius: 1.45rem;
  background:
    radial-gradient(circle at 0% 0%, rgb(var(--cyan-400-rgb, 56 189 248) / 0.14), transparent 55%),
    radial-gradient(circle at 120% 140%, rgb(var(--gold-400-rgb, 250 204 21) / 0.14), transparent 55%),
    linear-gradient(145deg, rgb(15 23 42 / 0.99), rgb(15 23 42 / 0.94));
  border: 1px solid rgb(var(--slate-400-rgb, 148 163 184) / 0.45);
  box-shadow: 0 22px 65px rgba(0,0,0,0.95);
  transform: scale(.92) translateY(15px);
  transition: all .28s ease;
}

.modal-overlay.active .modal-center {
  transform: scale(1) translateY(0);
}

/* ==========================
   TÍTULO E CONTEÚDO
========================== */

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: .55rem;
  color: var(--text-main);
}

.modal-description {
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-bottom: .9rem;
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  margin-top: .6rem;
}

/* ==========================
   BOTÃO FECHAR
========================== */

.modal-close-btn {
  position: absolute;
  right: 1rem;
  top: 1rem;
  font-size: 1.25rem;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0;
  border-radius: 999px;
  cursor: pointer;
  color: var(--text-soft);
  border: 1px solid rgb(var(--slate-400-rgb, 148 163 184) / 0.35);
  background: rgb(var(--blue-950-rgb, 2 6 23) / 0.55);
  transition: var(--transition-fast);
}

.modal-close-btn:hover {
  color: var(--gold-300);
}

/* ==========================
   FOOTER DE AÇÕES
========================== */

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.1rem;
}

/* botão principal */
.modal-btn-primary {
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  font-size: .86rem;
  font-weight: 700;
  background: var(--grad-gold-cta);
  border: 1px solid rgb(var(--gold-400-rgb, 250 204 21) / 0.65);
  color: #111827;
  cursor: pointer;
  transition: 0.2s ease;
}

.modal-btn-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

/* botão secundário */
.modal-btn-secondary {
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  font-size: .86rem;
  font-weight: 600;
  background: rgba(15,23,42,0.96);
  border: 1px solid rgb(var(--slate-400-rgb, 148 163 184) / 0.45);
  color: var(--text-soft);
  cursor: pointer;
}

.modal-btn-secondary:hover {
  border-color: rgb(var(--slate-400-rgb, 148 163 184) / 0.65);
  color: var(--gold-300);
}

/* ==========================
   CAMPOS (PADRÃO FINANCEL)
========================== */

.modal-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgb(var(--slate-200-rgb, 226 232 240) / 0.9);
  margin: 0 0 0.35rem;
}

.modal-field-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-field-row .modal-select {
  flex: 1 1 auto;
}

.btn-add-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgb(var(--cyan-400-rgb, 56 189 248) / 0.6);
  background: rgb(var(--cyan-400-rgb, 56 189 248) / 0.15);
  color: rgb(var(--cyan-300-rgb, 125 211 252) / 1);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
  padding: 0;
  line-height: 1;
}

.btn-add-inline:hover {
  background: rgb(var(--cyan-400-rgb, 56 189 248) / 0.28);
  border-color: rgb(var(--cyan-400-rgb, 56 189 248) / 0.8);
  transform: translateY(-1px);
}

.modal-input,
.modal-select,
.modal-textarea,
.modal-color-input {
  width: 100%;
  border-radius: 0.95rem;
  border: 1px solid rgb(var(--slate-400-rgb, 148 163 184) / 0.38);
  background:
    radial-gradient(circle at 0% 0%, rgb(var(--slate-400-rgb, 148 163 184) / 0.14), transparent 55%),
    rgb(var(--blue-950-rgb, 2 6 23) / 0.92);
  color: rgb(var(--slate-50-rgb, 248 250 252) / 0.95);
  padding: 0.6rem 0.9rem;
  font-size: 0.92rem;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.modal-color-input {
  height: 44px;
  padding: 8px;
}

.modal-textarea {
  min-height: 96px;
  resize: vertical;
}

.modal-input:focus,
.modal-select:focus,
.modal-textarea:focus,
.modal-color-input:focus {
  border-color: rgb(var(--cyan-400-rgb, 56 189 248) / 0.8);
  box-shadow: 0 0 0 2px rgb(var(--cyan-400-rgb, 56 189 248) / 0.18);
}

.modal-input[disabled],
.modal-select[disabled],
.modal-textarea[disabled],
.modal-color-input[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}

.modal-grid > div { min-width: 0; }

@media (max-width: 560px) {
  .modal-grid { grid-template-columns: 1fr; }
}

/* Botão danger (excluir) */
.modal-btn-danger {
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  font-size: .86rem;
  font-weight: 700;
  background: rgb(239 68 68 / 0.12);
  border: 1px solid rgb(239 68 68 / 0.65);
  color: rgb(254 226 226 / 0.95);
  cursor: pointer;
  transition: 0.2s ease;
}

.modal-btn-danger:hover {
  background: rgb(239 68 68 / 0.18);
  transform: translateY(-1px);
}

.modal-btn-danger[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ==========================
   RESPONSIVIDADE GERAL
========================== */

@media (max-width: 480px) {
  .modal-sheet { padding: .9rem 1.2rem 1.4rem; }
  .modal-center { padding: 1.2rem 1.3rem; }
  .modal-title { font-size: 1rem; }
}
