/**
 * Cendo Montage — frontend + admin styles
 * Primaire kleur: #0092ed (CENDO blauw)
 */

/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
  --cm-primary:     #0092ed;
  --cm-primary-bg:  #e5f4fd;
  --cm-primary-mid: #b3d9f8;
  --cm-border:      #e0e4ec;
  --cm-bg:          #f7f9fc;
  --cm-text:        #333;
  --cm-text-muted:  #777;
  --cm-radius:      6px;
}

/* ============================================================
   Product Page — Montage Block
   Compact, single-line design
   ============================================================ */

.cendo-montage-block {
  margin-top: 14px;
  padding: 10px 14px;
  border: 1.5px solid var(--cm-border);
  border-radius: var(--cm-radius);
  background: var(--cm-bg);
}

/* --- Checkbox option row — single line --- */
.cendo-montage-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.cendo-montage-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 1;
  margin: 0;
  min-width: 0; /* allow flex children to shrink */
}

.cendo-montage-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--cm-primary);
  flex-shrink: 0;
  cursor: pointer;
}

.cendo-montage-label-text {
  font-size: 0.875rem;
  color: var(--cm-text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Price: smaller, muted, pushed to the right within the label */
.cendo-montage-price {
  font-size: 0.775rem;
  color: var(--cm-text-muted);
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
  padding-left: 8px;
}

/* --- Info icon button --- */
.cendo-montage-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border: none;
  background: transparent;
  color: var(--cm-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
}

.cendo-montage-info-btn:hover,
.cendo-montage-info-btn:focus {
  color: var(--cm-primary);
  background: var(--cm-primary-bg);
  outline: 2px solid var(--cm-primary);
  outline-offset: 1px;
}

/* --- Info-only mode --- */
.cendo-montage-info-only {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cendo-montage-info-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--cm-text);
  font-weight: 500;
}

.cendo-montage-inline-info {
  padding: 10px 12px;
  border-left: 3px solid var(--cm-primary);
  background: #fff;
  border-radius: 0 var(--cm-radius) var(--cm-radius) 0;
  font-size: 0.8rem;
  color: var(--cm-text);
  line-height: 1.55;
}

.cendo-montage-inline-info p {
  margin: 0 0 8px;
}
.cendo-montage-inline-info p:last-child {
  margin-bottom: 0;
}

/* Mobile teaser removed — montage block now always renders outside the modal */

/* ============================================================
   Modal Overlay
   ============================================================ */

.cendo-montage-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.cendo-montage-modal {
  background: #fff;
  border-radius: 10px;
  max-width: 500px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.cendo-montage-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--cm-border);
}

.cendo-montage-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--cm-primary);
  line-height: 1.4;
}

.cendo-montage-modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border: none;
  background: transparent;
  color: var(--cm-text-muted);
  cursor: pointer;
  border-radius: var(--cm-radius);
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.cendo-montage-modal-close:hover,
.cendo-montage-modal-close:focus {
  color: var(--cm-primary);
  background: var(--cm-primary-bg);
  outline: 2px solid var(--cm-primary);
  outline-offset: 1px;
}

.cendo-montage-modal-body {
  padding: 18px 22px 22px;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--cm-text);
}

.cendo-montage-modal-body p {
  margin: 0 0 10px;
}
.cendo-montage-modal-body p:last-child {
  margin-bottom: 0;
}
.cendo-montage-modal-body strong {
  color: var(--cm-primary);
}

/* Mobile: slide up from bottom */
@media ( max-width: 767px ) {
  .cendo-montage-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .cendo-montage-modal {
    border-radius: 14px 14px 0 0;
    max-height: 80vh;
  }
}

/* ============================================================
   Cart — Montage toggle row (after product name in cart.php)
   ============================================================ */

.cendo-montage-cart-row {
  /* Default (desktop): inline-flex, shrinks to content inside .product-name */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 7px 10px 7px 8px;
  background: var(--cm-primary-bg);
  border: 1px solid var(--cm-primary-mid);
  border-radius: var(--cm-radius);
  font-size: 0.8rem;
  line-height: 1.3;
}

/* After JS relocation: full-width inside .cendo-product-options */
.cendo-montage-cart-row[data-relocated] {
  display: flex;
  width: 100%;
  margin-top: 8px;
  margin-bottom: 0;
  box-sizing: border-box;
}

.cendo-montage-cart-row--loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Label wraps checkbox + text */
.cendo-montage-cart-row__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  margin: 0;
  color: var(--cm-text);
}

/* Checkbox */
.cendo-montage-cart-toggle {
  width: 15px;
  height: 15px;
  accent-color: var(--cm-primary);
  flex-shrink: 0;
  cursor: pointer;
  margin: 0;
}

.cendo-montage-cart-row__text {
  font-weight: 500;
  color: var(--cm-text);
}

