/* ReadySMS — Card Gate (production)
 * Hard-blocking modal that mounts on dashboard load if card_gate_required = 1.
 * No close, no Escape, no backdrop dismiss. Funnels users through Stripe card
 * verification ($1 charge credited to balance).
 * Reuses .pg-* class patterns from phone-gate.css for visual consistency.
 */

.cg-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 99990;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: cg-fade 0.3s ease-out;
}
@keyframes cg-fade { from { opacity: 0; } to { opacity: 1; } }

.cg-modal {
  background: #FFF;
  border-radius: 18px;
  padding: 28px 28px 22px;
  max-width: 520px; width: 100%;
  position: relative;
  box-shadow:
    0 30px 80px -20px rgba(37, 99, 235, 0.45),
    0 0 0 1px rgba(37, 99, 235, 0.08);
  animation: cg-pop 0.4s cubic-bezier(0.34, 1.35, 0.64, 1);
  font-family: 'Inter', -apple-system, sans-serif;
  color: #0F172A;
}
@keyframes cg-pop {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cg-modal.shake { animation: cg-shake 0.3s; }
@keyframes cg-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.cg-header { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.cg-icon-wrap {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, #2563EB, #7C3AED 50%, #0EA5E9);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.45);
}
.cg-title-block { flex: 1; padding-top: 2px; }
.cg-title {
  font-size: 1.15rem; font-weight: 800; color: #0F172A;
  letter-spacing: -0.01em; margin: 0 0 4px; line-height: 1.3;
}
.cg-subtitle { font-size: 0.82rem; color: #64748B; line-height: 1.5; margin: 0; }
.cg-subtitle strong { color: #334155; font-weight: 600; }

.cg-error {
  display: none;
  background: rgba(239, 68, 68, 0.08); color: #DC2626;
  padding: 10px 14px; border-radius: 10px;
  font-size: 0.84rem; margin-bottom: 14px; text-align: left;
  font-weight: 500;
}

.cg-card-wrap {
  margin-bottom: 18px;
}
.cg-card-wrap label {
  display: block; font-size: 0.78rem; font-weight: 600;
  color: #334155; margin-bottom: 8px;
}
.cg-card-element {
  padding: 12px 14px;
  border: 1.5px solid #CBD5E1; border-radius: 10px;
  background: #FFF;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cg-card-element.StripeElement--focus {
  border-color: #2563EB;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.cg-card-element.StripeElement--invalid {
  border-color: #EF4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.cg-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding-top: 16px; margin-top: 6px;
  border-top: 1px solid #F1F5F9;
}
.cg-foot-note { font-size: 0.74rem; color: #64748B; flex: 1; line-height: 1.4; }

.cg-btn {
  padding: 11px 22px; border-radius: 10px;
  font-weight: 700; font-size: 0.9rem;
  font-family: inherit; cursor: pointer;
  border: none; transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.cg-btn-primary {
  background: linear-gradient(135deg, #2563EB 0%, #7C3AED 50%, #0EA5E9 100%);
  color: #FFF;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}
.cg-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4); }
.cg-btn-primary:active { transform: translateY(0); }
.cg-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Inline processing overlay */
.cg-processing {
  position: absolute; inset: 0;
  background: #FFF; border-radius: 18px; z-index: 99;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 36px 32px; text-align: center;
}
.cg-spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 3px solid #E2E8F0; border-top-color: #2563EB;
  animation: cg-spin 0.7s linear infinite; margin-bottom: 14px;
}
@keyframes cg-spin { to { transform: rotate(360deg); } }

/* Success overlay */
.cg-success {
  position: absolute; inset: 0;
  background: #FFF; border-radius: 18px; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 36px 32px; text-align: center;
  animation: cg-pop 0.3s cubic-bezier(0.34, 1.35, 0.64, 1);
}

/* Logout escape */
.cg-escape {
  text-align: center;
  font-size: 0.78rem;
  color: #94A3B8;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid #F1F5F9;
}
.cg-escape a {
  color: #64748B;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  margin-left: 4px;
}
.cg-escape a:hover {
  color: #0F172A;
  text-decoration: underline;
}

/* Styled logout confirm */
.cg-confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99995;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: cg-fade 0.2s ease-out;
  font-family: 'Inter', -apple-system, sans-serif;
}
.cg-confirm-card {
  background: #FFF;
  border-radius: 16px;
  padding: 28px 28px 22px;
  max-width: 380px; width: 100%;
  text-align: center;
  box-shadow:
    0 30px 80px -20px rgba(15, 23, 42, 0.45),
    0 0 0 1px rgba(15, 23, 42, 0.06);
  animation: cg-pop 0.3s cubic-bezier(0.34, 1.35, 0.64, 1);
}
.cg-confirm-icon {
  width: 52px; height: 52px; margin: 0 auto 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #EF4444, #DC2626);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px -6px rgba(239, 68, 68, 0.45);
}
.cg-confirm-title {
  font-size: 1.2rem; font-weight: 800; color: #0F172A;
  letter-spacing: -0.01em; margin: 0 0 8px; line-height: 1.25;
}
.cg-confirm-sub {
  font-size: 0.88rem; color: #64748B;
  line-height: 1.5; margin: 0 0 22px;
}
.cg-confirm-actions {
  display: flex; gap: 10px; justify-content: stretch;
}
.cg-confirm-actions .cg-btn { flex: 1; padding: 11px 16px; }

.cg-btn-secondary {
  background: #F1F5F9; color: #334155;
  border: 1px solid #E2E8F0;
}
.cg-btn-secondary:hover { background: #E2E8F0; }
.cg-btn-danger {
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: #FFF;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}
.cg-btn-danger:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(239, 68, 68, 0.4); }
.cg-btn-danger:active { transform: translateY(0); }

@media (max-width: 460px) {
  .cg-confirm-actions { flex-direction: column-reverse; }
  .cg-confirm-actions .cg-btn { width: 100%; }
}

/* Mobile */
@media (max-width: 720px) {
  .cg-modal { padding: 22px 22px 18px; }
  .cg-header { gap: 10px; margin-bottom: 14px; }
  .cg-icon-wrap { width: 40px; height: 40px; }
  .cg-title { font-size: 1.05rem; }
  .cg-foot { flex-direction: column; align-items: stretch; gap: 10px; }
  .cg-foot-note { text-align: center; }
  .cg-btn { width: 100%; }
}
