/* ── Furniture 3D Configurator — Front-end ─────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

/* ── Force Poppins on all text inside the configurator ───────────────────── */
.f3dc-config-section h1, .f3dc-config-section h2, .f3dc-config-section h3,
.f3dc-config-section h4, .f3dc-config-section h5, .f3dc-config-section h6,
.f3dc-config-section p,  .f3dc-config-section span, .f3dc-config-section a,
.f3dc-config-section button, .f3dc-config-section label,
.f3dc-configurator-title {
    font-family: 'Poppins', system-ui, sans-serif !important;
}

/* ── Design tokens ────────────────────────────────────────────────────────── */
.f3dc-config-section {
    --f3dc-surface-low:       #f5f5f5;
    --f3dc-primary:           #111111;
    --f3dc-on-surface:        #111111;
    --f3dc-on-surface-var:    #666666;
    --f3dc-outline-variant:   #cccccc;
    --f3dc-secondary:         #444444;
    --f3dc-error-bg:          #fff0f0;
    --f3dc-error-border:      #ffcccc;
    --f3dc-error-text:        #7b1f1f;
    --f3dc-warn-bg:           #fffbe6;
    --f3dc-warn-border:       #ffe082;
    --f3dc-warn-text:         #5c4000;
    --f3dc-font-serif:        'Poppins', system-ui, sans-serif;
    --f3dc-font-sans:         'Poppins', system-ui, sans-serif;
}

/* ── Section shell ────────────────────────────────────────────────────────── */
.f3dc-config-section {
    background: #ffffff;
    padding: 80px 0;
    width: 100%;
    float: none;
    clear: both;
    box-sizing: border-box;
}

/* ── Two-column grid ──────────────────────────────────────────────────────── */
.f3dc-config-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 48px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 48px;
    align-items: start;
    box-sizing: border-box;
}

@media (min-width: 1024px) {
    .f3dc-config-inner {
        grid-template-columns: 8fr 4fr;
        gap: 64px;
    }
}

@media (max-width: 600px) {
    .f3dc-config-inner {
        padding: 0 20px;
    }
    .f3dc-config-section {
        padding: 48px 0;
    }
}

/* ── Viewer column ────────────────────────────────────────────────────────── */
.f3dc-viewer-col {
    width: 100%;
}

.f3dc-canvas-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #ffffff;
    overflow: hidden;
}

.f3dc-canvas-wrap canvas {
    display: block;
    width:   100% !important;
    height:  100% !important;
    cursor: grab;
}

.f3dc-canvas-wrap canvas:active { cursor: grabbing; }

/* ── Loading overlay ──────────────────────────────────────────────────────── */
.f3dc-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    z-index: 10;
}

.f3dc-spinner {
    width: 36px;
    height: 36px;
    border: 2px solid #d4d4d4;
    border-top-color: var(--f3dc-primary);
    border-radius: 50%;
    animation: f3dc-spin 0.75s linear infinite;
}

@keyframes f3dc-spin { to { transform: rotate(360deg); } }

.f3dc-loading-text {
    font-family: var(--f3dc-font-sans);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--f3dc-on-surface-var);
}

.f3dc-progress-track {
    width: 120px;
    height: 1px;
    background: #d4d4d4;
    overflow: hidden;
}

.f3dc-progress-bar {
    height: 100%;
    width: 0;
    background: var(--f3dc-primary);
    transition: width 0.2s;
}

/* ── Drag hint ────────────────────────────────────────────────────────────── */
.f3dc-hint {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--f3dc-font-sans);
    font-size: 10px;
    letter-spacing: 0.08em;
    color: #888;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 4px 14px;
    border-radius: 20px;
    pointer-events: none;
    white-space: nowrap;
}

/* ── Shadow toggle button ─────────────────────────────────────────────────── */
.f3dc-shadow-toggle {
    position: absolute;
    bottom: 20px;
    right: 16px;
    font-family: var(--f3dc-font-sans);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #888;
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: none;
    padding: 4px 12px;
    border-radius: 20px;
    cursor: pointer;
    pointer-events: all;
    transition: color 0.15s, background 0.15s;
    white-space: nowrap;
}

.f3dc-shadow-toggle:hover {
    background: rgba(255, 255, 255, 0.95);
    color: #111;
}

.f3dc-shadow-toggle.is-on {
    color: #111;
}

