﻿*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --red: #c0183a;
    --red-dark: #9e1030;
    --green: #4a7c59;
    --green-sel: #3d6b49;
    --anthracite: #4a4a4a;
    --grey-blue: #5f7b8a;
    --teal: #2e8b7a;
    --teal-light: #d6f0ec;
    --bg: #f2f2f2;
    --card: #ffffff;
    --border: #e0e0e0;
    --text: #2a2a2a;
    --muted: #777;
    --step-active: #2a2a2a;
    --step-done: #2a9d6f;
    --radius: 14px;
    --shadow: 0 2px 8px rgba(0,0,0,.08);
  }

  body {
    font-family: 'Source Sans 3', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
  }

  /* ── HEADER ── */
  header {
    background: var(--red);
    color: #fff;
    padding: 22px 0 20px;
  }
  .header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
  }
  
  header h1 { font-size: 1.45rem; font-weight: 700; margin-bottom: 3px; }
  header p  { font-size: .9rem; opacity: .88; }

  /* ── LAYOUT ── */
  .page {
    max-width: 1100px;
    margin: 28px auto;
    padding: 0 16px;
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 24px;
    align-items: start;
  }
  .main-col { display: flex; flex-direction: column; gap: 20px; }

  /* ── CARD ── */
  .card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px 28px;
  }
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0;
    margin-bottom: 6px;
    background: transparent;
    border-bottom: none;
  }
  .card-header h2 { font-size: 1rem; font-weight: 700; }
  .card-header .step-label { font-size: .8rem; color: var(--muted); }
  .card-subtitle { font-size: .85rem; color: var(--muted); margin-bottom: 18px; }

  /* ── SHAPE PICKER ── */
  .shapes { display: flex; gap: 14px; flex-wrap: wrap; }
  .shape-btn {
    flex: 1 1 100px;
    min-width: 100px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 10px 12px;
    cursor: pointer;
    background: #fff;
    text-align: center;
    transition: border-color .15s, box-shadow .15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .shape-btn:hover { border-color: #aaa; }
  .shape-btn.active { border-color: var(--red); box-shadow: 0 0 0 3px rgba(192,24,58,.12); background: color-mix(in srgb, var(--red) 8%, white); }
  .shape-btn svg { width: 52px; height: 38px; }
  .shape-btn span { font-size: .82rem; font-weight: 600; display: block; }
  .shape-btn small { font-size: .75rem; color: var(--muted); }

  /* ── BASIC SETTINGS ── */
  .settings-row { display: flex; gap: 24px; flex-wrap: wrap; }
  .field-group { display: flex; flex-direction: column; gap: 6px; }
  .field-group:has(.colors) { flex: 1; }
  .field-group label { font-size: .82rem; font-weight: 600; }

  select.styled {
    padding: 9px 32px 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: .9rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23555'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    cursor: pointer;
    min-width: 150px;
  }
  select.styled:focus { outline: none; border-color: var(--red); }

  /* ── BASIS LOADER ── */
  .basis-loader {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 0;
    font-size: .85rem;
    color: var(--muted);
  }
  .spinner {
    width: 22px;
    height: 22px;
    border: 3px solid var(--border);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin .6s linear infinite;
  }
  @keyframes spin { to { transform: rotate(360deg); } }

  .colors { display: flex; gap: 16px; flex-wrap: wrap; }
  .color-btn {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    padding: 0;
    border-radius: 16px;
    border: 2px solid #ddd;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
    overflow: hidden;
    flex: 1;
    min-width: 80px;
    box-shadow: 0 2px 6px rgba(0,0,0,.1);
  }
  .color-btn:hover { border-color: #aaa; }
  .color-btn.active { border-color: var(--text); box-shadow: 0 2px 10px rgba(0,0,0,.18); }
  .color-swatch {
    width: 100%;
    height: 76px;
  }
  .color-btn-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px 6px 10px;
    background: #fff;
    gap: 4px;
  }
  .color-btn span { font-size: .78rem; font-weight: 600; color: var(--text); }
  .color-btn-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid rgba(0,0,0,.2);
    background: #d0d0d0;
    flex-shrink: 0;
    transition: background .15s, border-color .15s;
  }
  .color-btn.active .color-btn-indicator {
    border-color: inherit;
  }

  /* ── VISUAL ── */
  .visual-box {
    background: #f9f9f9;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .visual-box svg { width: 100%; height: auto; display: block; }

  /* ── SIDES TABLE ── */
  #sides-container { display: flex; flex-direction: column; gap: 12px; }

  .side-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 18px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
  }
  .side-label { font-weight: 700; font-size: .9rem; min-width: 56px; flex-shrink: 0; }

  .input-group { display: flex; flex-direction: column; gap: 4px; width: auto; flex-shrink: 0; }
  .input-group label { font-size: .82rem; color: var(--muted); font-weight: 600; }
  .input-group .inp-row { display: flex; align-items: center; gap: 6px; }

  input[type=number].len-input {
    width: 72px;
    padding: 8px 10px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: .85rem;
    text-align: right;
  }
  input[type=number].len-input:focus { outline: none; border-color: var(--red); }
  .unit { font-size: .85rem; color: var(--muted); }
  .toggle-group { display: flex; gap: 6px; }
  .tog-btn {
    padding: 8px 14px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
    font-family: inherit;
    font-size: .85rem;
    font-weight: 600;
    transition: background .2s ease, border-color .2s ease;
  }
  .tog-btn:hover { border-color: #b0b0b0; background: #fafafa; }
  .tog-btn.active { background: var(--text); color: #fff; border-color: var(--text); }

  select.gate-width {
    padding: 8px 28px 8px 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: .85rem;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23555'/%3E%3C/svg%3E") no-repeat right 10px center;
    appearance: none;
    cursor: pointer;
    min-width: 110px;
  }
  select.gate-width:focus { outline: none; border-color: var(--red); }

  /* ── SAMENSTELLING ── */
  .bom-table { width: 100%; border-collapse: collapse; }
  .bom-table td { padding: 8px; font-size: .83rem; vertical-align: top; }
  .bom-table tr:not(:last-child) td { border-bottom: 1px solid #f0f0f0; }
  .bom-table .qty  { font-weight: 700; white-space: nowrap; color: var(--muted); }
  .bom-table .art  { color: var(--muted); font-size: .78rem; }
  .bom-table .desc { }
  .bom-table .price{ text-align: right; white-space: nowrap; font-weight: 600; }
  .bom-total { display: flex; justify-content: flex-end; padding-top: 12px; border-top: 2px solid var(--text); margin-top: 8px; font-weight: 700; font-size: .95rem; gap: 24px; }

  /* ── ORDER FORM ── */
  .form-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 20px; }
  .form-grid .full { grid-column: 1/-1; }
  .form-grid .form-field { grid-column: span 3; }
  .form-grid .form-field.plaats { grid-column: span 4; }
  .form-grid .form-field:has(+ .plaats) { grid-column: span 2; }
  .form-field { display: flex; flex-direction: column; gap: 5px; }
  .form-field label { font-size: .82rem; font-weight: 600; }
  .form-field input {
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: .9rem;
    width: 100%;
    background: #fff;
  }
  .form-field input:focus { outline: none; border-color: var(--red); }

  .delivery-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
  .delivery-btn {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    background: #fff;
    text-align: center;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
    font-family: inherit;
  }
  .delivery-btn:hover { border-color: #b0b0b0; }
  .delivery-btn h3 { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
  .delivery-btn p  { font-size: .82rem; color: var(--muted); }
  .delivery-btn.active { border-color: var(--text); box-shadow: 0 0 0 3px rgba(0,0,0,.08); background: #f6f6f6; }

  .delivery-notice {
    background: var(--teal-light);
    color: var(--teal);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: 20px;
  }

  .action-row { display: flex; gap: 14px; flex-wrap: wrap; }
  .btn-reset {
    padding: 12px 24px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    transition: background .2s ease, border-color .2s ease;
  }
  .btn-reset:hover { background: #f0f0f0; border-color: #b0b0b0; }
  .btn-confirm {
    flex: 1;
    padding: 13px 24px;
    background: var(--red);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: .95rem;
    font-weight: 700;
    transition: background .2s ease, box-shadow .2s ease;
    box-shadow: 0 2px 8px rgba(192,24,58,.25);
  }
  .btn-confirm:hover { background: var(--red-dark); box-shadow: 0 4px 14px rgba(192,24,58,.35); }

  /* ── SIDEBAR ── */
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }

  .progress-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
  .progress-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 14px; }

  .progress-steps { display: flex; flex-direction: column; gap: 8px; }
  .prog-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    cursor: pointer;
    border-radius: 10px;
    background: #f2f2f2;
    border: 1px solid #e4e4e4;
    transition: border-color .15s, background .15s;
  }
  .prog-step.active { border-color: #c0c0c0; background: #ececec; }
  .prog-step.done   { background: #e8f5ef; border-color: #c3e6d4; }
  .step-num {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: #bbb;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem; font-weight: 700; flex-shrink: 0;
  }
  .prog-step.active .step-num { background: var(--text); }
  .prog-step.done   .step-num { background: var(--step-done); color: #fff; }
  .step-text { display: flex; flex-direction: column; gap: 5px; }
  .step-text h4 { font-size: .85rem; font-weight: 700; color: var(--text); line-height: 1; margin: 0; padding: 0; }
  .step-text p  { font-size: .75rem; color: var(--muted); margin: 0; padding: 0; line-height: 1; }

  .section-divider { border: none; border-top: 1px solid var(--border); margin: 20px 0 16px; }
  .section-title { font-size: .88rem; font-weight: 700; margin-bottom: 12px; color: var(--text); }

  .config-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
  .config-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; cursor: default; }
  .config-card-header h3 { font-size: 1rem; font-weight: 700; margin: 0; }
  .config-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px 4px 4px;
    color: var(--muted);
    align-items: center;
    justify-content: center;
  }
  .config-toggle::before {
    content: '';
    display: block;
    width: 10px;
    height: 10px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(-135deg);
    transition: transform .2s ease;
    margin-top: 3px;
  }
  .config-toggle.open::before {
    transform: rotate(45deg);
    margin-top: -3px;
  }
  .config-rows { display: flex; flex-direction: column; gap: 0; }
  .config-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f2f2f2; font-size: .84rem; }
  .config-row:last-child { border-bottom: none; }
  .config-row span:first-child { color: var(--muted); }
  .config-row span:last-child  { font-weight: 600; text-align: right; }

  .price-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
  .price-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .price-label h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin: 0; }
  .price-incl { font-size: .75rem; color: var(--muted); margin: 2px 0 0; }
  .total-price { font-size: 1.9rem; font-weight: 700; white-space: nowrap; }
  .price-delivery { font-size: .78rem; color: var(--muted); text-align: right; margin-top: 6px; min-height: 1em; }

  /* ── SUCCESS MODAL ── */
  .confirm-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .confirm-overlay.show {
    opacity: 1;
    pointer-events: auto;
  }
  .confirm-dialog {
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
    max-width: 440px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
  }
  .confirm-icon { font-size: 3rem; margin-bottom: 14px; }
  .confirm-dialog h2   { font-size: 1.4rem; font-weight: 700; margin-bottom: 10px; }
  .confirm-dialog p    { font-size: .9rem; color: var(--muted); line-height: 1.6; }
  .confirm-dialog .btn-confirm { margin-top: 24px; display: block; width: 100%; text-align: center; }
  .confirm-dialog .modal-error {
    background: #fdecea; color: #b71c1c; border-radius: 6px;
    padding: 10px 14px; font-size: .85rem; margin-top: 12px; line-height: 1.5;
  }
  .modal-loading {
    display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 20px 0;
  }
  .modal-loading p { font-size: .95rem; color: var(--muted); margin: 0; }

  /* ── LOADING OVERLAY ── */
  .loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity .3s ease;
  }
  .loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
  }
  .loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    font-size: .9rem;
    color: var(--muted);
  }
  .loading-content .spinner {
    width: 32px;
    height: 32px;
  }

  /* ── UNAVAILABLE ── */
  .unavailable-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    text-align: center;
    max-width: 380px;
    padding: 0 24px;
  }
  .unavailable-content svg {
    width: 56px;
    height: 56px;
    color: var(--muted);
  }
  .unavailable-content h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
  }
  .unavailable-content p {
    font-size: .9rem;
    color: var(--muted);
    line-height: 1.6;
  }

  /* ── RESPONSIVE ── */
  @media (max-width: 780px) {
    .page { grid-template-columns: 1fr; }
    .main-col { padding-bottom: 200px; }
    .field-group:has(.colors) { flex: none; width: 100%; }
    .colors { flex-wrap: wrap; }
    .color-btn { flex: none; width: 100px; }

    /* Sticky footer sidebar */
    .sidebar {
      order: 0;
      position: fixed;
      bottom: 0; left: 0; right: 0;
      top: auto;
      max-height: none;
      overflow-y: visible;
      background: var(--card);
      box-shadow: 0 -2px 16px rgba(0,0,0,.12);
      border-top: 1px solid var(--border);
      border-radius: var(--radius) var(--radius) 0 0;
      padding: 12px 16px;
      gap: 0;
      z-index: 100;
    }

    /* Hide progress on mobile */
    .progress-card { display: none; }

    /* Config card stripped in footer */
    .config-card { background: transparent; border: none; box-shadow: none; padding: 0; }
    .config-card-header { cursor: pointer; padding: 8px 0; border-bottom: 1px solid var(--border); margin-bottom: 0; }
    .config-toggle { display: flex; }
    .config-rows { display: none; padding: 4px 0 8px; }
    .config-rows.mobile-open { display: flex; }

    /* Price card stripped in footer */
    .price-card { background: transparent; border: none; box-shadow: none; padding: 8px 0 0; }

    /* Shapes 2x2 grid on mobile */
    .shapes { display: grid; grid-template-columns: 1fr 1fr; }
    .shape-btn { flex: none; min-width: auto; }

    /* Remove gap between side rows on mobile */
    #sides-container { gap: 0; }
    .side-row { border-radius: 0; border-bottom: none; flex-direction: column; align-items: flex-start; }
    .side-row:first-child { border-radius: var(--radius) var(--radius) 0 0; }
    .side-row:last-child { border-radius: 0 0 var(--radius) var(--radius); border-bottom: 1.5px solid var(--border); }

    .form-grid { grid-template-columns: 1fr; }
    .form-grid .form-field,
    .form-grid .form-field.plaats,
    .form-grid .form-field:has(+ .plaats) { grid-column: 1; }
    .form-grid .full { grid-column: 1; }
    .delivery-options { grid-template-columns: 1fr; }
  }
  @media (max-width: 480px) {
    header { padding: 16px 0; }
    .card  { padding: 18px 16px; }
    .side-row { gap: 10px; padding: 14px; }
  }