/* ==========================================================================
   INTERACTIVE VISUALIZER COMPONENT STYLES
   ========================================================================== */

/* 1. LAYOUT CONTROLLERS */
.visualizer-grid-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
    align-items: start;
    margin-top: 1rem;
}

@media (max-width: 1024px) {
    .visualizer-grid-layout {
        grid-template-columns: 1fr;
    }
}

/* 2. STICKY MATERIALS SIDEBAR */
.visualizer-materials-sidebar {
    background: var(--color-bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: var(--shadow-premium);
}

.sidebar-sticky-content {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.sidebar-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    color: #FFF;
    margin-bottom: 0.5rem;
    border-left: 3px solid var(--color-gold);
    padding-left: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Upload Custom Material Section */
.custom-upload-section {
    margin-bottom: 0.5rem;
}

.upload-action-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--color-bg-tertiary);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.upload-action-box:hover {
    border-color: var(--color-gold);
    background: rgba(255,255,255,0.02);
}

.upload-action-box i {
    font-size: 1.5rem;
    color: var(--color-gold);
    margin-bottom: 0.3rem;
}

.upload-action-box p {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    font-weight: 600;
}

#customMaterialBadge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(37, 211, 102, 0.1);
    border: 1px solid rgba(37, 211, 102, 0.3);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    color: #25D366;
    margin-top: 0.5rem;
}

#customMaterialBadge button {
    background: none;
    border: none;
    color: #ff4d4d;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

/* Scrolling Materials List */
.materials-scroll-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    max-height: calc(100vh - 350px);
    overflow-y: auto;
    padding-right: 0.5rem;
}

.materials-scroll-list::-webkit-scrollbar {
    width: 4px;
}

.materials-scroll-list::-webkit-scrollbar-thumb {
    background: var(--color-gold);
    border-radius: 2px;
}

/* Material list item adaptions */
.materials-scroll-list .slab-thumb-item {
    display: flex;
    align-items: center;
    text-align: left;
    flex: none;
    width: 100%;
    background: var(--color-bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.materials-scroll-list .slab-thumb-img-wrapper {
    width: 80px;
    height: 60px;
    flex-shrink: 0;
    background: #000;
}

.materials-scroll-list .slab-thumb-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.materials-scroll-list .slab-thumb-info {
    padding: 0.6rem 0.8rem;
    overflow: hidden;
}

.materials-scroll-list .slab-thumb-info h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    color: #FFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
}

.materials-scroll-list .slab-thumb-info p {
    font-size: 0.75rem;
    color: var(--color-gold);
    font-weight: 600;
}

.materials-scroll-list .slab-thumb-item:hover,
.materials-scroll-list .slab-thumb-item.active {
    border-color: var(--color-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(212,175,55,0.15);
}

.materials-scroll-list .slab-thumb-item.active {
    background: rgba(212, 175, 55, 0.05);
}

/* Mobile responsive materials scroll */
@media (max-width: 1024px) {
    .materials-scroll-list {
        flex-direction: row;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 0.5rem;
    }
    
    .materials-scroll-list .slab-thumb-item {
        width: 150px;
        flex-direction: column;
    }
    
    .materials-scroll-list .slab-thumb-img-wrapper {
        width: 100%;
        height: 80px;
    }
    
    .sidebar-sticky-content {
        position: static;
    }
}

/* 3. INTERACTIVE ROOMS GRID */
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1200px) {
    .rooms-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .rooms-grid {
        grid-template-columns: 1fr;
    }
}

.room-card {
    background: #000;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-premium);
    cursor: pointer;
    position: relative;
    transition: var(--transition-smooth);
}

.room-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-gold);
    box-shadow: 0 10px 25px rgba(212, 175, 55, 0.2);
}

.room-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
}

.room-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.room-card:hover .room-bg-img {
    transform: scale(1.03);
}

.room-3d-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 800px;
    height: 500px;
    transform-origin: top left;
    pointer-events: none;
    z-index: 2;
}

.room-svg-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

/* Glowing golden dashed borders outlining stone areas */
.room-svg-overlay polygon,
.visualizer-canvas-svg polygon {
    stroke: var(--color-gold);
    stroke-width: 1.5px;
    stroke-dasharray: 4;
    fill: none;
    transition: stroke-width 0.3s ease, filter 0.3s ease;
}

.room-card:hover .room-svg-overlay polygon {
    stroke-width: 2.5px;
    filter: drop-shadow(0 0 5px var(--color-gold));
}

.room-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.2rem;
    z-index: 4;
}

.room-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: #FFF;
    margin-bottom: 0.2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
}

.click-to-edit {
    font-size: 0.75rem;
    color: var(--color-gold);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 500;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.room-card:hover .click-to-edit {
    opacity: 1;
}

/* 4. LIGHTBOX MODAL CONTAINER */
.lightbox-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox-modal.show {
    display: flex;
    opacity: 1;
}

.lightbox-card {
    background: var(--color-bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    width: 100%;
    max-width: 1200px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    position: relative;
    overflow: hidden;
    animation: zoomIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomIn {
    from { transform: scale(0.92); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.lightbox-close {
    position: absolute;
    top: 1.2rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 2.2rem;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition-smooth);
}

.lightbox-close:hover {
    color: #ff4d4d;
    transform: scale(1.1);
}

.lightbox-grid {
    display: grid;
    grid-template-columns: 1fr 350px;
    min-height: 500px;
}

@media (max-width: 992px) {
    .lightbox-grid {
        grid-template-columns: 1fr;
    }
    
    .lightbox-modal {
        padding: 1rem;
        overflow-y: auto;
    }
    
    .lightbox-card {
        border-radius: 16px;
    }
    
    .lightbox-sidebar {
        border-left: none !important;
        border-top: 1px solid var(--glass-border);
    }
}

.lightbox-viewport-wrapper {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    aspect-ratio: 16 / 10;
}

.visualizer-viewport-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.visualizer-bg-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.visualizer-canvas-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

.lightbox-sidebar {
    padding: 2rem;
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: #FFF;
}

.active-material-box {
    background: var(--color-bg-tertiary);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
}

.active-material-box .label {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.active-material-box h4 {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    color: var(--color-gold);
    margin-top: 0.2rem;
    font-weight: 600;
}

.texture-controls-group {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-item label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    display: flex;
    justify-content: space-between;
}

.control-item label span {
    color: var(--color-gold);
}

.control-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--color-bg-tertiary);
    outline: none;
}

.control-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-gold);
    cursor: pointer;
    transition: transform 0.1s ease;
}

.control-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.action-buttons-group {
    display: flex;
    gap: 0.8rem;
    margin-top: auto;
}

.action-buttons-group .btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem;
    font-size: 0.85rem;
}