/* ── Log / error box ──────────────────────────────────────────────────────── */
.f3dc-log-box {
    grid-column: 1 / -1;
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 48px;
    max-width: 1440px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.f3dc-log-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 14px;
    font-family: var(--f3dc-font-sans);
    font-size: 13px;
    line-height: 1.5;
    border-radius: 2px;
}

.f3dc-log-error {
    background: var(--f3dc-error-bg);
    border: 1px solid var(--f3dc-error-border);
    color: var(--f3dc-error-text);
}

.f3dc-log-warn {
    background: var(--f3dc-warn-bg);
    border: 1px solid var(--f3dc-warn-border);
    color: var(--f3dc-warn-text);
}

.f3dc-log-icon { flex-shrink: 0; font-size: 15px; }
.f3dc-log-msg  { flex: 1; word-break: break-word; }

/* ── Configurator panel column ────────────────────────────────────────────── */
.f3dc-panel-col {
    width: 100%;
}

/* ── Configurator title (sits above both columns, aligned with grid) ──────── */
.f3dc-configurator-title {
    font-family: var(--f3dc-font-sans);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--f3dc-on-surface-var);
    max-width: 1440px;
    margin: 0 auto 28px;
    padding: 0 48px;
    line-height: 1;
    box-sizing: border-box;
    width: 100%;
}

@media (max-width: 600px) {
    .f3dc-configurator-title {
        padding: 0 20px;
        margin-bottom: 20px;
    }
}

/* ── Swatch groups ────────────────────────────────────────────────────────── */
.f3dc-swatches {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.f3dc-group {
    display: flex;
    flex-direction: column;
}

.f3dc-group-heading {
    font-family: var(--f3dc-font-serif);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--f3dc-on-surface);
    margin: 0 0 20px;
    line-height: 1.3;
}

/* ── Swatch row ───────────────────────────────────────────────────────────── */
.f3dc-swatch-row {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.f3dc-swatch,
.f3dc-config-section .f3dc-swatch,
.f3dc-swatch-row .f3dc-swatch {
    width: 48px;
    height: 48px;
    border-radius: 50% !important;
    -webkit-border-radius: 50% !important;
    border: none !important;
    padding: 0;
    cursor: pointer;
    background-color: #bbbbbb;
    background-size: cover;
    background-position: center;
    outline: 2px solid transparent;
    outline-offset: 3px;
    transition: outline-color 0.15s ease;
    flex-shrink: 0;
    overflow: hidden;
    clip-path: circle(50%);
}

.f3dc-swatch:hover {
    outline-color: #cccccc;
}

.f3dc-swatch.is-active {
    outline-color: #111111;
}

/* ── Selected label ───────────────────────────────────────────────────────── */
.f3dc-group-sel {
    margin: 12px 0 0;
    font-family: var(--f3dc-font-sans);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--f3dc-on-surface-var);
}

/* ── Download button ──────────────────────────────────────────────────────── */
.f3dc-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    padding: 14px 28px;
    background: transparent;
    border: 1px solid #111111;
    color: #111111;
    font-family: 'Poppins', system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.f3dc-download-btn:hover {
    background: #111111;
    color: #ffffff;
}

.f3dc-download-icon {
    font-size: 1rem;
    line-height: 1;
}

/* ── Export panel ─────────────────────────────────────────────────────────── */
.f3dc-download-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 40px;
}

.f3dc-download-label {
    font-family: 'Poppins', system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #111111;
    white-space: nowrap;
}

.f3dc-export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.f3dc-export-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    background: transparent;
    border: 1px solid #111111;
    color: #111111;
    font-family: 'Poppins', system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.f3dc-export-btn:hover {
    background: #111111;
    color: #ffffff;
}

.f3dc-export-btn.is-loading {
    opacity: 0.5;
    cursor: wait;
    pointer-events: none;
}

.f3dc-export-error {
    display: block;
    width: 100%;
    font-family: 'Poppins', system-ui, sans-serif;
    font-size: 0.75rem;
    color: #c00;
    margin-top: 4px;
}

/* ── Matrix axis labels ───────────────────────────────────────────────────── */
.f3dc-axis-label {
    margin: 18px 0 8px;
    font-family: var(--f3dc-font-sans);
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--f3dc-outline-variant);
}

.f3dc-axis-label:first-of-type {
    margin-top: 0;
}
