/* =============================================================================
   WooCommerce B2B – Bulk Quote Manager  |  Frontend styles
   Version: 1.0.0
   Author:  eMarketing Cyprus · Saltpixel LTD (https://www.emarketing.cy)
   ============================================================================= */

/* ── CSS Custom Properties ───────────────────────────────────────────────── */
:root {
  --b2b-primary:       #2563eb;
  --b2b-primary-hover: #1d4ed8;
  --b2b-primary-light: #eff6ff;
  --b2b-success:       #16a34a;
  --b2b-error:         #dc2626;
  --b2b-error-bg:      #fef2f2;
  --b2b-text:          #0f172a;
  --b2b-text-muted:    #64748b;
  --b2b-border:        #e2e8f0;
  --b2b-border-focus:  #2563eb;
  --b2b-bg:            #ffffff;
  --b2b-bg-subtle:     #f8fafc;
  --b2b-radius:        10px;
  --b2b-radius-sm:     6px;
  --b2b-shadow:        0 20px 60px rgba(15, 23, 42, .18), 0 4px 16px rgba(15, 23, 42, .1);
  --b2b-transition:    .2s ease;
  --b2b-font:          -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Size tag colours — overridable via admin Design & Colors tab */
  --b2b-size-bg:       #eff6ff;
  --b2b-size-border:   #2563eb;
  --b2b-size-text:     #1d4ed8;
}

/* ── Quote Button ─────────────────────────────────────────────────────────── */
.wc-b2b-open-modal {
  display:         inline-flex;
  align-items:     center;
  gap:             8px;
  margin-top:      10px;
  padding:         12px 22px;
  width:           100%;
  justify-content: center;
  background:      transparent;
  color:           var(--b2b-primary);
  border:          2px solid var(--b2b-primary);
  border-radius:   var(--b2b-radius-sm);
  font-family:     var(--b2b-font);
  font-size:       14px;
  font-weight:     600;
  letter-spacing:  .3px;
  cursor:          pointer;
  transition:      background var(--b2b-transition), color var(--b2b-transition), transform .15s ease;
  text-transform:  none;
  line-height:     1.4;
}

.wc-b2b-open-modal:hover,
.wc-b2b-open-modal:focus-visible {
  background: var(--b2b-primary);
  color:      #fff;
  outline:    none;
}

.wc-b2b-open-modal:active {
  transform: scale(.98);
}

.wc-b2b-btn-icon {
  flex-shrink: 0;
  width:       16px;
  height:      16px;
}

/* ── Modal overlay ────────────────────────────────────────────────────────── */
.wc-b2b-modal {
  position:   fixed;
  inset:      0;
  z-index:    99999;
  display:    flex;
  align-items: center;
  justify-content: center;
  padding:    16px;
}

.wc-b2b-modal[hidden] {
  display: none;
}

.wc-b2b-modal__backdrop {
  position:   absolute;
  inset:      0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation:  b2bFadeIn var(--b2b-transition) both;
}

/* ── Dialog card ─────────────────────────────────────────────────────────── */
.wc-b2b-modal__dialog {
  position:        relative;
  z-index:         1;
  width:           100%;
  max-width:       520px;
  max-height:      92vh;
  overflow-y:      auto;
  background:      var(--b2b-bg);
  border-radius:   16px;
  box-shadow:      var(--b2b-shadow);
  padding:         28px 28px 24px;
  animation:       b2bSlideUp .25s cubic-bezier(.22,.68,0,1.2) both;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--b2b-border) transparent;
}

/* ── Close button ────────────────────────────────────────────────────────── */
.wc-b2b-modal__close {
  position:   absolute;
  top:        16px;
  right:      16px;
  width:      36px;
  height:     36px;
  display:    flex;
  align-items: center;
  justify-content: center;
  background: var(--b2b-bg-subtle);
  border:     1px solid var(--b2b-border);
  border-radius: 50%;
  color:      var(--b2b-text-muted);
  cursor:     pointer;
  transition: background var(--b2b-transition), color var(--b2b-transition);
  line-height: 1;
  padding:    0;
}

.wc-b2b-modal__close:hover,
.wc-b2b-modal__close:focus-visible {
  background: #fee2e2;
  color:      var(--b2b-error);
  border-color: #fca5a5;
  outline:    none;
}

/* ── Progress steps ──────────────────────────────────────────────────────── */
.wc-b2b-progress {
  display:        flex;
  align-items:    center;
  gap:            0;
  margin-bottom:  20px;
  margin-right:   48px;
}

