/* =============================================
   Neon Sign Designer Pro v3.0
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

#nsd-wrap {
    display: flex;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    position: relative;
}

/* =============================================
   LEFT PREVIEW
   ============================================= */
#nsd-preview {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background 0.6s ease;
    background: #1a1a1a;
}

/* Green wall background - only scene */
#nsd-preview.scene-wall {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#nsd-preview.scene-wall::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 0;
}

#nsd-canvas, #nsd-onoff {
    position: relative;
    z-index: 1;
}

/* ON/OFF */
#nsd-onoff {
    position: absolute;
    top: 18px;
    left: 18px;
    display: flex;
    background: rgba(0,0,0,0.6);
    border-radius: 6px;
    overflow: hidden;
    z-index: 20;
    backdrop-filter: blur(4px);
}

.nsd-power {
    padding: 6px 14px;
    border: none;
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    background: transparent;
    color: #666;
    transition: all 0.2s;
}

#nsd-on.active  { background: #00ff44; color: #000; }
#nsd-off.active { background: #444; color: #fff; }

/* Canvas — main area */
#nsd-canvas {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    padding: 60px 40px 40px;
    position: relative;
}

/* Sign area (holds backboard + neon) */
#nsd-sign-area {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-top: 40px;
}

/* Sign area (holds backboard + neon) */
#nsd-sign-area {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Standee legs */
#nsd-standee-legs {
    display: none;
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    width: 55%;
    height: 22px;
    justify-content: space-between;
    align-items: flex-start;
}

#nsd-standee-legs.visible { display: flex; }

.nsd-leg {
    width: 20%;
    height: 22px;
    background: rgba(180, 200, 255, 0.3);
    border-radius: 0 0 5px 5px;
    border: 1px solid rgba(255,255,255,0.2);
    border-top: none;
}
#nsd-sign-area {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Backboard shape — base */
#nsd-text-goo-clone { display: none !important; }

#nsd-backboard-shape {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 30px 50px;
}

/* 1. Cut to Shape — organic acrylic that hugs the actual letterforms */
#nsd-backboard-shape.bb-cut-shape {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 24px 28px;
    position: relative;
    overflow: visible;
}

#nsd-goo-wrap {
    display: none;
    position: absolute;
    inset: -20px;
    z-index: -1;
    filter: blur(16px) contrast(8) brightness(0.7) saturate(0);
    pointer-events: none;
}

#nsd-backboard-shape.bb-cut-shape #nsd-goo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
}

#nsd-goo-text {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(36px, 5vw, 72px);
    line-height: 1.3;
    white-space: pre-wrap;
    word-break: break-word;
    text-align: center;
    color: rgba(40, 40, 45, 0.9);
    -webkit-text-stroke: 30px rgba(40, 40, 45, 0.9);
    text-stroke: 30px rgba(40, 40, 45, 0.9);
}

#nsd-backboard-shape.bb-cut-shape {
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5));
}

/* 2. Minimal — no backboard */
#nsd-backboard-shape.bb-minimal {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 20px 40px;
}

/* 3. Full Board — clear rectangle */
#nsd-backboard-shape.bb-full {
    background: rgba(210, 230, 255, 0.25);
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 14px;
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.3),
        inset 0 -1px 0 rgba(0,0,0,0.1);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 36px 70px;
}

/* 4. Standee — rectangle with stand legs */
#nsd-backboard-shape.bb-standee {
    background: rgba(210, 230, 255, 0.25);
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 10px;
    box-shadow: 
        0 8px 32px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 36px 70px;
    margin-bottom: 26px;
}
#nsd-backboard-shape.bbc-silver { 
    background: linear-gradient(135deg, rgba(180,180,180,0.9), rgba(220,220,220,0.9)) !important; 
    border-color: rgba(255,255,255,0.5) !important;
}
#nsd-backboard-shape.bbc-gold   { 
    background: linear-gradient(135deg, rgba(200,160,0,0.9), rgba(255,220,50,0.9)) !important; 
    border-color: rgba(255,200,0,0.5) !important;
}

/* Neon text */
#nsd-text {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(36px, 5vw, 72px);
    color: #fff5e0;
    line-height: 1.3;
    white-space: pre-wrap;
    word-break: break-word;
    text-shadow:
        0 0 7px #fff5e0,
        0 0 10px #fff5e0,
        0 0 21px #fff5e0,
        0 0 42px #fff5e0,
        0 0 82px #fff5e0;
    transition: all 0.4s ease;
    user-select: none;
    text-align: center;
}

