/* System Builder PRO v3.1 — MS VOLTECH FUTURE TECHNOLOGY XIII */
/* Standalone — fully isolated from store theme */

*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html.sb-html,html.sb-html body{margin:0;padding:0;width:100%;min-height:100vh;overflow-x:hidden;background:#e8ecf1}

#sb-app{
  font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Arial,sans-serif;
  background:#f0f2f5;min-height:100vh;color:#1a1a2e;
  -webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;
  max-width:860px;margin:0 auto;
  box-shadow:0 0 40px rgba(0,0,0,.08);
}

/* ─── TOPBAR ─── */
.sb-topbar{
  background:var(--sb-p,#0a3d62);height:58px;display:flex;align-items:center;
  padding:0 20px;position:sticky;top:0;z-index:600;
  box-shadow:0 2px 12px rgba(0,0,0,.3);gap:10px;
}
.sb-brand{display:flex;align-items:center;gap:8px;text-decoration:none;flex-shrink:0}
.sb-brand img{height:36px;width:auto;object-fit:contain}
.sb-brand-nm{color:#fff;font-weight:800;font-size:16px;white-space:nowrap;letter-spacing:.3px}
.sb-topbar-mid{flex:1}
.sb-topbar-actions{display:flex;align-items:center;gap:6px;flex-shrink:0}
.sb-tbtn{
  background:rgba(255,255,255,.12);border:none;color:#dce6f0;
  font-size:10px;font-weight:700;letter-spacing:.4px;text-transform:uppercase;
  padding:7px 12px;border-radius:6px;cursor:pointer;
  display:flex;flex-direction:column;align-items:center;gap:2px;
  transition:background .15s;white-space:nowrap;min-width:48px;
}
.sb-tbtn i{font-size:15px;line-height:1}
.sb-tbtn:hover{background:rgba(255,255,255,.22);color:#fff}
.sb-tbtn-hl{background:var(--sb-a,#e84118)!important;color:#fff!important}

/* ─── TITLE BAR ─── */
.sb-header-title{
  background:#fff;padding:10px 16px;border-bottom:1px solid #dee2ef;
  display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:6px;
}
.sb-title{font-size:14px;font-weight:800;color:#1a1a2e;line-height:1.2}
.sb-subtitle{font-size:11px;color:#888;margin-top:1px}
.sb-hide-label{display:flex;align-items:center;gap:4px;font-size:11px;color:#666;cursor:pointer;user-select:none}

/* ─── MAIN BODY ─── */
.sb-body{padding:12px 16px 100px}

/* ─── SECTION HEAD ─── */
.sb-sec-head{
  background:linear-gradient(90deg,var(--sb-p,#0a3d62),color-mix(in srgb,var(--sb-p,#0a3d62) 60%,var(--sb-a,#e84118)));
  color:#fff;font-size:10px;font-weight:800;letter-spacing:1.2px;text-transform:uppercase;
  padding:7px 14px;border-radius:6px 6px 0 0;
}
.sb-list-wrap{
  background:#fff;border:1px solid #dee2ef;border-top:none;
  border-radius:0 0 6px 6px;overflow:hidden;margin-bottom:12px;
}

/* ─── COMPONENT ROW — 2-line horizontal layout ─── */
.sb-row{
  display:flex;flex-direction:column;
  padding:10px 14px;
  border-bottom:1px solid #edf0f8;min-height:50px;transition:background .1s;
}
.sb-row:last-child{border-bottom:none}
.sb-row:hover{background:#fafbff}
.sb-row.active{background:#f4f8ff;border-left:3px solid var(--sb-a,#e84118)}

/* Line 1: Icon + Component Name + Badge + CHOOSE button */
.sb-row-line1{
  display:flex;align-items:center;gap:8px;width:100%;
}

/* Icon cell */
.sb-icon-cell{
  width:36px;height:36px;border:1.5px solid #e2e6f0;border-radius:8px;
  background:#f5f7ff;display:flex;align-items:center;justify-content:center;
  overflow:hidden;flex-shrink:0;transition:border-color .15s;
}
.sb-row.active .sb-icon-cell{border-color:var(--sb-a,#e84118)}
.sb-icon-cell img{width:100%;height:100%;object-fit:contain}
.sb-icon-cell i{font-size:16px;color:#8a9bc0}

/* Info cell */
.sb-row-info{flex:1;min-width:0;display:flex;align-items:center;gap:6px}
.sb-row-name{font-size:13px;font-weight:700;color:#1a1a2e;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sb-req{background:#e53935;color:#fff;font-size:8px;font-weight:800;padding:1px 5px;border-radius:3px;text-transform:uppercase;flex-shrink:0}
.sb-opt{background:#b0bec5;color:#fff;font-size:8px;font-weight:800;padding:1px 5px;border-radius:3px;text-transform:uppercase;flex-shrink:0}

/* Actions — on line 1, right side */
.sb-row-acts{display:flex;align-items:center;gap:4px;flex-shrink:0}
.sb-choose{
  background:var(--sb-p,#0a3d62);color:#fff;border:none;
  font-size:10px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;
  padding:7px 14px;border-radius:5px;cursor:pointer;white-space:nowrap;
  transition:background .15s,transform .1s;
}
.sb-choose:hover,.sb-choose.picked{background:var(--sb-a,#e84118)}
.sb-choose:active{transform:scale(.97)}
.sb-del{
  background:transparent;border:1.5px solid #dde2ef;color:#999;
  width:26px;height:26px;border-radius:5px;cursor:pointer;font-size:14px;
  display:none;align-items:center;justify-content:center;transition:all .15s;flex-shrink:0;
}
.sb-del.show{display:flex}
.sb-del:hover{border-color:#e53935;color:#e53935;background:#fff5f5}

/* Line 2: Selected product preview — horizontal inline */
.sb-preview{
  display:none;align-items:center;gap:8px;margin-top:6px;padding-left:44px;width:100%;
}
.sb-preview.show{display:flex}
.sb-prev-img{width:32px;height:32px;border-radius:4px;object-fit:contain;border:1px solid #e2e6f0;background:#f8f9ff;flex-shrink:0}
.sb-prev-name{font-size:11px;color:#555;font-weight:500;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sb-prev-prices{display:flex;align-items:center;gap:4px;flex-shrink:0}
.sb-prev-price{font-size:13px;font-weight:800;color:var(--sb-a,#e84118)}
.sb-prev-reg{font-size:10px;color:#aaa;text-decoration:line-through}

/* ─── STICKY FOOTER — centered like app ─── */
.sb-foot{
  position:fixed;bottom:0;left:50%;transform:translateX(-50%);
  width:100%;max-width:860px;
  background:var(--sb-p,#0a3d62);padding:8px 16px;
  display:flex;align-items:center;gap:8px;z-index:500;
  box-shadow:0 -3px 12px rgba(0,0,0,.25);
}
.sb-foot-left{margin-right:auto}
.sb-foot-total{color:#fff;font-size:13px;font-weight:700;white-space:nowrap}
.sb-foot-total span{color:#ffd32a;font-size:18px;font-weight:900}
.sb-foot-discount{font-size:10px;color:#4cd137;font-weight:700;white-space:nowrap;margin-top:1px}
.sb-foot-cart{
  background:var(--sb-a,#e84118);color:#fff;border:none;
  font-size:12px;font-weight:800;letter-spacing:.4px;
  padding:9px 20px;border-radius:6px;cursor:pointer;
  display:flex;align-items:center;gap:6px;transition:opacity .15s;white-space:nowrap;
}
.sb-foot-cart:hover{opacity:.88}
.sb-foot-cart:disabled{opacity:.5;cursor:not-allowed}

/* ─── BOTTOM-SHEET — centered, top-aligned on PC ─── */
.sb-overlay{display:none;position:fixed;inset:0;background:rgba(0,0,10,.65);z-index:900;align-items:flex-start;justify-content:center;padding-top:40px}
.sb-overlay.open{display:flex;animation:sbFadeIn .18s ease}
@keyframes sbFadeIn{from{opacity:0}to{opacity:1}}

.sb-sheet{
  background:#fff;width:100%;max-width:860px;max-height:85vh;
  border-radius:12px;display:flex;flex-direction:column;
  animation:sbSlideDown .25s ease;overflow:hidden;
  box-shadow:0 8px 40px rgba(0,0,0,.2);
}
@keyframes sbSlideDown{from{transform:translateY(-20px);opacity:0}to{transform:translateY(0);opacity:1}}

.sb-sheet-head{background:var(--sb-p,#0a3d62);padding:10px 16px;display:flex;align-items:center;justify-content:space-between;flex-shrink:0}
.sb-sheet-title{color:#fff;font-size:13px;font-weight:700}
.sb-sheet-close{
  background:rgba(255,255,255,.15);border:none;color:#fff;
  width:28px;height:28px;border-radius:50%;cursor:pointer;font-size:18px;
  display:flex;align-items:center;justify-content:center;line-height:1;transition:background .15s;
}
.sb-sheet-close:hover{background:rgba(255,255,255,.3)}

.sb-sheet-search{padding:8px 12px;background:#f5f7fc;border-bottom:1px solid #e2e6f0;flex-shrink:0}
.sb-sheet-search input{
  width:100%;border:1.5px solid #ccd3e8;border-radius:6px;
  padding:7px 10px 7px 32px;font-size:13px;color:#1a1a2e;outline:none;
  background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23999' viewBox='0 0 16 16' width='14' height='14'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.415l-3.85-3.85a1 1 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 9px center;
  transition:border-color .15s;-webkit-appearance:none;
}
.sb-sheet-search input:focus{border-color:var(--sb-a,#e84118)}

.sb-sheet-body{overflow-y:auto;flex:1;padding:12px;-webkit-overflow-scrolling:touch}
.sb-pgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:10px}

/* Product card */
.sb-pcard{
  border:1.5px solid #e0e5f2;border-radius:8px;padding:10px 8px;
  text-align:center;cursor:pointer;transition:border-color .15s,box-shadow .15s,transform .12s;
  background:#fff;position:relative;
}
.sb-pcard:hover{border-color:var(--sb-a,#e84118);box-shadow:0 3px 12px rgba(232,65,24,.08);transform:translateY(-1px)}
.sb-pcard.chosen{border-color:var(--sb-a,#e84118);background:color-mix(in srgb,var(--sb-a,#e84118) 5%,#fff)}
.sb-pcard-ck{
  position:absolute;top:5px;right:5px;width:18px;height:18px;
  background:var(--sb-a,#e84118);border-radius:50%;color:#fff;
  font-size:10px;font-weight:800;display:none;align-items:center;justify-content:center;
}
.sb-pcard.chosen .sb-pcard-ck{display:flex}
.sb-pcard img{width:100%;height:80px;object-fit:contain;margin-bottom:6px}
.sb-pcard-name{
  font-size:10px;font-weight:600;color:#1a1a2e;line-height:1.3;
  min-height:26px;overflow:hidden;display:-webkit-box;
  -webkit-line-clamp:2;-webkit-box-orient:vertical;margin-bottom:4px;
}
.sb-pcard-price{font-size:13px;font-weight:900;color:var(--sb-a,#e84118);display:block;margin-bottom:1px}
.sb-pcard-regular{font-size:10px;color:#bbb;text-decoration:line-through;display:none;margin-bottom:4px}
.sb-pcard.has-sp .sb-pcard-regular{display:block}
.sb-pcard-stock{font-size:9px;font-weight:700;color:#2e7d32;margin-bottom:5px;display:block}
.sb-pcard-stock.out{color:#c62828}
.sb-pcard-btn{
  width:100%;background:var(--sb-p,#0a3d62);color:#fff;border:none;
  border-radius:5px;padding:6px 0;font-size:10px;font-weight:700;
  letter-spacing:.4px;cursor:pointer;transition:background .15s;text-transform:uppercase;
}
.sb-pcard-btn:hover,.sb-pcard.chosen .sb-pcard-btn{background:var(--sb-a,#e84118)}

.sb-pload,.sb-pempty{grid-column:1/-1;text-align:center;padding:36px 16px;color:#aaa;font-size:12px}
.sb-pload i,.sb-pempty i{font-size:24px;display:block;margin-bottom:8px;color:var(--sb-a,#e84118)}

/* ─── TOAST ─── */
.sb-toast{
  position:fixed;top:56px;right:12px;z-index:9999;
  background:#2e7d32;color:#fff;padding:10px 14px;border-radius:6px;
  font-size:12px;font-weight:600;box-shadow:0 3px 12px rgba(0,0,0,.2);
  transform:translateX(120%);transition:transform .3s ease;
  display:flex;align-items:center;gap:6px;max-width:280px;
}
.sb-toast.show{transform:translateX(0)}
.sb-toast.error{background:#c62828}

/* ─── MOBILE — APP-like compact ─── */
@media(max-width:640px){
  #sb-app{max-width:100%;box-shadow:none}

  .sb-topbar{padding:0 8px;gap:4px;height:48px}
  .sb-brand img{height:26px}
  .sb-brand-nm{font-size:12px}
  .sb-tbtn{padding:5px 8px;font-size:8px;min-width:36px}
  .sb-tbtn i{font-size:12px}

  .sb-header-title{padding:8px 10px}
  .sb-title{font-size:13px}

  .sb-body{padding:6px 6px 85px}

  .sb-row{padding:7px 8px}
  .sb-row-line1{gap:6px}
  .sb-icon-cell{width:28px;height:28px;border-radius:6px}
  .sb-icon-cell i{font-size:13px}
  .sb-row-name{font-size:11px}
  .sb-preview{padding-left:34px;gap:6px;margin-top:4px}
  .sb-prev-name{font-size:9px}
  .sb-prev-img{width:24px;height:24px}
  .sb-prev-price{font-size:11px}

  .sb-choose{padding:6px 10px;font-size:9px}
  .sb-del{width:22px;height:22px;font-size:12px}

  .sb-pgrid{grid-template-columns:repeat(3,1fr);gap:6px}
  .sb-pcard{padding:6px}
  .sb-pcard img{height:56px}
  .sb-pcard-name{font-size:9px;min-height:22px}
  .sb-pcard-price{font-size:12px}
  .sb-pcard-btn{padding:5px 0;font-size:9px}

  .sb-foot{max-width:100%;padding:7px 10px;gap:6px}
  .sb-foot-total{font-size:12px}
  .sb-foot-total span{font-size:16px}
  .sb-foot-cart{padding:8px 14px;font-size:11px}

  /* Sheet slides from bottom on mobile */
  .sb-overlay{align-items:flex-end;padding-top:0}
  .sb-sheet{max-height:92vh;border-radius:12px 12px 0 0;box-shadow:none}
  .sb-sheet-head{padding:8px 12px}
  .sb-sheet-title{font-size:12px}
}

@media(max-width:380px){
  .sb-topbar-actions .sb-tbtn:not(.sb-tbtn-hl){display:none}
  .sb-brand-nm{display:none}
  .sb-pgrid{grid-template-columns:repeat(2,1fr)}
  .sb-icon-cell{width:24px;height:24px}
  .sb-preview{padding-left:30px}
}

/* ─── CAPTURE MODE — hides UI elements during screenshot ─── */
.sb-capturing .sb-tbtn,
.sb-capturing .sb-del,
.sb-capturing .sb-choose,
.sb-capturing .sb-foot-cart,
.sb-capturing .sb-hide-label {
  display: none !important;
}
.sb-capturing .sb-topbar,
.sb-capturing .sb-foot {
  position: static !important;
  transform: none !important;
}
.sb-capturing {
  max-width: none !important;
  width: 100% !important;
  box-shadow: none !important;
  overflow: visible !important;
  height: auto !important;
}
.sb-capturing .sb-row.active {
  border-left-width: 5px !important;
}
.sb-capturing .sb-foot {
  justify-content: center !important;
  padding: 20px !important;
}
.sb-capturing .sb-topbar {
  padding: 20px !important;
  height: auto !important;
}
.sb-capturing .sb-brand img {
  height: 50px !important;
}
.sb-capturing .sb-brand-nm {
  font-size: 24px !important;
}
.sb-capturing .sb-title {
  font-size: 20px !important;
}

/* ─── PRINT MODE — for Save as PDF ─── */
@media print {
  @page { margin: 0; size: auto; }
  html.sb-html, html.sb-html body { background: #fff !important; }
  #sb-app {
    max-width: none !important;
    width: 100% !important;
    box-shadow: none !important;
    margin: 0 !important;
    background: #fff !important;
  }
  .sb-topbar, .sb-foot {
    position: static !important;
    background: var(--sb-p) !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .sb-tbtn, .sb-del, .sb-choose, .sb-foot-cart, .sb-hide-label, .sb-topbar-mid {
    display: none !important;
  }
  .sb-brand img { height: 50px !important; }
  .sb-brand-nm { font-size: 24px !important; color: #fff !important; }
  .sb-title { font-size: 22px !important; }
  .sb-subtitle { font-size: 14px !important; }
  .sb-row.active { border-left: 5px solid var(--sb-a) !important; background: #f4f8ff !important; -webkit-print-color-adjust: exact !important; }
  .sb-foot { 
    position: static !important; transform: none !important; left: auto !important;
    max-width: none !important; width: 100% !important;
    min-height: 58px !important; height: auto !important; padding: 15px 25px !important; 
    display: flex !important; align-items: center !important; justify-content: flex-start !important; 
    flex-wrap: wrap !important; gap: 8px !important;
    text-align: left !important;
  }
  .sb-foot-left { margin: 0 !important; display: block !important; width: 100% !important; }
  .sb-foot-total { font-size: 14px !important; color: #fff !important; display: inline-block !important; }
  .sb-foot-total span { color: #ffd32a !important; font-size: 20px !important; font-weight: 900 !important; }
  .sb-foot-discount { font-size: 11px !important; color: #4cd137 !important; display: inline-block !important; font-weight: 700 !important; margin-left: 10px !important; }
}