.wc-b2b-progress__step {
  display:     flex;
  align-items: center;
  gap:         8px;
  flex:        0 0 auto;
}

.wc-b2b-progress__num {
  width:           28px;
  height:          28px;
  border-radius:   50%;
  display:         flex;
  align-items:     center;
  justify-content: center;
  font-size:       13px;
  font-weight:     700;
  background:      var(--b2b-border);
  color:           var(--b2b-text-muted);
  transition:      background var(--b2b-transition), color var(--b2b-transition);
  flex-shrink:     0;
}

.wc-b2b-progress__lbl {
  font-size:   12px;
  font-weight: 600;
  color:       var(--b2b-text-muted);
  white-space: nowrap;
  transition:  color var(--b2b-transition);
}

.wc-b2b-progress__step--active .wc-b2b-progress__num {
  background: var(--b2b-primary);
  color:      #fff;
}

.wc-b2b-progress__step--active .wc-b2b-progress__lbl {
  color: var(--b2b-primary);
}

.wc-b2b-progress__step--done .wc-b2b-progress__num {
  background: var(--b2b-success);
  color:      #fff;
}

.wc-b2b-progress__line {
  flex:        1;
  height:      2px;
  background:  var(--b2b-border);
  margin:      0 10px;
  transition:  background .3s ease;
}

.wc-b2b-progress__line--done {
  background: var(--b2b-success);
}

/* ── Product banner ──────────────────────────────────────────────────────── */
.wc-b2b-product-banner {
  display:      flex;
  align-items:  center;
  gap:          6px;
  background:   var(--b2b-primary-light);
  border-left:  3px solid var(--b2b-primary);
  border-radius: 0 var(--b2b-radius-sm) var(--b2b-radius-sm) 0;
  padding:      8px 12px;
  margin-bottom: 20px;
  font-size:    13px;
  color:        var(--b2b-text-muted);
}

.wc-b2b-product-banner svg {
  flex-shrink: 0;
  color: var(--b2b-primary);
}

.wc-b2b-product-banner strong {
  color: var(--b2b-primary);
  font-weight: 600;
}

/* ── Step panel ──────────────────────────────────────────────────────────── */
.wc-b2b-step__header {
  margin-bottom: 20px;
}

.wc-b2b-step__title {
  margin:      0 0 4px;
  font-size:   20px;
  font-weight: 700;
  color:       var(--b2b-text);
  line-height: 1.25;
  font-family: var(--b2b-font);
}

.wc-b2b-step__subtitle {
  margin:    0;
  font-size: 14px;
  color:     var(--b2b-text-muted);
}

/* ── Form fields ─────────────────────────────────────────────────────────── */
.wc-b2b-fields {
  display:        flex;
  flex-direction: column;
  gap:            14px;
}

.wc-b2b-field {
  display:        flex;
  flex-direction: column;
  gap:            5px;
}

.wc-b2b-label {
  font-size:   13px;
  font-weight: 600;
  color:       var(--b2b-text);
  display:     flex;
  align-items: center;
  gap:         4px;
}

.wc-b2b-required {
  color:       var(--b2b-error);
  font-size:   14px;
  line-height: 1;
}

.wc-b2b-optional {
  font-size:   11px;
  font-weight: 400;
  color:       var(--b2b-text-muted);
}

.wc-b2b-input {
  width:         100%;
  padding:       10px 14px;
  border:        1.5px solid var(--b2b-border);
  border-radius: var(--b2b-radius-sm);
  font-size:     15px;
  font-family:   var(--b2b-font);
  color:         var(--b2b-text);
  background:    #fff;
  transition:    border-color var(--b2b-transition), box-shadow var(--b2b-transition);
  box-sizing:    border-box;
  appearance:    none;
  -webkit-appearance: none;
  line-height:   1.5;
}

.wc-b2b-input:focus {
  outline:      none;
  border-color: var(--b2b-border-focus);
  box-shadow:   0 0 0 3px rgba(37, 99, 235, .15);
}

.wc-b2b-input.wc-b2b-input--error {
  border-color: var(--b2b-error);
  background:   var(--b2b-error-bg);
}

.wc-b2b-input.wc-b2b-input--error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .15);
}

.wc-b2b-textarea {
  resize:     vertical;
  min-height: 80px;
}