#nsd-text.off {
    text-shadow: none;
    opacity: 0.25;
    filter: brightness(0.4);
}

/* Dimension lines */
#nsd-dim-height {
    position: absolute;
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: rgba(255,255,255,0.5);
    font-size: 11px;
}

.nsd-dim-line {
    width: 1px;
    height: 40px;
    background: rgba(255,255,255,0.4);
    position: relative;
}

.nsd-dim-line::before,
.nsd-dim-line::after {
    content: '';
    position: absolute;
    width: 8px;
    height: 1px;
    background: rgba(255,255,255,0.4);
    left: -3.5px;
}

.nsd-dim-line::before { top: 0; }
.nsd-dim-line::after  { bottom: 0; }

#nsd-dim-width {
    display: flex;
    align-items: center;
    gap: 6px;
    color: rgba(255,255,255,0.5);
    font-size: 11px;
    margin-top: 12px;
    white-space: nowrap;
}

.nsd-dim-line-h {
    height: 1px;
    width: 60px;
    background: rgba(255,255,255,0.4);
    position: relative;
}

.nsd-dim-line-h::before,
.nsd-dim-line-h::after {
    content: '';
    position: absolute;
    height: 8px;
    width: 1px;
    background: rgba(255,255,255,0.4);
    top: -3.5px;
}

.nsd-dim-line-h::before { left: 0; }
.nsd-dim-line-h::after  { right: 0; }

/* Scene thumbnails removed - single wall background used */

/* =============================================
   RIGHT PANEL
   ============================================= */
#nsd-panel {
    width: 340px;
    min-width: 340px;
    background: #fff;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    position: relative;
    z-index: 10;
}

#nsd-panel-inner {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 130px;
    -webkit-overflow-scrolling: touch;
}

#nsd-panel-inner::-webkit-scrollbar { width: 3px; }
#nsd-panel-inner::-webkit-scrollbar-thumb { background: #ddd; border-radius: 2px; }

.nsd-step {
    padding: 14px 16px;
    border-bottom: 1px solid #f2f2f2;
}

.nsd-step-hd {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.nsd-num {
    width: 22px;
    height: 22px;
    background: #0d0d1a;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nsd-title {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.6px;
    color: #0d0d1a;
}

.nsd-desc {
    font-size: 11px;
    color: #aaa;
    margin-bottom: 10px;
    line-height: 1.5;
}

/* Text input */
.nsd-text-row { display: flex; gap: 8px; }

#nsd-input {
    flex: 1;
    padding: 10px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    resize: none;
    outline: none;
    height: 64px;
    max-height: 64px;
    min-height: 64px;
    -webkit-appearance: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    color: #333;
    line-height: 1.5;
    font-family: inherit;
}

#nsd-input:focus { border-color: #0d0d1a; }

#nsd-logo-btn {
    background: #0d0d1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 9px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    line-height: 1.4;
    width: 100px;
    flex-shrink: 0;
}

#nsd-logo-btn span {
    display: block;
    background: #f6c90e;
    color: #0d0d1a;
    border-radius: 4px;
    padding: 3px 4px;
    margin-top: 4px;
    font-size: 9px;
    font-weight: 800;
}

#nsd-letter-count {
    font-size: 11px;
    color: #aaa;
    margin-top: 6px;
    text-align: right;
}

/* Font */
#nsd-font {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    cursor: pointer;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23333' stroke-width='1.5' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center;
    -webkit-appearance: none;
    appearance: none;
    color: #333;
}

/* Colors */
#nsd-colors { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }

.nsd-color {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s;
    position: relative;
    flex-shrink: 0;
}

.nsd-color:hover { transform: scale(1.18); }

.nsd-color.active::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.8);
}

#nsd-color-label { font-size: 11px; color: #777; font-weight: 500; }

