/* =============================================
   Wrap Studio 3D Pro — Stylesheet
   Dark theme, FFBB00 gold accents
   ============================================= */

/* Reset/Container */
.ws3d-container {
    display: flex;
    width: 100%;
    height: 100vh;
    background: #0a0a0a;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
    position: relative;
}

/* ---- 3D Canvas Area ---- */
.ws3d-canvas-area {
    flex: 1;
    position: relative;
    min-width: 0;
}

#ws3d-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ---- Hint ---- */
.ws3d-hint {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    padding: 8px 18px;
    background: rgba(0,0,0,0.6);
    border-radius: 40px;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    pointer-events: none;
    backdrop-filter: blur(4px);
}

/* ---- Loading Overlay ---- */
.ws3d-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10,10,10,0.9);
    z-index: 100;
    backdrop-filter: blur(8px);
    transition: opacity 0.3s;
}
.ws3d-loader.hidden {
    opacity: 0;
    pointer-events: none;
}
.ws3d-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255,187,0,0.15);
    border-top-color: #FFBB00;
    border-radius: 50%;
    animation: ws3d-spin 0.8s linear infinite;
    margin-bottom: 16px;
}
@keyframes ws3d-spin { to { transform: rotate(360deg); } }
.ws3d-loader p {
    font-size: 14px;
    color: #999;
}

/* ---- Panel ---- */
.ws3d-panel {
    width: 340px;
    min-width: 340px;
    background: #111;
    border-left: 1px solid #222;
    overflow-y: auto;
    padding: 20px 18px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    scrollbar-width: thin;
    scrollbar-color: #333 #111;
}
.ws3d-panel::-webkit-scrollbar { width: 6px; }
.ws3d-panel::-webkit-scrollbar-track { background: #111; }
.ws3d-panel::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* ---- Sections ---- */
.ws3d-section h3 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #FFBB00;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #222;
}

/* ---- Select ---- */
.ws3d-select {
    width: 100%;
    padding: 10px 12px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.ws3d-select:focus {
    outline: none;
    border-color: #FFBB00;
}
.ws3d-select option { background: #1a1a1a; }

/* ---- Category Buttons Grid ---- */
.ws3d-category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.ws3d-category-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 6px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #ccc;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.ws3d-category-btn:hover {
    border-color: #FFBB00;
    color: #fff;
}
.ws3d-category-btn.active {
    background: #FFBB00;
    color: #000;
    border-color: #FFBB00;
    font-weight: 600;
}
.ws3d-cat-name {
    font-weight: 500;
    line-height: 1.2;
}
.ws3d-cat-count {
    font-size: 10px;
    opacity: 0.7;
}
.ws3d-category-btn.active .ws3d-cat-count {
    opacity: 0.85;
}

/* ---- Wrap Grid ---- */
.ws3d-wrap-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}
.ws3d-wrap-item {
    aspect-ratio: 1;
    border-radius: 8px;
    border: 2px solid #333;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
    position: relative;
}
.ws3d-wrap-item:hover { border-color: #FFBB00; transform: scale(1.05); }
.ws3d-wrap-item.active { border-color: #FFBB00; box-shadow: 0 0 12px rgba(255,187,0,0.4); }
.ws3d-wrap-name {
    font-size: 9px;
    background: rgba(0,0,0,0.75);
    padding: 2px 5px;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Color row ---- */
.ws3d-color-row { display: flex; flex-direction: column; gap: 10px; }
.ws3d-color-input {
    width: 100%;
    height: 40px;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 2px;
    background: #1a1a1a;
    cursor: pointer;
}
.ws3d-color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.ws3d-color-input::-webkit-color-swatch { border: none; border-radius: 6px; }
.ws3d-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ws3d-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #333;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}
.ws3d-swatch:hover { border-color: #FFBB00; transform: scale(1.15); }

/* ---- Sliders ---- */
.ws3d-slider { margin-bottom: 10px; }
.ws3d-slider label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
    margin-bottom: 6px;
}
.ws3d-slider label span { color: #FFBB00; font-weight: 600; }
.ws3d-slider input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #222;
    border-radius: 3px;
    outline: none;
}
.ws3d-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #FFBB00;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(255,187,0,0.4);
}
.ws3d-slider input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #FFBB00;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* ---- Finish Grid ---- */
.ws3d-finish-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.ws3d-finish {
    padding: 10px 8px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #ccc;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.ws3d-finish:hover { border-color: #FFBB00; color: #fff; }
.ws3d-finish.active { background: #FFBB00; color: #000; border-color: #FFBB00; font-weight: 600; }

/* ---- Camera Grid ---- */
.ws3d-cam-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}
.ws3d-cam {
    padding: 8px 4px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    color: #ccc;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}
.ws3d-cam:hover { border-color: #FFBB00; color: #fff; }

/* ---- Environment Grid ---- */
.ws3d-env-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.ws3d-env {
    padding: 10px 6px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    color: #ccc;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.ws3d-env img {
    width: 100%;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}
.ws3d-env-icon { font-size: 20px; }
.ws3d-env:hover { border-color: #FFBB00; }
.ws3d-env.active { border-color: #FFBB00; background: rgba(255,187,0,0.1); color: #FFBB00; }

/* ---- Toggle ---- */
.ws3d-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}
.ws3d-toggle input { display: none; }
.ws3d-toggle-track {
    width: 40px;
    height: 22px;
    background: #333;
    border-radius: 12px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.ws3d-toggle-track::after {
    content: '';
    width: 16px;
    height: 16px;
    background: #666;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: all 0.2s;
}
.ws3d-toggle input:checked + .ws3d-toggle-track {
    background: #FFBB00;
}
.ws3d-toggle input:checked + .ws3d-toggle-track::after {
    background: #000;
    left: 21px;
}
.ws3d-toggle-label { font-size: 13px; }

/* ---- Buttons ---- */
.ws3d-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #222;
}
.ws3d-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}
.ws3d-btn-primary { background: #FFBB00; color: #000; }
.ws3d-btn-primary:hover { background: #FFD54F; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,187,0,0.3); }
.ws3d-btn-secondary { background: #1a1a1a; color: #ccc; border: 1px solid #333; }
.ws3d-btn-secondary:hover { border-color: #FFBB00; color: #FFBB00; }
.ws3d-btn-quote { background: linear-gradient(135deg, #FFBB00, #ff8c00); color: #000; }
.ws3d-btn-quote:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,187,0,0.4); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .ws3d-container { flex-direction: column; height: auto; }
    .ws3d-canvas-area { height: 60vh; min-height: 300px; }
    .ws3d-panel {
        width: 100%;
        min-width: unset;
        max-height: 40vh;
        border-left: none;
        border-top: 1px solid #222;
    }
}
@media (max-width: 600px) {
    .ws3d-canvas-area { height: 50vh; }
    .ws3d-panel { padding: 14px 12px; gap: 14px; }
    .ws3d-wrap-grid { grid-template-columns: repeat(3, 1fr); }
    .ws3d-finish-grid { grid-template-columns: 1fr 1fr; }
    .ws3d-cam-grid { grid-template-columns: repeat(3, 1fr); }
}
