/* RESET & BASICS */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: rgb(210, 210, 210);
    color: #222;
}

/* MAIN LAYOUT */
.configurator-wrapper {
    display: flex;
    flex-direction: row;
    width: 100%;
    height: 100%;
    background-color: rgb(210, 210, 210);
    position: relative;
}

#canvas-container {
    position: relative;
    flex-grow: 1;
    min-width: 0;
    min-height: 0;
    z-index: 0;
    outline: none;
    overflow: hidden;
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    outline: none;
}

/* UI SIDEBAR */
#ui-sidebar {
    position: relative;
    width: 320px;
    height: 100%;
    background: #ffffff;
    padding: 24px 20px;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 100;
    flex-shrink: 0;
}

/* STANDALONE TOP BAR (Visible when not embedded) */
.standalone-top-bar {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 12px;
}

.standalone-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    color: #111;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 30px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    transition: all 0.2s ease;
}

.standalone-back-btn:hover {
    background: #111;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

/* RESPONSIVE LAYOUT (Mobile/Portrait) */
@media (max-width: 768px) or (orientation: portrait) {
    .configurator-wrapper {
        flex-direction: column;
    }
    #ui-sidebar {
        width: 100%;
        height: 45%;
        border-left: none;
        border-top: 1px solid rgba(0, 0, 0, 0.1);
        box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.08);
    }
    #canvas-container {
        width: 100%;
        height: 55%;
    }
    #home-btn {
        top: 14px;
        right: 14px;
    }
}

/* LOADING OVERLAY */
#loading-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.75);
    color: #ffffff;
    padding: 12px 24px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    z-index: 1000;
    pointer-events: none;
    display: none;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    align-items: center;
    gap: 10px;
}

#loading-overlay::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* CONTROLS */
#home-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 42px;
    height: 42px;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
    border: 1.5px solid #222;
    border-radius: 50%;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    color: #222;
}

#home-btn:hover {
    background-color: #222;
    color: #fff;
    transform: scale(1.06);
}

/* UI ELEMENTS */
.sidebar-title {
    margin-top: 0;
    color: #111;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.sidebar-desc {
    font-size: 12px;
    color: #666;
    margin-top: 0;
    margin-bottom: 18px;
    line-height: 1.45;
}

.control-group {
    margin-bottom: 18px;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 13px;
    color: #333;
}

select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
    background-color: #fafafa;
    color: #222;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s ease;
}

select:focus {
    border-color: #111;
    outline: none;
}

.input-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

input[type=range] {
    width: 100%;
    cursor: pointer;
    accent-color: #222;
}

input[type=checkbox] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #222;
}

span.val-display {
    float: right;
    font-weight: 600;
    color: #555;
    font-size: 12px;
}

.section-header {
    font-size: 10px;
    text-transform: uppercase;
    color: #888;
    margin-top: 18px;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
    letter-spacing: 1px;
    font-weight: 700;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 13px;
    color: #333;
}

#vignette-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    background: radial-gradient(circle, rgba(0, 0, 0, 0) 65%, rgba(0, 0, 0, 0.12) 100%);
}