/* Sizes */
#nsd-sizes { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.nsd-size {
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.nsd-size:hover  { border-color: #0d0d1a; }
.nsd-size.active { border-color: #ff69b4; background: #fff0f8; }

.nsd-size-name  { font-size: 12px; font-weight: 700; color: #0d0d1a; margin-bottom: 4px; }
.nsd-size-price { font-size: 15px; font-weight: 800; color: #0d0d1a; margin-bottom: 4px; }
.nsd-size-dim   { font-size: 10px; color: #aaa; }

/* Location */
.nsd-location-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.nsd-loc {
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
}

.nsd-loc strong { display: block; font-size: 13px; color: #0d0d1a; margin-bottom: 4px; }
.nsd-loc span   { font-size: 11px; color: #888; display: block; }
.nsd-badge { background: #e8f5e9 !important; color: #2e7d32 !important; font-size: 9px !important; padding: 2px 6px; border-radius: 4px; display: inline-block !important; margin-bottom: 2px; }
.nsd-loc.active, .nsd-loc:hover { border-color: #0d0d1a; background: #f8f8ff; }

/* Backboards */
#nsd-backboards { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

.nsd-bb {
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.nsd-bb.active { border-color: #ff69b4; background: #fff8fd; }
.nsd-bb:hover  { border-color: #aaa; }

.nsd-bb-top {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 7px 8px 4px;
}

.nsd-bb-label {
    font-size: 11px;
    font-weight: 600;
    color: #444;
}

.nsd-bb-price-tag {
    font-size: 11px;
    font-weight: 700;
    color: #333;
}

.nsd-bb-paid {
    color: #1a73e8;
}

.nsd-bb-img {
    padding: 0 6px 8px;
}

.nsd-bb-img svg,
.nsd-bb-img img {
    width: 100%;
    height: auto;
    display: block;
    max-height: 80px;
    object-fit: contain;
}

/* Backboard Colors */
#nsd-bbcolors { display: flex; flex-direction: column; gap: 7px; }

.nsd-bbc {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.nsd-bbc.active { border-color: #0d0d1a; background: #f8f8ff; }
.nsd-bbc:hover  { border-color: #0d0d1a; }
.nsd-bbc-dot    { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.nsd-bbc-name   { font-size: 12px; color: #333; font-weight: 500; }
.nsd-bbc-price  { font-size: 11px; color: #888; }

/* Options */
.nsd-opt-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #333;
    margin-bottom: 10px;
    cursor: pointer;
}

.nsd-opt-price { margin-left: auto; font-size: 12px; color: #888; }
.nsd-special   { color: #0d0d1a; font-weight: 600; }

#nsd-power {
    margin-left: auto;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 11px;
    outline: none;
    max-width: 160px;
}

/* Checkout Bar */
#nsd-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 12px 16px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
    z-index: 50;
}

#nsd-bar-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
#nsd-rush    { font-size: 10px; color: #aaa; max-width: 150px; line-height: 1.4; }
#nsd-total-wrap { font-size: 13px; color: #555; }
#nsd-total   { font-size: 20px; font-weight: 800; color: #0d0d1a; margin-left: 4px; }

#nsd-cart-btn {
    width: 100%;
    background: #0d0d1a;
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    letter-spacing: 1px;
    transition: background 0.2s, transform 0.15s;
}

#nsd-cart-btn:hover    { background: #1e1e3e; transform: translateY(-1px); }
#nsd-cart-btn:disabled { background: #bbb; cursor: not-allowed; transform: none; }

#nsd-msg { text-align: center; font-size: 12px; font-weight: 600; min-height: 16px; margin-top: 6px; }
#nsd-msg.ok  { color: #2e7d32; }
#nsd-msg.err { color: #c62828; }

/* =============================================
   MOBILE
   ============================================= */
@media (max-width: 768px) {
    #nsd-wrap { flex-direction: column; height: auto; max-height: none; overflow: visible; }
    #nsd-preview { height: 280px; min-height: 280px; position: sticky; top: 0; z-index: 40; }
    #nsd-text { font-size: clamp(26px, 7vw, 44px) !important; }
    /* scene thumbnails removed */
    #nsd-panel { width: 100%; min-width: unset; height: auto; overflow: visible; box-shadow: none; }
    #nsd-panel-inner { overflow: visible; padding-bottom: 150px; }
    #nsd-bar { position: fixed; bottom: 0; left: 0; right: 0; width: 100%; }
    .nsd-text-row { flex-direction: column; }
    #nsd-logo-btn { width: 100%; }
    #nsd-dim-height { left: 8px; }
    #nsd-dim-height .nsd-dim-line { height: 24px; }
}

/* iOS Fix */
@supports (-webkit-touch-callout: none) {
    #nsd-input { height: 64px !important; max-height: 64px !important; resize: none !important; -webkit-appearance: none !important; }
}
