/**
 * 4K CRM Standard Storefront Forms & Modals
 *
 * Dark Premium Theme Design System:
 * - Deep navy container with amber/yellow headers
 * - Independent Green WhatsApp CTA
 * - Standardized Country Selector & E.164 phone input
 * - High-contrast yellow/orange primary submit CTA
 * - Isolated scoped styles to prevent theme interference
 */

/* Backdrop Overlay */
.fourk-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(11, 17, 32, 0.85);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 999998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

.fourk-modal-backdrop.fourk-modal-open {
  opacity: 1;
  visibility: visible;
}

/* Modal Dialog Container */
.fourk-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  background: #0b1120;
  border: 1px solid #1e293b;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.05);
  color: #f8fafc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.fourk-modal-backdrop.fourk-modal-open .fourk-modal-dialog {
  transform: translateY(0) scale(1);
}

/* Modal Close Button [ X ] */
.fourk-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
  z-index: 10;
}

.fourk-modal-close:hover,
.fourk-modal-close:focus {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  outline: none;
}

/* Modal Content Padding */
.fourk-modal-content {
  padding: 28px 24px 24px 24px;
}

/* Modal Header Typography */
.fourk-modal-title {
  margin: 0 0 6px 0;
  font-size: 20px;
  font-weight: 800;
  color: #f59e0b;
  text-align: center;
  line-height: 1.3;
  letter-spacing: -0.2px;
}

.fourk-modal-subtitle {
  margin: 0 0 20px 0;
  font-size: 13px;
  color: #94a3b8;
  text-align: center;
  line-height: 1.4;
}

/* Selected Plan Card */
.fourk-selected-plan-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 20px;
}

.fourk-plan-card-tag {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  font-weight: 700;
}

.fourk-plan-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  gap: 12px;
}

.fourk-plan-card-name {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.fourk-plan-card-price {
  font-size: 16px;
  font-weight: 800;
  color: #f59e0b;
  white-space: nowrap;
}

/* 1. GREEN "CHAT ON WHATSAPP" BUTTON (100% UNINTEGRATED FROM CRM) */
.fourk-whatsapp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  background: #25d366;
  color: #ffffff !important;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 15px;
  padding: 13px 20px;
  border-radius: 10px;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
  border: none;
  cursor: pointer;
}

.fourk-whatsapp-btn:hover {
  background: #20bd5a;
  color: #ffffff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.45);
}

.fourk-whatsapp-btn:active {
  transform: translateY(0);
}

.fourk-whatsapp-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex-shrink: 0;
}

/* Divider: -------------- OR -------------- */
.fourk-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0;
}

.fourk-divider::before,
.fourk-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #334155;
}

.fourk-divider span {
  padding: 0 14px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* 2. FORM ELEMENTS */
.fourk-form-group {
  margin-bottom: 16px;
}

.fourk-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 6px;
}

.fourk-required-star {
  color: #ef4444;
  margin-left: 2px;
}

/* Phone Input with Country Selector Group */
.fourk-phone-group {
  display: flex;
  gap: 8px;
}

.fourk-country-select {
  width: 135px;
  flex-shrink: 0;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 8px;
  color: #ffffff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.fourk-country-select:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.fourk-phone-input,
.fourk-email-input {
  width: 100%;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 14px;
  color: #ffffff;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.fourk-phone-input::placeholder,
.fourk-email-input::placeholder {
  color: #64748b;
}

.fourk-phone-input:focus,
.fourk-email-input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.fourk-input-helper {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

/* Large Yellow/Orange Primary Submit CTA */
.fourk-submit-btn {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a;
  font-weight: 800;
  font-size: 15px;
  padding: 13px 20px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  box-sizing: border-box;
  margin-top: 4px;
}

.fourk-submit-btn:hover:not(:disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.45);
}

.fourk-submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.fourk-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  filter: grayscale(0.2);
}

/* Inline Messages / Alerts */
.fourk-msg-banner {
  display: none;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.4;
  text-align: center;
}

.fourk-msg-banner.fourk-msg-success {
  display: block;
  background: rgba(6, 78, 59, 0.85);
  border: 1px solid #059669;
  color: #6ee7b7;
}

.fourk-msg-banner.fourk-msg-error {
  display: block;
  background: rgba(69, 10, 10, 0.85);
  border: 1px solid #dc2626;
  color: #fca5a5;
}

.fourk-reference-badge {
  display: inline-block;
  margin-top: 6px;
  font-family: monospace;
  font-weight: 700;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  color: #a7f3d0;
}

/* Mobile Responsive Optimization */
@media (max-width: 480px) {
  .fourk-modal-dialog {
    max-width: 100%;
    border-radius: 12px;
  }
  .fourk-modal-content {
    padding: 24px 16px 20px 16px;
  }
  .fourk-modal-title {
    font-size: 18px;
  }
  .fourk-country-select {
    width: 110px;
    font-size: 12px;
  }
  .fourk-whatsapp-btn,
  .fourk-submit-btn {
    font-size: 14px;
    padding: 12px 16px;
  }
}
