/* ============================================================
   RoboThings PCB — Frontend CSS  WHITE LIGHT THEME
   Fully scoped to .rtpcb-wrapper to avoid theme conflicts
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ── Root variables ─────────────────────────────────────────── */
.rtpcb-wrapper {
    --c-green:     #009B65;
    --c-green-d:   #007a4f;
    --c-green-l:   #e6f7f2;
    --c-copper:    #C8880A;
    --c-orange:    #E85820;
    --c-dark:      #111827;
    --c-mid:       #374151;
    --c-muted:     #6B7280;
    --c-border:    #E5E7EB;
    --c-border-d:  #D1D5DB;
    --c-bg:        #F3F4F6;
    --c-white:     #FFFFFF;
    --c-text:      #111827;
    --c-shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
    --c-shadow-lg: 0 4px 20px rgba(0,0,0,.1);
    --c-radius:    10px;
    --c-radius-lg: 14px;

    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
    color: #111827 !important;
    background: #F3F4F6 !important;
    padding: 0 0 80px;
    margin: 0 -20px;
    box-sizing: border-box;
}

/* Force ALL child elements to use border-box */
.rtpcb-wrapper *, .rtpcb-wrapper *::before, .rtpcb-wrapper *::after {
    box-sizing: border-box;
}

/* ── HERO BANNER ────────────────────────────────────────────── */
.rtpcb-wrapper .rtpcb-hero {
    position: relative;
    height: 300px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a1a0f; /* hero stays dark — it's the PCB circuit graphic */
}
.rtpcb-wrapper .rtpcb-hero__circuit {
    position: absolute; inset: 0; z-index: 0;
}
.rtpcb-wrapper .rtpcb-circuit-svg { width: 100%; height: 100%; display: block; }
.rtpcb-wrapper .rtpcb-hero__content {
    position: relative; z-index: 1;
    text-align: center; padding: 20px; max-width: 680px;
}
.rtpcb-wrapper .rtpcb-hero__badge {
    display: inline-block;
    background: rgba(0,255,136,0.15);
    border: 1px solid rgba(0,255,136,0.35);
    color: #00e888; font-size: 11px; font-weight: 700;
    letter-spacing: 1px; text-transform: uppercase;
    padding: 4px 14px; border-radius: 99px; margin-bottom: 12px;
}
.rtpcb-wrapper .rtpcb-hero__title {
    font-size: clamp(24px,4vw,42px); font-weight: 700;
    color: #fff; line-height: 1.2; margin: 0 0 8px;
    text-shadow: 0 2px 14px rgba(0,0,0,.8);
}
.rtpcb-wrapper .rtpcb-hero__title-accent { color: #C8A014; font-style: italic; }
.rtpcb-wrapper .rtpcb-hero__sub {
    color: rgba(255,255,255,.68); font-size: 15px; font-weight: 300; margin: 0 0 16px;
}
.rtpcb-wrapper .rtpcb-hero__sub-small { font-size: 12px; color: rgba(255,255,255,.42); }
.rtpcb-wrapper .rtpcb-hero__stats {
    display: flex; align-items: center; justify-content: center; gap: 14px;
}
.rtpcb-wrapper .rtpcb-hero__stat {
    display: flex; flex-direction: column; align-items: center;
    font-size: 11px; color: rgba(255,255,255,.5);
}
.rtpcb-wrapper .rtpcb-hero__stat-num {
    font-size: 18px; font-weight: 700; color: #C8A014;
    font-family: 'IBM Plex Mono',monospace; display: block;
}
.rtpcb-wrapper .rtpcb-hero__stat-sep { color: rgba(255,255,255,.2); font-size: 18px; }

/* ── STEP INDICATOR BAR ─────────────────────────────────────── */
.rtpcb-wrapper .rtpcb-steps {
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    background: #ffffff !important;
    border-bottom: 2px solid #E5E7EB;
    padding: 16px 24px; flex-wrap: wrap;
    box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.rtpcb-wrapper .rtpcb-step {
    display: flex; align-items: center; gap: 7px;
    font-size: 13px; font-weight: 500; color: #6B7280;
}
.rtpcb-wrapper .rtpcb-step--active { color: #009B65; }
.rtpcb-wrapper .rtpcb-step--done   { color: #C8880A; }
.rtpcb-wrapper .rtpcb-step__num {
    width: 26px; height: 26px; border-radius: 50%;
    background: #E5E7EB; color: #6B7280;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; transition: all .2s;
}
.rtpcb-wrapper .rtpcb-step--active .rtpcb-step__num { background: #009B65; color: #fff; }
.rtpcb-wrapper .rtpcb-step--done .rtpcb-step__num   { background: #C8880A; color: #fff; }
.rtpcb-wrapper .rtpcb-step__arrow { color: #E5E7EB; font-size: 18px; }

/* ── MAIN LAYOUT ─────────────────────────────────────────────── */
.rtpcb-wrapper .rtpcb-main {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    max-width: 1280px;
    margin: 24px auto 0;
    padding: 0 24px;
    align-items: start;
}

/* ── CARDS ───────────────────────────────────────────────────── */
.rtpcb-wrapper .rtpcb-card {
    background: #ffffff !important;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    margin-bottom: 18px;
    box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
    overflow: hidden;
    animation: rtpcb-fadein .3s ease;
    color: #111827;
}
@keyframes rtpcb-fadein { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:none} }

.rtpcb-wrapper .rtpcb-card__header {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 20px 12px;
    border-bottom: 2px solid #E5E7EB;
    background: linear-gradient(to right, #fafbfc, #fff) !important;
}
.rtpcb-wrapper .rtpcb-card__icon { font-size: 20px; }
.rtpcb-wrapper .rtpcb-card__header h2 {
    font-size: 15px; font-weight: 700; color: #111827 !important; margin: 0;
}

/* ── DROPZONE ────────────────────────────────────────────────── */
.rtpcb-wrapper .rtpcb-dropzone {
    margin: 20px;
    border: 2px dashed #D1D5DB;
    border-radius: 12px; padding: 44px 24px;
    text-align: center; cursor: pointer;
    transition: border-color .2s, background .2s;
    background: #fafcff !important;
    color: #111827;
}
.rtpcb-wrapper .rtpcb-dropzone:hover,
.rtpcb-wrapper .rtpcb-dropzone--hover {
    border-color: #009B65;
    background: #e6f7f2 !important;
}
.rtpcb-wrapper .rtpcb-dropzone__pcb-icon { margin-bottom: 14px; }
.rtpcb-wrapper .rtpcb-dropzone__title { font-size: 17px; font-weight: 700; color: #111827; margin-bottom: 6px; }
.rtpcb-wrapper .rtpcb-dropzone__sub   { color: #6B7280; font-size: 13px; margin-bottom: 14px; }
.rtpcb-wrapper .rtpcb-dropzone__hint  { margin-top: 14px; font-size: 11px; color: #6B7280; font-family: 'IBM Plex Mono',monospace; }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.rtpcb-wrapper .rtpcb-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: inherit; font-size: 13px; font-weight: 600;
    padding: 9px 20px; border-radius: 8px; border: 2px solid transparent;
    cursor: pointer; transition: all .18s; text-decoration: none; white-space: nowrap;
}
.rtpcb-wrapper .rtpcb-btn--primary { background: #009B65; color: #fff !important; border-color: #009B65; }
.rtpcb-wrapper .rtpcb-btn--primary:hover { background: #007a4f; color: #fff !important; }
.rtpcb-wrapper .rtpcb-btn--outline  { background: #fff !important; color: #009B65; border-color: #009B65; }
.rtpcb-wrapper .rtpcb-btn--outline:hover { background: #009B65 !important; color: #fff !important; }
.rtpcb-wrapper .rtpcb-btn--active   { background: #009B65 !important; color: #fff !important; border-color: #009B65 !important; }
.rtpcb-wrapper .rtpcb-btn--sm { padding: 7px 14px; font-size: 12px; }
.rtpcb-wrapper .rtpcb-btn--add-to-cart {
    width: 100%; background: linear-gradient(135deg,#E85820,#c44010) !important;
    color: #fff !important; border: none; font-size: 15px; font-weight: 700;
    padding: 15px; border-radius: 10px; letter-spacing: .5px; justify-content: center;
    box-shadow: 0 4px 16px rgba(232,88,32,.3); transition: transform .15s, box-shadow .15s;
}
.rtpcb-wrapper .rtpcb-btn--add-to-cart:hover {
    transform: translateY(-1px); box-shadow: 0 6px 24px rgba(232,88,32,.4);
}
.rtpcb-wrapper .rtpcb-btn--loading { opacity:.7; pointer-events:none; }

/* ── PROGRESS ────────────────────────────────────────────────── */
.rtpcb-wrapper .rtpcb-progress-wrap { margin: 0 20px 20px; }
.rtpcb-wrapper .rtpcb-progress-label {
    display: flex; justify-content: space-between;
    font-size: 12px; color: #6B7280; margin-bottom: 5px;
    font-family: 'IBM Plex Mono',monospace;
}
.rtpcb-wrapper .rtpcb-progress { height: 6px; background: #E5E7EB; border-radius: 99px; overflow: hidden; }
.rtpcb-wrapper .rtpcb-progress__bar {
    height: 100%; background: linear-gradient(90deg,#009B65,#00c880);
    border-radius: 99px; transition: width .3s; width: 0%;
}

/* ── ALERT ───────────────────────────────────────────────────── */
.rtpcb-wrapper .rtpcb-alert { margin: 0 20px 20px; padding: 11px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; }
.rtpcb-wrapper .rtpcb-alert--error { background: #FEF2F2 !important; border-left: 3px solid #EF4444; color: #991B1B !important; }

/* ── PCB INFO BAR ────────────────────────────────────────────── */
.rtpcb-wrapper .rtpcb-pcb-info {
    display: grid; grid-template-columns: repeat(3,1fr);
    border-bottom: 2px solid #E5E7EB;
}
.rtpcb-wrapper .rtpcb-pcb-info__item {
    padding: 12px 18px; border-right: 1px solid #E5E7EB;
    background: #fafbfc !important;
    display: flex; flex-direction: column; gap: 3px;
}
.rtpcb-wrapper .rtpcb-pcb-info__item:last-child { border-right: none; }
.rtpcb-wrapper .rtpcb-pcb-info__label {
    font-size: 10px; color: #6B7280; font-weight: 600;
    text-transform: uppercase; letter-spacing: .5px;
}
.rtpcb-wrapper .rtpcb-pcb-info__value {
    font-size: 14px; font-weight: 700; color: #111827;
    font-family: 'IBM Plex Mono',monospace;
}

/* ── 2D VIEWER  (viewer itself stays dark — it's the PCB canvas) */
.rtpcb-wrapper .rtpcb-viewer-2d {
    background: #0d1117;
    min-height: 380px;
    display: flex; align-items: center; justify-content: center;
    position: relative; overflow: hidden;
}
.rtpcb-wrapper .rtpcb-viewer-2d canvas { width: 100% !important; height: auto !important; display: block; }
.rtpcb-wrapper .rtpcb-viewer-2d img   { width: 100% !important; height: auto !important; display: block; max-height: 540px; object-fit: contain; }
.rtpcb-wrapper .rtpcb-viewer-loading  { color: rgba(255,255,255,.6); text-align: center; font-size: 13px; padding: 40px; }
.rtpcb-wrapper .rtpcb-viewer-placeholder { color: rgba(255,255,255,.45); text-align: center; font-size: 13px; }

.rtpcb-wrapper .rtpcb-viewer-controls {
    padding: 10px 20px; display: flex; gap: 8px; align-items: center;
    border-top: 2px solid #E5E7EB;
    background: #fafbfc !important;
}
.rtpcb-wrapper .rtpcb-viewer-note { font-size: 11px; color: #6B7280; margin-left: auto; font-family: 'IBM Plex Mono',monospace; }

.rtpcb-wrapper .rtpcb-layer-badge {
    position: absolute; top: 10px; left: 12px;
    background: rgba(0,0,0,.55); color: rgba(255,255,255,.85);
    font-size: 11px; font-weight: 700; font-family: 'IBM Plex Mono',monospace;
    padding: 4px 10px; border-radius: 4px; pointer-events: none;
    border: 1px solid rgba(255,255,255,.15);
}

/* ── MANUFACTURING OPTIONS ───────────────────────────────────── */
.rtpcb-wrapper .rtpcb-options-grid {
    padding: 20px; display: flex; flex-direction: column; gap: 20px;
    background: #ffffff !important;
}
.rtpcb-wrapper .rtpcb-option-group { }
.rtpcb-wrapper .rtpcb-option-label {
    display: block; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .6px;
    color: #6B7280; margin-bottom: 9px;
}
.rtpcb-wrapper .rtpcb-chip-group { display: flex; flex-wrap: wrap; gap: 7px; }
.rtpcb-wrapper .rtpcb-chip {
    padding: 7px 16px;
    border: 1.5px solid #E5E7EB;
    border-radius: 7px;
    background: #ffffff !important;
    font-family: inherit; font-size: 13px; font-weight: 500;
    color: #374151 !important; cursor: pointer; transition: all .15s;
}
.rtpcb-wrapper .rtpcb-chip:hover { border-color: #009B65; color: #009B65 !important; }
.rtpcb-wrapper .rtpcb-chip--active {
    background: #e6f7f2 !important;
    border-color: #009B65; color: #009B65 !important; font-weight: 600;
    box-shadow: 0 0 0 2px rgba(0,155,101,.12);
}
.rtpcb-wrapper .rtpcb-color-group { display: flex; gap: 9px; flex-wrap: wrap; }
.rtpcb-wrapper .rtpcb-color-swatch {
    width: 34px; height: 34px; border-radius: 7px;
    border: 2.5px solid transparent; cursor: pointer;
    transition: transform .15s, box-shadow .15s, border-color .15s;
    font-size: 0; display: flex; align-items: center; justify-content: center;
}
.rtpcb-wrapper .rtpcb-color-swatch:hover { transform: scale(1.1); }
.rtpcb-wrapper .rtpcb-color-swatch--active {
    border-color: #111827; box-shadow: 0 0 0 3px rgba(0,0,0,.12); transform: scale(1.12);
}
.rtpcb-wrapper .rtpcb-color-label { margin-top: 7px; font-size: 12px; font-weight: 600; color: #374151; font-family: 'IBM Plex Mono',monospace; }

/* ── SIDEBAR QUOTE PANEL ─────────────────────────────────────── */
.rtpcb-wrapper .rtpcb-sidebar { position: sticky; top: 20px; }
.rtpcb-wrapper .rtpcb-quote-panel {
    background: #ffffff !important;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0,0,0,.1);
    overflow: hidden;
}
.rtpcb-wrapper .rtpcb-quote-panel__header {
    background: linear-gradient(135deg,#0a3d25,#0d2a40) !important;
    color: #fff !important; padding: 14px 18px; font-size: 15px; font-weight: 700;
    border-bottom: 2px solid #E5E7EB;
}
.rtpcb-wrapper .rtpcb-quote-panel__body { padding: 16px; background: #ffffff !important; }
.rtpcb-wrapper .rtpcb-quote-empty { text-align: center; color: #6B7280; padding: 16px 0; font-size: 13px; line-height: 1.7; }
.rtpcb-wrapper .rtpcb-quote-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 0; border-bottom: 1px solid #E5E7EB; font-size: 13px;
}
.rtpcb-wrapper .rtpcb-quote-row:last-child { border-bottom: none; }
.rtpcb-wrapper .rtpcb-quote-row__label { color: #6B7280; }
.rtpcb-wrapper .rtpcb-quote-row__value { font-weight: 600; color: #111827; font-family: 'IBM Plex Mono',monospace; font-size: 12px; }
.rtpcb-wrapper .rtpcb-quote-panel__footer { padding: 16px; border-top: 2px solid #E5E7EB; background: #ffffff !important; }
.rtpcb-wrapper .rtpcb-price-display { margin-bottom: 14px; }
.rtpcb-wrapper .rtpcb-price-row { display: flex; justify-content: space-between; font-size: 12px; color: #6B7280; padding: 3px 0; }
.rtpcb-wrapper .rtpcb-price-total-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0 0; border-top: 2px solid #E5E7EB; margin-top: 6px;
}
.rtpcb-wrapper .rtpcb-price-total-row span { font-size: 13px; font-weight: 600; color: #111827; }
.rtpcb-wrapper .rtpcb-price-total-row strong { font-size: 26px; font-weight: 800; color: #E85820; font-family: 'IBM Plex Mono',monospace; }
.rtpcb-wrapper .rtpcb-trust-badges { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; font-size: 11px; color: #6B7280; }
.rtpcb-wrapper .rtpcb-trust-badges span { display: flex; align-items: center; gap: 5px; }

/* ── SPINNER ─────────────────────────────────────────────────── */
.rtpcb-wrapper .rtpcb-spinner {
    width: 34px; height: 34px;
    border: 3px solid rgba(0,155,101,.15);
    border-top-color: #009B65; border-radius: 50%;
    animation: rtpcb-spin .7s linear infinite; margin: 0 auto 10px;
}
@keyframes rtpcb-spin { to { transform: rotate(360deg); } }

/* ── TOAST ───────────────────────────────────────────────────── */
.rtpcb-wrapper .rtpcb-toast {
    position: fixed; bottom: 28px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #111827; color: #fff; padding: 11px 22px; border-radius: 8px;
    font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none;
    transition: opacity .3s, transform .3s; z-index: 9999;
    min-width: 220px; text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.rtpcb-wrapper .rtpcb-toast--show    { opacity: 1; transform: translateX(-50%) translateY(0); }
.rtpcb-wrapper .rtpcb-toast--success { background: #0a3d25; }
.rtpcb-wrapper .rtpcb-toast--error   { background: #7f1d1d; }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 960px) {
    .rtpcb-wrapper .rtpcb-main { grid-template-columns: 1fr; padding: 0 14px; }
    .rtpcb-wrapper .rtpcb-sidebar { position: static; order: -1; }
    .rtpcb-wrapper .rtpcb-pcb-info { grid-template-columns: 1fr 1fr; }
    .rtpcb-wrapper .rtpcb-hero { height: 240px; }
}
@media (max-width: 600px) {
    .rtpcb-wrapper .rtpcb-hero { height: 200px; }
    .rtpcb-wrapper .rtpcb-hero__title { font-size: 22px; }
    .rtpcb-wrapper .rtpcb-steps { gap: 4px; font-size: 11px; }
    .rtpcb-wrapper .rtpcb-pcb-info { grid-template-columns: 1fr; }
    .rtpcb-wrapper .rtpcb-chip { padding: 6px 12px; font-size: 12px; }
}
