/* ==========================================================================
   Etsycars CMI Moroccan Interbank Payment System - Apple Liquid Glass Style
   ========================================================================== */

.cmi-modal-overlay,
dialog.cmi-modal-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  box-sizing: border-box;
  animation: cmiFadeIn 0.22s ease-out;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", system-ui, sans-serif;
  color: #1e293b;
  overflow: visible;
}

dialog.cmi-modal-dialog::backdrop {
  background: rgba(15, 23, 42, 0.68);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.cmi-modal-overlay {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

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

.cmi-sheet {
  background: #ffffff;
  border-radius: 24px;
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 
    0 24px 60px -12px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.8),
    inset 0 1px 1px rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  position: relative;
  animation: cmiSlideUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cmiSlideUp {
  from { transform: translateY(24px) scale(0.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Header with Apple Frosted Glass */
.cmi-header {
  padding: 18px 20px 14px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #f1f5f9;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 24px 24px 0 0;
}

.cmi-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cmi-logo-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cmi-pill-badge {
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.6px;
  padding: 3px 8px;
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.35);
}

.cmi-title-text {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.3px;
}

.cmi-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f5f9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.15s ease;
  padding: 0;
}

.cmi-close-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.cmi-close-btn svg {
  width: 16px;
  height: 16px;
}

.cmi-trust-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  font-weight: 600;
  color: #64748b;
  flex-wrap: wrap;
}

.cmi-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #16a34a;
  display: inline-block;
}

/* Body Content */
.cmi-body {
  padding: 20px;
}

.cmi-order-summary {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.cmi-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 8px;
}

.cmi-amount-highlight {
  font-size: 18px;
  font-weight: 900;
  color: #d5460e;
  letter-spacing: -0.4px;
}

.cmi-guarantee-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.2);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 750;
  color: #15803d;
}

.cmi-guarantee-pill svg {
  width: 13px;
  height: 13px;
  stroke: #16a34a;
}

/* Accepted Cards Tag Row */
.cmi-cards-accepted {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.cmi-card-tag {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}

.cmi-tag-morocco {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

/* Fields */
.cmi-fld-group {
  margin-bottom: 12px;
}

.cmi-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 5px;
}

.cmi-input,
.cmi-select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  outline: none;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.cmi-input:focus,
.cmi-select:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.cmi-card-input-wrap {
  position: relative;
}

.cmi-input-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  pointer-events: none;
}

.cmi-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Action CTA Button */
.cmi-cta-btn {
  width: 100%;
  padding: 14px 22px;
  border-radius: 9999px;
  background: linear-gradient(180deg, #ea580c 0%, #c2410c 100%);
  border: none;
  box-shadow: 0 4px 18px rgba(234, 88, 12, 0.35);
  color: #ffffff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cmi-cta-btn:hover {
  opacity: 0.96;
  box-shadow: 0 6px 22px rgba(234, 88, 12, 0.45);
}

.cmi-cta-btn:active {
  transform: scale(0.985);
  filter: brightness(0.95);
}

.cmi-cta-btn svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
}

.cmi-secure-note {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  margin-top: 10px;
  font-weight: 500;
}

/* 3D Secure Screen */
.cmi-otp-box {
  text-align: center;
  padding: 8px 0;
}

.cmi-bank-badge-header {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px;
  font-size: 12px;
  font-weight: 800;
  color: #0284c7;
  margin-bottom: 14px;
}

.cmi-otp-title {
  font-size: 18px;
  font-weight: 900;
  color: #0f172a;
  margin: 0 0 6px 0;
}

.cmi-otp-desc {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 14px 0;
}

.cmi-otp-alert {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 12.5px;
  color: #1e40af;
}

.cmi-otp-input {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 6px;
  text-align: center;
}

.cmi-link-btn {
  background: none;
  border: none;
  color: #64748b;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  padding: 6px 12px;
}

.cmi-link-btn:hover {
  color: #0f172a;
  text-decoration: underline;
}

/* Success Screen */
.cmi-success-box {
  text-align: center;
  padding: 10px 0;
}

.cmi-success-icon-wrap {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #dcfce7;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px auto;
}

.cmi-success-icon-wrap svg {
  width: 32px;
  height: 32px;
}

.cmi-success-title {
  font-size: 20px;
  font-weight: 900;
  color: #15803d;
  margin: 0 0 6px 0;
}

.cmi-success-desc {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 16px 0;
}

.cmi-receipt-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px;
  text-align: left;
  margin-bottom: 16px;
}

.cmi-receipt-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 12.5px;
  color: #475569;
  border-bottom: 1px solid #f1f5f9;
}

.cmi-receipt-row:last-child {
  border-bottom: none;
}

.cmi-ref-val {
  color: #0f172a;
  font-family: monospace;
  font-size: 13.5px;
}

.cmi-cta-wa {
  background: linear-gradient(135deg, #28e06d, #20bd5a);
  box-shadow: 0 8px 20px rgba(37, 211, 102, 0.35);
}

/* RTL Support */
[dir="rtl"] .cmi-modal-overlay {
  direction: rtl;
}

[dir="rtl"] .cmi-receipt-card {
  text-align: right;
}

[dir="rtl"] .cmi-input-icon {
  right: auto;
  left: 12px;
}
