/* ===========================
   GLOBAL STYLES
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #121212;
    color: #f5f5f5;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===========================
   MAIN LAYOUT
   =========================== */
#main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ===========================
   VIEWER CONTAINER (LEFT)
   =========================== */
#viewer-container {
    flex: 1;
    background-color: #e5e5e5;
    position: relative;
}

#rooom-viewer-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ===========================
   CONFIG SIDEBAR (RIGHT) - DARK MODE
   =========================== */
#config-sidebar {
    width: 450px;
    background: #1a1a1a;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ===========================
   VERTICAL CATEGORIES - KLARE ABGRENZUNG
   =========================== */
#config-categories {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.category-section {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #2a2a2a;
}

.category-section:last-child {
    border-bottom: none;
}

.category-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #008080;
    margin-bottom: 0.8rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
}

.category-title:hover {
    color: #00a8a8;
    text-shadow: 0 0 8px rgba(0, 128, 128, 0.4);
    transform: translateX(3px);
}

/* ===========================
   COLOR OPTIONS (GRID) - DARK MODE
   =========================== */
.options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.color-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-option:hover .color-sphere {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.color-sphere {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
    position: relative;
}

.color-option.selected .color-sphere {
    border-color: #008080;
    border-width: 4px;
    box-shadow: 0 0 0 2px rgba(0, 128, 128, 0.3), 0 6px 16px rgba(0, 0, 0, 0.5);
}

.color-name {
    font-size: 0.6rem;
    font-weight: 500;
    color: #d0d0d0;
    text-align: center;
    line-height: 1.2;
}

.color-ral {
    font-size: 0.55rem;
    font-weight: 400;
    color: #a0a0a0;
    text-align: center;
}

.color-option.selected .color-name {
    color: #f5f5f5;
    font-weight: 600;
}

.color-option.selected .color-ral {
    color: #008080;
}

/* Accordion: collapsed category hides options */
.category-section.collapsed .options-grid {
    display: none;
}

/* Custom color picker bubble */
.color-option-custom {
    position: relative;
}

.color-option-custom .color-sphere {
    border-style: dashed;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f5f5f5;
    font-size: 1.4rem;
    font-weight: 600;
}

.color-sphere-custom-plus {
    pointer-events: none;
}

/* Invisible native color input overlay so the picker opens at the bubble */
.color-input-hidden {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* If custom color chosen, show the color in the sphere */
.color-option-custom .color-sphere[style*="background-color"] {
    border-style: solid;
}

/* Material Squares (for floor/texture options) */
.material-square {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.color-option.selected .material-square {
    border-color: #008080;
    border-width: 4px;
    box-shadow: 0 0 0 2px rgba(0, 128, 128, 0.3), 0 6px 16px rgba(0, 0, 0, 0.5);
}

/* ===========================
   COMPONENT/ACCESSORY OPTIONS (LIST)
   =========================== */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.list-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.list-option:hover {
    background: #f9f9f9;
    border-color: #00A878;
}

.list-option.selected {
    background: #e6f7f2;
    border-color: #00A878;
}

.option-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid #ccc;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.list-option.selected .option-checkbox {
    background: #00A878;
    border-color: #00A878;
}

.option-checkbox::after {
    content: '✓';
    color: white;
    font-size: 16px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.list-option.selected .option-checkbox::after {
    opacity: 1;
}

.option-info {
    flex: 1;
}

.option-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
}

.option-description {
    font-size: 0.75rem;
    color: #666;
}

/* ===========================
   RESPONSIVE
   =========================== */
@media (max-width: 1024px) {
    #config-sidebar {
        width: 380px;
    }
}

@media (max-width: 768px) {
    #main-layout {
        flex-direction: column;
    }

    #config-sidebar {
        width: 100%;
        max-height: 50vh;
    }

    #viewer-container {
        height: 50vh;
    }

    #config-categories {
        gap: 2rem;
    }
}
