/**
 * Conmaret Enterprise Proforma Invoice Generator Stylesheet
 *
 * Scoped styles for:
 * 1. Cart & Checkout Proforma Action Button
 * 2. Customer Metadata Capture Modal
 * 3. A4 Localized Print/PDF Viewport Styles
 *
 * @package Conmaret_Commerce_Suite
 * @version 3.0.2
 */

/* 1. Proforma Action Button (Slate-900 / High-Contrast Red Hover) */
.conmaret-download-proforma-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100% !important;
  margin-top: 10px !important;
  margin-bottom: 6px !important;
  padding: 13px 20px !important;
  background-color: #0f172a !important;
  color: #ffffff !important;
  border: 1.5px solid #0f172a !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1.4 !important;
  text-align: center !important;
  text-decoration: none !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-sizing: border-box !important;
}

.conmaret-download-proforma-btn:hover,
.conmaret-download-proforma-btn:focus {
  background-color: #b91c1c !important;
  color: #ffffff !important;
  border-color: #991b1b !important;
  box-shadow: 0 4px 14px rgba(185, 28, 28, 0.35) !important;
  text-decoration: none !important;
}

.conmaret-download-proforma-btn:active {
  transform: translateY(1px) !important;
}

.wc-block-checkout__actions_row > .conmaret-checkout-block-proforma-btn,
.wc-block-checkout__actions > .conmaret-checkout-block-proforma-btn {
  flex: 1 1 100% !important;
  margin: 0 8px 0 0 !important;
  min-height: 48px !important;
}

@media (max-width: 600px) {
  .wc-block-checkout__actions_row > .conmaret-checkout-block-proforma-btn,
  .wc-block-checkout__actions > .conmaret-checkout-block-proforma-btn {
    flex-basis: 100% !important;
    margin: 0 0 10px !important;
  }

  .wc-block-checkout__actions_row {
    flex-wrap: wrap !important;
  }
}

/* 2. Proforma Modal Overlay & Dialog */
.conmaret-proforma-modal-overlay {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(15, 23, 42, 0.7) !important;
  backdrop-filter: blur(4px) !important;
  -webkit-backdrop-filter: blur(4px) !important;
  z-index: 999999 !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
  box-sizing: border-box !important;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.conmaret-proforma-modal-overlay.is-active {
  display: flex !important;
  opacity: 1 !important;
}

.conmaret-proforma-modal-dialog {
  background: #ffffff !important;
  width: 100% !important;
  max-width: 480px !important;
  border-radius: 12px !important;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.35) !important;
  border: 1px solid #e2e8f0 !important;
  overflow: hidden !important;
  transform: scale(0.95);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-sizing: border-box !important;
}

.conmaret-proforma-modal-overlay.is-active .conmaret-proforma-modal-dialog {
  transform: scale(1) !important;
}

/* Modal Header */
.conmaret-proforma-modal-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 16px 20px !important;
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

.conmaret-proforma-modal-title {
  margin: 0 !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.conmaret-proforma-modal-close {
  background: transparent !important;
  border: none !important;
  font-size: 24px !important;
  line-height: 1 !important;
  color: #94a3b8 !important;
  cursor: pointer !important;
  padding: 4px !important;
  margin: -4px !important;
  transition: color 0.15s ease !important;
}

.conmaret-proforma-modal-close:hover {
  color: #ef4444 !important;
}

/* Modal Body & Form */
.conmaret-proforma-modal-body {
  padding: 20px !important;
  box-sizing: border-box !important;
}

.conmaret-proforma-modal-note {
  font-size: 12.5px !important;
  line-height: 1.4 !important;
  color: #64748b !important;
  background: #f1f5f9 !important;
  padding: 10px 14px !important;
  border-radius: 6px !important;
  margin-bottom: 16px !important;
  border-left: 3px solid #b91c1c !important;
}

.conmaret-proforma-form-group {
  margin-bottom: 14px !important;
}

.conmaret-proforma-form-group label {
  display: block !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #334155 !important;
  margin-bottom: 5px !important;
}

.conmaret-proforma-form-group label .required-star {
  color: #b91c1c !important;
}

.conmaret-proforma-form-group input {
  width: 100% !important;
  height: 42px !important;
  padding: 0 12px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  color: #0f172a !important;
  background: #ffffff !important;
  box-sizing: border-box !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
}

.conmaret-proforma-form-group input:focus {
  outline: none !important;
  border-color: #b91c1c !important;
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.15) !important;
}

/* Modal Footer & Buttons */
.conmaret-proforma-modal-footer {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  margin-top: 20px !important;
}

.conmaret-proforma-btn-cancel {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
  padding: 10px 18px !important;
  border-radius: 6px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: background-color 0.15s ease !important;
}

.conmaret-proforma-btn-cancel:hover {
  background: #e2e8f0 !important;
}

.conmaret-proforma-btn-submit {
  background: #b91c1c !important;
  color: #ffffff !important;
  border: none !important;
  padding: 10px 22px !important;
  border-radius: 6px !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  transition: background-color 0.15s ease, box-shadow 0.15s ease !important;
}

.conmaret-proforma-btn-submit:hover {
  background: #991b1b !important;
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.3) !important;
}

.conmaret-proforma-btn-submit:disabled {
  opacity: 0.65 !important;
  cursor: not-allowed !important;
}

/* Spinner */
.conmaret-proforma-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: conmaret-proforma-spin 0.7s linear infinite;
}

@keyframes conmaret-proforma-spin {
  to { transform: rotate(360deg); }
}

/* Hidden Print Frame */
#conmaret-proforma-print-frame {
  position: absolute !important;
  top: -9999px !important;
  left: -9999px !important;
  width: 0 !important;
  height: 0 !important;
  border: 0 !important;
}

/* 3. A4 Localized Print/PDF Viewport & Media Rules */
@page {
  size: A4 portrait;
  margin: 12mm 15mm;
}

@media print {
  html,
  body {
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: auto !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Isolation: Hide all non-proforma surrounding DOM elements */
  header,
  footer,
  nav,
  aside,
  #wpadminbar,
  .whb-header,
  .woodmart-header,
  .footer-container,
  .main-footer,
  .conmaret-header,
  .conmaret-mobile-bar,
  .woodmart-toolbar,
  .woocommerce-cart-form,
  .cart-collaterals,
  .woocommerce-checkout,
  .woocommerce-notices-wrapper,
  .conmaret-download-proforma-btn,
  .conmaret-proforma-modal-overlay,
  #conmaret-proforma-modal,
  .page-title,
  .breadcrumbs {
    display: none !important;
  }

  /* Proforma Container Print Formatting */
  .proforma-container {
    display: block !important;
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: #ffffff !important;
    box-shadow: none !important;
    border: none !important;
    visibility: visible !important;
  }

  .proforma-container * {
    visibility: visible !important;
  }
}
