/*
 * Sandpiper Quote Request — Modal & Button Styles
 * Version 2.0.0
 * Matches the TV Sales & Home green brand (#1E6B4A)
 */

/* ── Variables ──────────────────────────────────────────── */
:root {
  --sqr-green:       #1E6B4A;
  --sqr-green-dark:  #165438;
  --sqr-green-light: #E8F5EE;
  --sqr-amber:       #B45309;
  --sqr-red:         #B91C1C;
  --sqr-red-light:   #FEF2F2;
  --sqr-border:      #E5E7EB;
  --sqr-text:        #111827;
  --sqr-muted:       #6B7280;
  --sqr-bg:          #FFFFFF;
  --sqr-surface:     #F9FAFB;
  --sqr-radius:      12px;
  --sqr-shadow:      0 24px 64px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
  --sqr-transition:  0.2s ease;
}

/* ── Overlay ─────────────────────────────────────────────── */
.sqr-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--sqr-transition), visibility var(--sqr-transition);
}
.sqr-modal[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}
.sqr-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  cursor: pointer;
}
body.sqr-modal-open {
  overflow: hidden;
}

/* ── Modal box ───────────────────────────────────────────── */
.sqr-box {
  position: relative;
  background: var(--sqr-bg);
  border-radius: var(--sqr-radius);
  box-shadow: var(--sqr-shadow);
  max-width: 500px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  animation: sqr-slide-up 0.22s ease both;
  scrollbar-width: thin;
}
@keyframes sqr-slide-up {
  from { transform: translateY(18px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* ── Header ──────────────────────────────────────────────── */
.sqr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 18px;
  background: linear-gradient(135deg, var(--sqr-green) 0%, #2D8A60 100%);
  border-radius: var(--sqr-radius) var(--sqr-radius) 0 0;
  color: #fff;
}
.sqr-header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sqr-logo {
  font-size: 28px;
  line-height: 1;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sqr-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}
.sqr-subtitle {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: rgba(255,255,255,0.75);
  line-height: 1.3;
}
.sqr-close {
  background: rgba(255,255,255,0.15);
  border: none;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  padding: 0;
  flex-shrink: 0;
  transition: background var(--sqr-transition);
}
.sqr-close:hover {
  background: rgba(255,255,255,0.3);
}

/* ── Cart preview ────────────────────────────────────────── */
.sqr-cart-preview {
  background: var(--sqr-green-light);
  border-bottom: 1px solid #C6DFD2;
  padding: 14px 24px;
  font-size: 13px;
}
.sqr-cart-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--sqr-green);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sqr-badge {
  background: var(--sqr-green);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  border-radius: 10px;
  padding: 1px 7px;
  line-height: 1.5;
}
.sqr-cart-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sqr-cart-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--sqr-text);
  line-height: 1.4;
}
.sqr-cart-item-name {
  flex: 1;
  font-weight: 600;
}
.sqr-cart-item-qty {
  color: var(--sqr-muted);
  white-space: nowrap;
}
.sqr-cart-item-price {
  font-family: monospace;
  font-weight: 700;
  color: var(--sqr-green);
  white-space: nowrap;
}
.sqr-cart-total {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #C6DFD2;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.sqr-cart-total-label {
  font-weight: 700;
  color: var(--sqr-text);
}
.sqr-cart-total-value {
  font-family: monospace;
  font-weight: 800;
  color: var(--sqr-green);
}

/* ── Form ─────────────────────────────────────────────────── */
.sqr-form {
  padding: 22px 24px 6px;
}
.sqr-row {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}
.sqr-row--2 {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 420px) {
  .sqr-row--2 { grid-template-columns: 1fr; }
}
.sqr-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sqr-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--sqr-text);
  letter-spacing: 0.2px;
}
.sqr-field--required label::after {
  content: " *";
  color: var(--sqr-red);
}
.sqr-field input,
.sqr-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--sqr-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--sqr-text);
  background: var(--sqr-bg);
  transition: border-color var(--sqr-transition), box-shadow var(--sqr-transition);
  box-sizing: border-box;
}
.sqr-field input:focus,
.sqr-field textarea:focus {
  outline: none;
  border-color: var(--sqr-green);
  box-shadow: 0 0 0 3px rgba(30,107,74,0.12);
}
.sqr-field input::placeholder,
.sqr-field textarea::placeholder {
  color: #9CA3AF;
}
.sqr-field textarea {
  resize: vertical;
  min-height: 76px;
  font-family: inherit;
}
.sqr-field.sqr-has-error input,
.sqr-field.sqr-has-error textarea {
  border-color: var(--sqr-red);
}

