/* Advanced Order Management - Modern Checkout Popup */
.aom-checkout-popup {
  position: fixed;
  inset: 0;
  z-index: 99999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.aom-checkout-popup.aom-active {
  opacity: 1;
  pointer-events: auto;
}
.aom-checkout-overlay {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.aom-checkout-modal {
  position: relative;
  background: #ffffff;
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 32px 64px -12px rgba(16, 24, 40, 0.4), 0 24px 32px -8px rgba(16, 24, 40, 0.2);
  transform: translateY(24px) scale(0.96);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
  overflow: hidden;
  border: 1px solid #eaecf0;
  max-height: 90vh;
  overflow-y: auto;
}
.aom-checkout-popup.aom-active .aom-checkout-modal {
  transform: translateY(0) scale(1);
}

.aom-checkout-header {
  padding: 24px 24px 0;
  text-align: center;
}
.aom-checkout-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px;
  animation: aom-icon-pop 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}
@keyframes aom-icon-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.aom-icon-blocked { background: #fef3f2; border: 2px solid #fecdca; }
.aom-icon-duplicate { background: #fffaeb; border: 2px solid #fedf89; }
.aom-icon-invalid { background: #eff8ff; border: 2px solid #b2ddff; }
.aom-icon-error { background: #fef3f2; border: 2px solid #fecdca; }

.aom-checkout-title {
  font-size: 19px;
  font-weight: 800;
  color: #101828;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.aom-checkout-title.blocked { color: #b42318; }
.aom-checkout-title.duplicate { color: #b54708; }
.aom-checkout-title.invalid { color: #1849a9; }

.aom-checkout-body {
  padding: 16px 24px 24px;
  text-align: center;
}
.aom-checkout-message {
  font-size: 14px;
  line-height: 1.7;
  color: #344054;
  font-weight: 500;
  margin: 0;
  word-break: break-word;
}
.aom-checkout-message strong { color: #101828; font-weight: 700; }

.aom-checkout-footer {
  padding: 0 24px 24px;
  display: flex;
  gap: 12px;
  justify-content: center;
}
.aom-checkout-btn {
  flex: 1;
  max-width: 200px;
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.aom-checkout-btn-primary {
  background: #101828;
  color: #fff;
  box-shadow: 0 1px 2px rgba(16,24,40,0.05);
}
.aom-checkout-btn-primary:hover {
  background: #1d2939;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(16,24,40,0.15);
}
.aom-checkout-btn-danger {
  background: #b42318;
  color: #fff;
}
.aom-checkout-btn-danger:hover {
  background: #912018;
  transform: translateY(-1px);
}
.aom-checkout-btn-secondary {
  background: #f2f4f7;
  color: #344054;
  border: 1px solid #eaecf0;
}
.aom-checkout-btn-secondary:hover {
  background: #eaecf0;
}

.aom-checkout-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #eaecf0;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: #667085;
  transition: all 0.2s;
  z-index: 2;
}
.aom-checkout-close:hover {
  background: #f9fafb;
  color: #101828;
  border-color: #d0d5dd;
  transform: rotate(90deg);
}

/* Hide default AOM notices from Woo error list when popup active */
.woocommerce-error li:has(.aom-notice),
.woocommerce-error li.aom-hidden-notice {
  display: none !important;
}
.woocommerce-NoticeGroup.aom-hide {
  display: none !important;
}

/* Animation for pulse */
@keyframes aom-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}
.aom-shake { animation: aom-shake 0.4s ease; }

/* Responsive */
@media (max-width: 480px) {
  .aom-checkout-popup { padding: 12px; }
  .aom-checkout-modal { border-radius: 16px; max-width: 100%; }
  .aom-checkout-header { padding: 20px 20px 0; }
  .aom-checkout-body { padding: 12px 20px 20px; }
  .aom-checkout-footer { padding: 0 20px 20px; flex-direction: column; }
  .aom-checkout-btn { max-width: 100%; }
  .aom-checkout-icon { width: 56px; height: 56px; font-size: 28px; }
  .aom-checkout-title { font-size: 17px; }
}

/* Old blocked popup support - upgraded */
.aom-blocked-popup {
  position: fixed;
  inset: 0;
  z-index: 9999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  animation: aom-fadeIn 0.3s forwards;
}
@keyframes aom-fadeIn { to { opacity: 1; } }
.aom-blocked-overlay {
  position: absolute;
  inset:0;
  background: rgba(16,24,40,0.65);
  backdrop-filter: blur(10px);
}
.aom-blocked-content {
  position: relative;
  background: #fff;
  border-radius: 20px;
  padding: 32px 24px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 32px 64px rgba(0,0,0,0.3);
  animation: aom-modalPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1;
  border:1px solid #eaecf0;
}
@keyframes aom-modalPop {
  0% { transform: translateY(20px) scale(0.96); opacity:0; }
  100% { transform: translateY(0) scale(1); opacity:1; }
}
.aom-blocked-icon { font-size: 48px; margin-bottom: 16px; animation: aom-icon-pop 0.5s 0.1s both; }
.aom-blocked-content h3 { margin:0 0 12px; color:#b42318; font-size:19px; font-weight:800; letter-spacing:-0.02em; }
.aom-blocked-content p { color:#344054; line-height:1.7; font-size:14px; font-weight:500; }
.aom-blocked-close {
  margin-top: 20px;
  background: #101828;
  color:#fff;
  border:0;
  padding:12px 24px;
  border-radius: 10px;
  cursor:pointer;
  font-weight:700;
  font-size:14px;
  transition: all 0.2s;
  width: 100%;
  max-width: 200px;
}
.aom-blocked-close:hover { background:#1d2939; transform: translateY(-1px); }

/* Checkout field error highlight */
.woocommerce-invalid #billing_phone,
.woocommerce-invalid-required-field #billing_phone {
  border-color: #fda29b !important;
  background: #fef3f2 !important;
  box-shadow: 0 0 0 3px rgba(217,45,32,0.1) !important;
}