.cendo-montage-cart-row__price {
  font-size: 0.75rem;
  color: var(--cm-text-muted);
  white-space: nowrap;
}

/* ⓘ info button */
.cendo-montage-cart-row__info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 2px;
  border: none;
  background: transparent;
  color: var(--cm-primary);
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}

.cendo-montage-cart-row__info-btn:hover,
.cendo-montage-cart-row__info-btn:focus {
  background: var(--cm-primary);
  color: #fff;
  outline: 2px solid var(--cm-primary);
  outline-offset: 1px;
}

/* ============================================================
   Checkout — Compact inline notice (below product list)
   ============================================================ */

/* The notice renders as a <tr> inside the WC order review table */
.cendo-montage-checkout-row td {
  padding-top: 0 !important;
  padding-bottom: 6px !important;
}

.cendo-montage-checkout-inline {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--cm-primary);
  padding: 6px 10px;
  background: var(--cm-primary-bg);
  border-radius: var(--cm-radius);
  margin-bottom: 4px;
}

.cendo-montage-checkout-icon {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--cm-primary);
}

.cendo-montage-checkout-label {
  line-height: 1.4;
}

.cendo-montage-checkout-sub {
  font-size: 0.75rem;
  color: var(--cm-text-muted);
  padding: 0 10px;
  line-height: 1.4;
}

/* ============================================================
   Checkout — Montage section (under Kostenplaatje/Overzicht)
   ============================================================ */

.cendo-montage-checkout-tr td {
  padding: 0 !important;
  border: 0 !important;
}

.cendo-montage-checkout-section {
  margin-top: 20px;
  padding: 14px 16px;
  background: var(--cm-primary-bg);
  border: 1.5px solid var(--cm-primary-mid);
  border-radius: var(--cm-radius);
  text-align: left !important;
}

.cendo-montage-checkout-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cendo-montage-checkout-title {
  margin: 0 !important;
  padding: 0 !important;
  font-size: 0.95rem !important;
  font-weight: 700 !important;
  color: var(--cm-primary) !important;
  border: none !important;
  background: none !important;
  text-align: left !important;
  float: none !important;
  width: auto !important;
  line-height: 1 !important;
}

.cendo-montage-checkout-item {
  display: block;
  text-align: left;
}

.cendo-montage-checkout-item__head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--cm-text);
  text-align: left;
}

.cendo-montage-checkout-item__icon {
  display: inline-flex;
  color: var(--cm-primary);
  flex-shrink: 0;
}

.cendo-montage-checkout-item__name {
  color: var(--cm-text);
  text-align: left;
}

.cendo-montage-checkout-item__text {
  display: block;
  margin: 6px 0 0 0 !important;
  font-size: 0.8rem !important;
  color: var(--cm-text-muted) !important;
  line-height: 1.5 !important;
  text-align: left !important;
  float: none !important;
  width: auto !important;
}

/* ============================================================
   Admin — Order Item Badge
   ============================================================ */

.cendo-montage-admin-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  background: var(--cm-primary-bg);
  border: 1px solid var(--cm-primary-mid);
  border-radius: var(--cm-radius);
  font-size: 0.8rem;
  color: #004f85;
}

.cendo-montage-admin-badge code {
  font-size: 0.75rem;
  background: rgba(0,0,0,0.06);
  padding: 1px 4px;
  border-radius: 3px;
}

/* ============================================================
   Admin Settings Page
   ============================================================ */

.cendo-montage-admin .nav-tab-wrapper {
  margin-bottom: 20px;
}

.cendo-montage-rule-card {
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-radius);
  margin-bottom: 16px;
  background: #fff;
}

.cendo-montage-rule-card.is-disabled {
  opacity: 0.6;
}

.cendo-montage-rule-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--cm-bg);
  border-bottom: 1px solid var(--cm-border);
  border-radius: var(--cm-radius) var(--cm-radius) 0 0;
  gap: 16px;
}

.cendo-montage-rule-header h3 {
  margin: 0;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cendo-montage-rule-header .rule-key {
  font-family: monospace;
  color: var(--cm-primary);
}

.cendo-montage-rule-header .rule-label {
  color: var(--cm-text-muted);
  font-weight: 400;
  font-size: 0.85rem;
}

.cendo-montage-rule-body {
  padding: 4px 0;
}

.cendo-montage-rule-body .form-table th {
  width: 200px;
}

.cendo-montage-add-rule {
  margin-top: 20px;
  padding: 16px;
  border: 2px dashed var(--cm-border);
  border-radius: var(--cm-radius);
  background: var(--cm-bg);
}

.cendo-montage-add-rule h3 {
  margin-top: 0;
}

.cendo-montage-cat-select {
  min-width: 300px;
}

.cendo-montage-html-editor {
  font-family: monospace;
  font-size: 0.8rem;
  line-height: 1.5;
}
