:root {
    --primary: #b72937;
    --dark: #121212;
    --light-bg: #f8f9fa;
    --border: #e2e8f0;
    --sidebar-w: 360px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', sans-serif;
    background: var(--light-bg);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    flex-shrink: 0;
}

.brand { padding: 20px 25px; border-bottom: 1px solid var(--border); }
.logo { font-weight: 800; font-size: 1.6rem; letter-spacing: -1px; }
.logo span { color: var(--primary); }

.studio-tabs { display: flex; padding: 10px 15px; border-bottom: 1px solid var(--border); }
.tab-btn {
    flex: 1; padding: 12px 5px; border: none; background: none; cursor: pointer;
    font-size: 0.65rem; font-weight: 700; color: #a0aec0;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.tab-btn.active { color: var(--primary); }

.tab-content { 
    flex: 1; 
    overflow-y: auto; 
    padding: 20px;
}

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* MAIN VIEW & VISUALIZER - REPARAȚIE MASCĂ */
.main-view { 
    flex: 1; 
    background: #f0f2f5; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    position: relative;
    padding: 20px;
}

.layers-container { 
    position: relative; 
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
}

/* Imaginea de baza dicteaza marimea la care se raporteaza mastile */
.img-base { 
    max-width: 100%; 
    max-height: 100%;
    object-fit: contain;
    display: block;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

/* Straturile de masca trebuie sa copieze EXACT pozitia si marimea pozei de baza */
.mask-layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Folosim variabilele CSS care vor fi setate din JS pt sincronizare */
    width: var(--img-w, 100%);
    height: var(--img-h, 100%);
    pointer-events: none;
}

#hotspot-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2000;
}

.mask-layer {
    pointer-events: none; 
    opacity: 0; 
    transition: opacity 0.4s ease;
    background-size: 150px; 
    background-repeat: repeat;
    
    /* Proprietati de mascare robuste pentru decupaj (Luminance Clipping) */
    -webkit-mask-size: 100% 100%; 
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    
    /* Interpretam negrul ca transparent si albul ca vizibil */
    -webkit-mask-mode: luminance;
    mask-mode: luminance;
}

/* HOTSPOTS */
.hotspot-point {
    position: absolute;
    width: 28px; height: 28px;
    background: rgba(255, 255, 255, 0.9);
    border: 4px solid var(--primary);
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 0 15px rgba(0,0,0,0.5);
    animation: hotspot-pulse 2s infinite;
    transform: translate(-50%, -50%);
    z-index: 2000;
}

@keyframes hotspot-pulse {
    0% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0px rgba(183, 41, 55, 0.7); }
    70% { transform: translate(-50%, -50%) scale(1.2); box-shadow: 0 0 0 10px rgba(183, 41, 55, 0); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* DECOR GRID */
.decor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.decor-card { 
    border-radius: 12px; overflow: hidden; cursor: pointer; border: 2px solid transparent; 
    background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.06); transition: 0.3s;
}
.decor-card:hover { transform: translateY(-3px); box-shadow: 0 8px 15px rgba(0,0,0,0.1); }
.decor-card .img-box { aspect-ratio: 1.1; background-size: cover; background-position: center; }
.decor-card .info { padding: 10px 5px; font-size: 0.7rem; font-weight: 700; text-align: center; }
.decor-card.active { border-color: var(--primary); }

/* MOBILE */
@media (max-width: 768px) {
    body { 
        flex-direction: column !important; 
        height: 100vh !important; 
        overflow: hidden !important; 
        display: flex !important;
    }
    .main-view { 
        height: 40vh !important; 
        min-height: 250px;
        flex: none !important; 
        order: -1 !important; 
        padding: 10px;
        background: #f0f2f5;
        border-bottom: 2px solid var(--border);
        z-index: 1000;
    }
    .sidebar { 
        flex: 1 !important; 
        width: 100% !important; 
        height: 60vh !important; 
        display: flex !important; 
        flex-direction: column !important; 
        border-right: none;
        overflow: hidden !important;
    }
    .tab-content { 
        flex: 1 !important;
        overflow-y: auto !important; 
        -webkit-overflow-scrolling: touch;
        padding: 15px; 
        display: block !important; 
    }
    .tab-pane.active { display: block !important; }
    .decor-grid { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 12px !important; }
}

/* CATEGORII & FILTRE */
.scene-categories, .sub-filters { 
    display: flex; 
    gap: 8px; 
    margin-bottom: 20px; 
    overflow-x: auto; 
    padding-bottom: 8px; 
    scrollbar-width: none; /* Ascundem scrollbar pe Firefox */
}
.scene-categories::-webkit-scrollbar, .sub-filters::-webkit-scrollbar { display: none; } /* Ascundem scrollbar pe Chrome/Safari */

.cat-tag, .f-tag { 
    padding: 8px 16px; 
    background: #edf2f7; 
    border: none; 
    border-radius: 20px; 
    font-size: 0.75rem; 
    font-weight: 600; 
    cursor: pointer; 
    white-space: nowrap;
    transition: all 0.2s ease;
    color: #4a5568;
}

.cat-tag.active, .f-tag.active { 
    background: var(--dark); 
    color: #fff; 
}

.filter-bar h4 {
    font-size: 0.85rem;
    margin-bottom: 12px;
    color: var(--dark);
    font-weight: 700;
}

.scene-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.scene-card { border-radius: 12px; overflow: hidden; cursor: pointer; position: relative; border: 2px solid transparent; }
.scene-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.scene-card.active { border-color: var(--primary); }
.card-overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: 8px; background: rgba(0,0,0,0.6); color: #fff; font-size: 0.7rem; text-align: center; }

.part-selector { display: flex; flex-direction: column; gap: 8px; margin-bottom: 25px; }
.part-btn { padding: 14px; background: #fff; border: 1px solid var(--border); border-radius: 12px; text-align: left; font-weight: 700; font-size: 0.8rem; cursor: pointer; display: flex; align-items: center; gap: 12px; }
.part-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.summary-card { background: var(--light-bg); padding: 20px; border-radius: 12px; border: 1px solid var(--border); }
.sum-row { display: flex; justify-content: space-between; margin-bottom: 12px; border-bottom: 1px dashed #cbd5e0; padding-bottom: 12px; font-size: 0.8rem; }
.btn-main { width: 100%; padding: 15px; background: var(--dark); color: #fff; border: none; border-radius: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; }