select.wc-b2b-input {
  background-image:    url("data:image/svg+xml,%3Csvg width='12' height='7' viewBox='0 0 12 7' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2364748b' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat:   no-repeat;
  background-position: right 12px center;
  padding-right:       36px;
  cursor:              pointer;
}

/* Error message */
.wc-b2b-error {
  font-size:  12px;
  color:      var(--b2b-error);
  font-weight: 500;
  display:    flex;
  align-items: center;
  gap:        4px;
  margin-top: 2px;
}

.wc-b2b-error[hidden] { display: none; }

/* ── GDPR ────────────────────────────────────────────────────────────────── */
.wc-b2b-field--gdpr {
  background:    var(--b2b-bg-subtle);
  border:        1px solid var(--b2b-border);
  border-radius: var(--b2b-radius-sm);
  padding:       12px 14px;
  margin-top:    4px;
}

.wc-b2b-gdpr-label {
  display:     flex;
  align-items: flex-start;
  gap:         10px;
  cursor:      pointer;
}

.wc-b2b-gdpr-label input[type="checkbox"] {
  width:        16px;
  height:       16px;
  margin-top:   2px;
  flex-shrink:  0;
  accent-color: var(--b2b-primary);
  cursor:       pointer;
}

.wc-b2b-gdpr-label span {
  font-size:   13px;
  color:       var(--b2b-text-muted);
  line-height: 1.5;
}

.wc-b2b-gdpr-label a {
  color:           var(--b2b-primary);
  text-decoration: underline;
}

/* ── Navigation buttons ──────────────────────────────────────────────────── */
.wc-b2b-nav {
  display:         flex;
  align-items:     center;
  gap:             10px;
  margin-top:      20px;
  justify-content: flex-end;
}

.wc-b2b-btn {
  display:         inline-flex;
  align-items:     center;
  gap:             6px;
  padding:         11px 22px;
  border-radius:   var(--b2b-radius-sm);
  font-family:     var(--b2b-font);
  font-size:       14px;
  font-weight:     600;
  cursor:          pointer;
  transition:      background var(--b2b-transition), color var(--b2b-transition), border-color var(--b2b-transition), transform .1s ease;
  text-decoration: none;
  line-height:     1.4;
  white-space:     nowrap;
}

.wc-b2b-btn[hidden] { display: none; }

.wc-b2b-btn--primary {
  background: var(--b2b-primary);
  color:      #fff;
  border:     2px solid var(--b2b-primary);
}

.wc-b2b-btn--primary:hover,
.wc-b2b-btn--primary:focus-visible {
  background:   var(--b2b-primary-hover);
  border-color: var(--b2b-primary-hover);
  outline:      none;
}

.wc-b2b-btn--primary:active {
  transform: scale(.97);
}

.wc-b2b-btn--primary:disabled {
  opacity:  .65;
  cursor:   not-allowed;
  transform: none;
}

.wc-b2b-btn--ghost {
  background: transparent;
  color:      var(--b2b-text-muted);
  border:     2px solid var(--b2b-border);
}

.wc-b2b-btn--ghost:hover,
.wc-b2b-btn--ghost:focus-visible {
  background:   var(--b2b-bg-subtle);
  border-color: #94a3b8;
  color:        var(--b2b-text);
  outline:      none;
}

/* Submit spinner */
.wc-b2b-btn__spinner {
  animation: b2bSpin .7s linear infinite;
}

.wc-b2b-btn__spinner[hidden] { display: none; }

/* Global error */
.wc-b2b-global-error {
  margin-top:    12px;
  padding:       10px 14px;
  background:    var(--b2b-error-bg);
  border:        1px solid #fca5a5;
  border-radius: var(--b2b-radius-sm);
  font-size:     13px;
  color:         var(--b2b-error);
  font-weight:   500;
}

.wc-b2b-global-error[hidden] { display: none; }

/* ── Success state ───────────────────────────────────────────────────────── */
.wc-b2b-success {
  text-align: center;
  padding:    12px 0 4px;
  animation:  b2bFadeIn .3s ease both;
}

.wc-b2b-success[hidden] { display: none; }

.wc-b2b-success__icon {
  color:         var(--b2b-success);
  margin-bottom: 16px;
  animation:     b2bBounceIn .5s cubic-bezier(.22,.68,0,1.3) both;
}

.wc-b2b-success__title {
  font-size:     20px;
  font-weight:   700;
  color:         var(--b2b-text);
  margin:        0 0 10px;
  font-family:   var(--b2b-font);
}

.wc-b2b-success__message {
  font-size:     15px;
  color:         var(--b2b-text-muted);
  margin:        0 0 24px;
  line-height:   1.6;
}

/* ── Step transitions ────────────────────────────────────────────────────── */
.wc-b2b-step {
  animation: b2bFadeInRight .22s ease both;
}

.wc-b2b-step[hidden] { display: none; }

.wc-b2b-step--exit {
  animation: b2bFadeOutLeft .18s ease both;
}

/* ── Animations ──────────────────────────────────────────────────────────── */
@keyframes b2bFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes b2bSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes b2bFadeInRight {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes b2bFadeOutLeft {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-16px); }
}