/* ── Notices ─────────────────────────────────────────────── */
.sqr-notice {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  margin: 12px 24px;
}
.sqr-notice--error {
  background: var(--sqr-red-light);
  border: 1px solid #FECACA;
  color: var(--sqr-red);
}
.sqr-notice--warn {
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  color: var(--sqr-amber);
}
.sqr-notice--warn a {
  color: var(--sqr-amber);
  font-weight: 700;
}

/* ── Actions ─────────────────────────────────────────────── */
.sqr-actions {
  display: flex;
  gap: 10px;
  margin: 18px 0 0;
}
.sqr-submit {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 20px;
  background: var(--sqr-green);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--sqr-transition), transform 0.1s;
  letter-spacing: 0.1px;
}
.sqr-submit:hover:not(:disabled) {
  background: var(--sqr-green-dark);
  transform: translateY(-1px);
}
.sqr-submit:active:not(:disabled) {
  transform: translateY(0);
}
.sqr-submit:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none;
}
.sqr-cancel,
.sqr-btn-secondary {
  padding: 13px 18px;
  background: var(--sqr-surface);
  color: var(--sqr-muted);
  border: 1.5px solid var(--sqr-border);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--sqr-transition);
}
.sqr-cancel:hover,
.sqr-btn-secondary:hover {
  background: var(--sqr-border);
  color: var(--sqr-text);
}

/* Spinner */
@keyframes sqr-rotate { to { transform: rotate(360deg); } }
.sqr-spin { animation: sqr-rotate 0.8s linear infinite; }

/* ── Privacy note & footer padding ─────────────────────────── */
.sqr-privacy {
  font-size: 11px;
  color: var(--sqr-muted);
  text-align: center;
  margin: 14px 0 20px;
  line-height: 1.5;
}
.sqr-privacy a {
  color: var(--sqr-green);
  text-decoration: none;
}
.sqr-privacy a:hover {
  text-decoration: underline;
}

/* ── Success state ───────────────────────────────────────── */
.sqr-success {
  padding: 40px 32px;
  text-align: center;
  animation: sqr-slide-up 0.25s ease both;
}
.sqr-success-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--sqr-green-light);
  color: var(--sqr-green);
  font-size: 28px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.sqr-success h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 800;
  color: var(--sqr-text);
}
.sqr-success p {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--sqr-muted);
  line-height: 1.6;
}

/* ── Trigger button ───────────────────────────────────────── */
.sqr-wrap {
  margin-top: 12px;
}
.sqr-wrap--checkout {
  margin-top: 14px;
}
.sqr-wrap--product,
.sqr-wrap--loop {
  margin-top: 8px;
}

/* Override WooCommerce button base for the trigger */
button.sqr-trigger,
a.sqr-trigger {
  display: inline-flex !important;
  align-items: center !important;
  gap: 7px !important;
  background: #fff !important;
  color: var(--sqr-green) !important;
  border: 2px solid var(--sqr-green) !important;
  border-radius: 8px !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  padding: 11px 20px !important;
  cursor: pointer !important;
  transition: background var(--sqr-transition), color var(--sqr-transition) !important;
  text-decoration: none !important;
  line-height: 1.3 !important;
}
button.sqr-trigger:hover,
a.sqr-trigger:hover {
  background: var(--sqr-green) !important;
  color: #fff !important;
}
.sqr-icon {
  font-size: 15px;
  line-height: 1;
}

/* Loop / archive — make button smaller */
.sqr-wrap--loop button.sqr-trigger {
  font-size: 12.5px !important;
  padding: 8px 14px !important;
  width: 100% !important;
  justify-content: center !important;
}

/* ── Responsive tweaks ───────────────────────────────────── */
@media (max-width: 480px) {
  .sqr-box {
    border-radius: 16px 16px 0 0;
    max-height: 95vh;
  }
  .sqr-modal {
    align-items: flex-end;
    padding: 0;
  }
  .sqr-header {
    border-radius: 16px 16px 0 0;
  }
  .sqr-form {
    padding: 18px 18px 6px;
  }
  .sqr-notice {
    margin: 10px 18px;
  }
}
