/* Evita flash do modal React antes do patch */
#flappix-auth-modal:not(.flappix-auth-ready) > .relative,
#flappix-auth-modal:not(.flappix-auth-ready) [class*='max-w-sm'],
#flappix-auth-modal:not(.flappix-auth-ready) .flappix-auth-card {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  animation: none !important;
}

#flappix-auth-modal.flappix-auth-ready > .relative,
#flappix-auth-modal.flappix-auth-ready .flappix-auth-card {
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

.flappix-auth-root {
  background: rgba(4, 8, 4, 0.82) !important;
  background-image: none !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: flappix-auth-fade-in 0.22s ease-out;
}

@keyframes flappix-auth-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes flappix-auth-slide-up {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.flappix-auth-card {
  position: relative;
  max-width: 400px !important;
  padding: 1.75rem 1.75rem 1.5rem !important;
  border: 1px solid rgba(126, 217, 87, 0.22) !important;
  border-radius: 20px !important;
  background: linear-gradient(165deg, #0f1f12 0%, #081208 55%, #060e06 100%) !important;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 48px rgba(92, 184, 92, 0.08) !important;
  overflow: hidden;
  animation: flappix-auth-slide-up 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

.flappix-auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #7ed957, #f5c518, #7ed957, transparent);
  opacity: 0.9;
}

.flappix-auth-card::after {
  content: '';
  position: absolute;
  top: -80px;
  right: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(126, 217, 87, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.flappix-auth-card > .flappix-auth-inner {
  position: relative;
  z-index: 1;
  padding: 0;
}

.flappix-auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 1.25rem;
}

.flappix-auth-logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.flappix-auth-logo img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  display: block;
}

.flappix-auth-brand-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.flappix-auth-tabs {
  display: flex;
  gap: 0.35rem;
  padding: 0.25rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  margin-bottom: 1.25rem;
}

.flappix-auth-tab {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.flappix-auth-tab:hover {
  color: rgba(255, 255, 255, 0.75);
}

.flappix-auth-tab.is-active {
  background: linear-gradient(135deg, rgba(92, 184, 92, 0.25), rgba(126, 217, 87, 0.15));
  color: #b8f5a0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(126, 217, 87, 0.2);
}

.flappix-auth-card .mb-1.flex {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
  margin-bottom: 0 !important;
  z-index: 2;
}

.flappix-auth-card h2 {
  display: none !important;
}

.flappix-auth-card > .flappix-auth-inner > .mb-1.flex button[aria-label="Fechar"],
.flappix-auth-card .mb-1.flex button[aria-label="Fechar"] {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  font-size: 1.25rem !important;
  transition: all 0.15s ease;
}

.flappix-auth-card button[aria-label="Fechar"]:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.15);
}

.flappix-auth-card .mb-5.text-sm,
.flappix-auth-card p.mb-5 {
  font-size: 0.8125rem !important;
  color: rgba(255, 255, 255, 0.42) !important;
  line-height: 1.5;
  margin-bottom: 1.25rem !important;
}

.flappix-auth-card form {
  gap: 0.75rem !important;
}

.flappix-auth-card form input {
  width: 100%;
  border-radius: 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  background: rgba(0, 0, 0, 0.35) !important;
  padding: 0.8rem 1rem 0.8rem 2.75rem !important;
  font-size: 16px !important;
  font-family: inherit;
  color: #fff !important;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  background-repeat: no-repeat !important;
  background-position: 0.9rem center !important;
  background-size: 18px 18px !important;
}

.flappix-auth-card form input::placeholder {
  color: rgba(255, 255, 255, 0.28) !important;
}

.flappix-auth-card form input:focus {
  outline: none !important;
  border-color: rgba(126, 217, 87, 0.45) !important;
  box-shadow: 0 0 0 3px rgba(126, 217, 87, 0.12) !important;
  background-color: rgba(0, 0, 0, 0.45) !important;
}

.flappix-auth-card form input[data-auth-field="username"],
.flappix-auth-card form input[data-auth-field="login"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%237ed957' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E") !important;
}

.flappix-auth-card form input[data-auth-field="telefone"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%237ed957' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z'/%3E%3C/svg%3E") !important;
}

.flappix-auth-card form input[data-auth-field="senha"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%237ed957' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") !important;
}

.flappix-auth-card form .text-red-400,
.flappix-auth-card form .rounded-lg.bg-red-500\/10 {
  border-radius: 10px !important;
  border: 1px solid rgba(248, 113, 113, 0.2) !important;
  background: rgba(239, 68, 68, 0.08) !important;
  padding: 0.65rem 0.85rem !important;
  font-size: 0.78rem !important;
}

.flappix-auth-card form button[type="submit"] {
  margin-top: 0.35rem !important;
  border-radius: 12px !important;
  padding: 0.85rem 1rem !important;
  font-size: 0.85rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #4a9e4a 0%, #5cb85c 45%, #7ed957 100%) !important;
  box-shadow: 0 4px 20px rgba(92, 184, 92, 0.3) !important;
  border: 1px solid rgba(126, 217, 87, 0.25);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s !important;
}

.flappix-auth-card form button[type="submit"]:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(92, 184, 92, 0.38) !important;
  filter: brightness(1.05);
}

.flappix-auth-card form button[type="submit"]:disabled {
  opacity: 0.55 !important;
}

.flappix-auth-switch {
  margin-top: 1rem !important;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.78rem !important;
  color: rgba(255, 255, 255, 0.4) !important;
}

.flappix-auth-switch .text-green-400,
.flappix-auth-switch span.font-bold {
  color: #7ed957 !important;
  font-weight: 600 !important;
}

.flappix-auth-pix-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding: 0.45rem 0.75rem;
  border-radius: 99px;
  background: rgba(126, 217, 87, 0.08);
  border: 1px solid rgba(126, 217, 87, 0.15);
  font-size: 0.68rem;
  font-weight: 600;
  color: rgba(184, 245, 160, 0.85);
  letter-spacing: 0.02em;
}

.flappix-auth-pix-badge svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .flappix-auth-card {
    padding: 1.35rem 1.25rem 1.25rem !important;
    border-radius: 16px !important;
  }
}