@keyframes b2bBounceIn {
  0%   { transform: scale(0); opacity: 0; }
  70%  { transform: scale(1.1); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes b2bSpin {
  to { transform: rotate(360deg); }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .wc-b2b-modal__dialog {
    padding:        20px 18px 18px;
    border-radius:  12px;
    max-height:     95vh;
  }

  .wc-b2b-step__title {
    font-size: 18px;
  }

  .wc-b2b-nav {
    flex-wrap: wrap;
  }

  .wc-b2b-btn {
    flex: 1;
    justify-content: center;
  }

  .wc-b2b-progress__lbl {
    display: none;
  }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .wc-b2b-modal__backdrop,
  .wc-b2b-modal__dialog,
  .wc-b2b-step,
  .wc-b2b-success,
  .wc-b2b-success__icon {
    animation: none;
  }
}

/* =============================================================================
   Size tags — used in modal, shortcodes, and product cards
   ============================================================================= */

.wc-b2b-size-tag {
  display:        inline-flex;
  align-items:    center;
  padding:        3px 10px;
  border-radius:  20px;
  border:         1.5px solid var(--b2b-size-border);
  color:          var(--b2b-size-text);
  font-size:      12px;
  font-weight:    600;
  font-family:    var(--b2b-font);
  white-space:    nowrap;
  letter-spacing: .2px;
  line-height:    1.4;
  background:     var(--b2b-size-bg);
  transition:     background var(--b2b-transition), color var(--b2b-transition);
}

/* Standalone .wc-b2b-size-tags wrapper (shortcodes + modal) */
.wc-b2b-size-tags {
  display:   flex;
  flex-wrap: wrap;
  gap:       6px;
}

/* ── Sizes banner inside modal ── */
.wc-b2b-sizes-banner {
  display:       flex;
  align-items:   center;
  flex-wrap:     wrap;
  gap:           8px;
  background:    #f0fdf4;
  border-left:   3px solid #16a34a;
  border-radius: 0 var(--b2b-radius-sm) var(--b2b-radius-sm) 0;
  padding:       8px 12px;
  margin-bottom: 12px;
  font-size:     13px;
}

.wc-b2b-sizes-banner[hidden] { display: none; }

.wc-b2b-sizes-banner__label {
  color:       #15803d;
  font-weight: 600;
  white-space: nowrap;
}

.wc-b2b-sizes-banner .wc-b2b-size-tag {
  border-color: #16a34a;
  color:        #15803d;
  background:   #dcfce7;
}

/* ── Files banner inside modal ── */
.wc-b2b-files-banner {
  background:    var(--b2b-bg-subtle);
  border:        1px solid var(--b2b-border);
  border-radius: var(--b2b-radius-sm);
  padding:       10px 12px;
  margin-bottom: 12px;
}

.wc-b2b-files-banner[hidden] { display: none; }

.wc-b2b-files-banner__label {
  display:       block;
  font-size:     11px;
  font-weight:   700;
  color:         var(--b2b-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

/* =============================================================================
   File list — shared by shortcode-files, shortcode-card, and modal files banner
   ============================================================================= */

.wc-b2b-files__list {
  list-style: none;
  margin:     0;
  padding:    0;
  display:    flex;
  flex-direction: column;
  gap:        4px;
}

.wc-b2b-files__link {
  display:         inline-flex;
  align-items:     center;
  gap:             6px;
  font-size:       13px;
  font-weight:     500;
  color:           var(--b2b-primary);
  text-decoration: none;
  padding:         4px 8px;
  border-radius:   var(--b2b-radius-sm);
  transition:      background var(--b2b-transition);
}

.wc-b2b-files__link:hover {
  background:      var(--b2b-primary-light);
  text-decoration: none;
}

.wc-b2b-file-icon {
  width:       14px;
  height:      14px;
  flex-shrink: 0;
  color:       var(--b2b-text-muted);
}

.wc-b2b-file-icon--pdf { color: #dc2626; }
.wc-b2b-file-icon--xls { color: #16a34a; }
.wc-b2b-file-icon--doc { color: #2563eb; }

.wc-b2b-files__name { flex: 1; }

.wc-b2b-files__ext {
  font-size:     10px;
  font-weight:   700;
  text-transform: uppercase;
  background:    var(--b2b-border);
  color:         var(--b2b-text-muted);
  padding:       1px 5px;
  border-radius: 3px;
  letter-spacing: .4px;
}

.wc-b2b-files__dl-icon {
  color:       var(--b2b-text-muted);
  flex-shrink: 0;
  opacity:     .6;
}

/* =============================================================================
   [b2b_sizes] shortcode standalone display modes
   ============================================================================= */

.wc-b2b-sizes {
  display:   flex;
  flex-wrap: wrap;
  align-items: center;
  gap:       8px;
  margin:    8px 0;
}

.wc-b2b-sizes__label {
  font-size:   13px;
  font-weight: 600;
  color:       var(--b2b-text-muted);
  white-space: nowrap;
}

.wc-b2b-sizes--list .wc-b2b-sizes__list,
.wc-b2b-sizes--list .wc-b2b-sizes__label {
  display: block;
  margin:  0 0 6px;
}

.wc-b2b-sizes__list {
  list-style: disc;
  margin:     0;
  padding:    0 0 0 18px;
}

.wc-b2b-sizes__item { font-size: 14px; color: var(--b2b-text); }

.wc-b2b-sizes__inline { font-size: 14px; color: var(--b2b-text); }

/* =============================================================================
   [b2b_files] shortcode standalone
   ============================================================================= */

.wc-b2b-files {
  margin: 8px 0;
}

.wc-b2b-files__label {
  display:       block;
  font-size:     13px;
  font-weight:   600;
  color:         var(--b2b-text-muted);
  margin-bottom: 8px;
}

/* =============================================================================
   [b2b_card] all-in-one card widget
   ============================================================================= */

.wc-b2b-card-widget {
  background:    var(--b2b-bg-subtle);
  border:        1.5px solid var(--b2b-border);
  border-radius: var(--b2b-radius);
  padding:       16px;
  display:       flex;
  flex-direction: column;
  gap:           12px;
}

.wc-b2b-card-widget__section-label {
  display:       block;
  font-size:     11px;
  font-weight:   700;
  color:         var(--b2b-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}

.wc-b2b-card-widget__btn {
  width:           100%;
  justify-content: center;
}

/* =============================================================================
   [b2b_faq] FAQ accordion
   ============================================================================= */

.wc-b2b-faq {
  margin: 10px 0;
}

.wc-b2b-faq__title {
  font-size:     18px;
  font-weight:   700;
  color:         var(--b2b-text);
  margin:        0 0 14px;
  font-family:   var(--b2b-font);
  line-height:   1.3;
}

.wc-b2b-faq__list {
  display:        flex;
  flex-direction: column;
  gap:            6px;
}

.wc-b2b-faq__item {
  border:        1.5px solid var(--b2b-border);
  border-radius: var(--b2b-radius-sm);
  background:    var(--b2b-bg);
  overflow:      hidden;
  transition:    border-color .15s ease;
}

.wc-b2b-faq__item[open] {
  border-color: var(--b2b-size-border);
}

.wc-b2b-faq__question {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  gap:             12px;
  padding:         13px 16px;
  font-size:       14px;
  font-weight:     600;
  color:           var(--b2b-text);
  cursor:          pointer;
  list-style:      none;
  font-family:     var(--b2b-font);
  line-height:     1.4;
  user-select:     none;
  transition:      background .15s ease, color .15s ease;
}

.wc-b2b-faq__question::-webkit-details-marker {
  display: none;
}

.wc-b2b-faq__item[open] .wc-b2b-faq__question {
  background: var(--b2b-size-bg);
  color:      var(--b2b-size-text);
}

.wc-b2b-faq__q-text {
  flex: 1;
}

.wc-b2b-faq__chevron {
  flex-shrink: 0;
  color:       var(--b2b-text-muted);
  transition:  transform .2s ease;
}

.wc-b2b-faq__item[open] .wc-b2b-faq__chevron {
  transform: rotate(180deg);
  color:     var(--b2b-size-text);
}

.wc-b2b-faq__answer {
  padding:     4px 16px 14px;
  font-size:   14px;
  line-height: 1.65;
  color:       var(--b2b-text-muted);
  font-family: var(--b2b-font);
  border-top:  1px solid var(--b2b-border);
  animation:   b2bFadeIn .18s ease both;
}

.wc-b2b-faq__answer a {
  color:           var(--b2b-primary);
  text-decoration: underline;
}
