/* ================================
   Global font / box model in modal
   ================================ */

.contract-modal,
.contract-modal * {
  box-sizing: border-box;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif !important;
}

/* ================================
   Backdrop & modal frame
   ================================ */

.contract-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  display: none;
  /* shown via JS */
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.contract-modal {
  background: #ffffff;
  border-radius: 12px;
  max-width: 940px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.5);
  overflow: hidden;
  font-size: 0.9rem;
  color: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ================================
   Header (Dark & Elegant)
   ================================ */

.contract-modal-header {
  background: #111d35;
  color: #ffffff;
  padding: 24px 28px 90px;
  /* Even more depth for overlap */
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.contract-modal-header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.contract-ref-container {
  font-size: 0.9rem;
  opacity: 0.6;
  font-weight: 500;
}

.contract-modal-header .contract-modal-close {
  background: rgba(255, 255, 255, 0.1) !important;
  color: #ffffff !important;
  border: none !important;
  width: 32px !important;
  height: 32px !important;
  border-radius: 50% !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem !important;
  transition: background 0.2s;
  cursor: pointer;
}

.contract-modal-header .contract-modal-close:hover {
  background: rgba(255, 255, 255, 0.2) !important;
}

.contract-modal-header-main h2 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ================================
   Summary Strip (Modern Cards & Overlap)
   ================================ */

.contract-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: transparent;
  /* Transparent so it shows header behind */
  padding: 0 28px 24px;
  /* Padding bottom, none top */
  gap: 20px;
  margin-top: -65px;
  /* Stronger overlap */
  position: relative;
  z-index: 10;
}

.summary-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s, box-shadow 0.2s;
  min-height: 100px;
  /* Ensure consistent height */
}

.summary-card-vertical {
  flex-direction: column;
  align-items: flex-start;
}

.summary-card-vertical .summary-card-content {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.summary-card-vertical .summary-value {
  margin-top: auto;
  text-align: center;
  width: 100%;
}

.summary-card-vertical .summary-note {
  margin-bottom: auto;
  text-align: center;
  width: 100%;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.summary-card-icon {
  background: #f0f7ff;
  color: #3b82f6;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.summary-card-icon .dashicons {
  font-size: 20px;
  width: 20px;
  height: 20px;
}

.summary-card-content {
  flex: 1;
}

.summary-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.summary-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.summary-value-price {
  font-size: 1.15rem;
  color: #1e293b;
}

.summary-note {
  margin-top: 4px;
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

/* ================================
   Highlight Section (Premium Blue Box)
   ================================ */

.contract-highlight {
  background: #f0f9ff;
  border-bottom: 1px solid #e0f2fe;
}

.contract-inner {
  padding: 16px 28px;
}

.highlights-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0c4a6e;
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.highlights-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #bae6fd;
}

.highlight-main {
  font-size: 0.95rem;
  line-height: 1.6;
  color: #334155;
  margin-bottom: 12px;
}

.highlight-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.highlight-list li {
  font-size: 0.85rem;
  color: #0369a1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #e0f2fe;
  padding: 4px 12px;
  border-radius: 9999px;
  font-weight: 500;
}

/* ================================
   Scrollable contract body
   ================================ */

.contract-body {
  padding: 24px 24px 30px;
  font-size: 0.85rem;
  line-height: 1.45;
  color: #111827;
  overflow-y: auto;
  flex: 1 1 auto;
}

/* Default: force contract text left-aligned (defensive vs theme CSS) */
.contract-body,
.contract-body p,
.contract-body h3,
.contract-body h4 {
  text-align: left !important;
}

.contract-body h3 {
  font-size: 0.95rem;
  margin: 18px 0 6px;
  font-weight: 600;
}

.contract-body h4 {
  font-size: 0.9rem;
  margin: 14px 0 4px;
  font-weight: 600;
}

.contract-body p {
  margin: 0 0 10px;
}

.contract-body a {
  color: #0f766e;
  text-decoration: underline;
}

/* Centre and emphasise the "Contract Information" heading */
.contract-body h3.contract-heading-center {
  text-align: center !important;
  font-size: 1.15rem;
  /* slightly larger */
  font-weight: 600;
  margin: 28px 0 20px;
  /* more space above & below */
}

/* Right-aligned address / reference block */
.contract-body .contract-address-block {
  margin-left: auto;
  width: fit-content;
  text-align: right !important;
  margin-top: 1rem;
  /* space above address */
  margin-bottom: 1.75rem;
  /* space below postcode / block */
}

.contract-body .contract-address-block p {
  margin: 0 0 4px;
  text-align: right !important;
}

/* Extra space under the postcode line (first <p> in the block) */
.contract-body .contract-address-block p:first-of-type {
  margin-bottom: 0.9rem;
}

/* ================================
   Modal footer buttons
   ================================ */

.contract-modal-footer {
  border-top: 1px solid #e5e7eb;
  padding: 12px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f9fafb;
}

/* Base button styles */
.contract-btn-secondary,
.contract-btn-primary {
  border-radius: 9999px;
  padding: 10px 22px;
  font-size: 0.85rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  font-family: inherit !important;
}

.contract-btn-primary.is-disabled,
.contract-btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Footer "Close" button */
.contract-modal-footer .contract-btn-secondary {
  background: #e5e7eb !important;
  color: #111827 !important;
  box-shadow: none !important;
}

.contract-modal-footer .contract-btn-secondary:hover {
  background: #d1d5db !important;
}

/* Footer primary button */
.contract-modal-footer .contract-btn-primary {
  background: #059669 !important;
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.45);
}

.contract-modal-footer .contract-btn-primary:hover {
  background: #047857 !important;
}

/* ================================
   Checkout trigger button
   ================================ */

.wildanet-contract-wrapper {
  margin: 12px 0 18px;
  display: flex;
  justify-content: center;
  /* centre above Place Order */
}

/* Green pill "View your contract" button */
.wildanet-contract-wrapper .demo-btn {
  display: inline-block;
  padding: 10px 26px !important;
  border-radius: 9999px !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  border: none !important;
  cursor: pointer;
  background: #059669 !important;
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(5, 150, 105, 0.45) !important;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif !important;
}

.wildanet-contract-wrapper .demo-btn:hover {
  background: #047857 !important;
}

/* ================================
   Responsive tweaks
   ================================ */

@media (max-width: 768px) {
  .contract-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contract-modal {
    max-width: 100%;
    border-radius: 0;
  }

  .contract-body {
    padding: 18px 16px 24px;
  }
}

/* Final override: make header close icon simple, not red */
.contract-modal-header .contract-modal-close {
  background: transparent !important;
  color: #f9fafb !important;
  border: none !important;
  box-shadow: none !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  margin-left: 12px;
  border-radius: 0 !important;
  font-size: 1.1rem !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}

.contract-modal-header .contract-modal-close:hover {
  background: transparent !important;
  color: #e5e7eb !important;
}

/* Render billing/service addresses with line breaks */
#contract-billing-address {
  display: block;
  font-size: 0.8rem;
  color: #0f172a;
  margin-top: -8px;
  margin-bottom: 12px;
}

#contract-service-address {
  white-space: normal;
}

/* Page break for PDF generation */
.pdf-page-break {
  page-break-before: always !important;
  break-before: page !important;
}