/* ==========================================================================
   Room Maker - Sleek Compact Header Design
   Design pulito, moderno, ultra-compatto (Light mode di default, Dark mode supportata)
   ========================================================================== */

.editor-compact-header {
    height: 56px;
    min-height: 56px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03), 0 4px 12px rgba(0, 0, 0, 0.02);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    z-index: 1000;
    position: sticky;
    top: 0;
    gap: 8px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
}

/* Adjust editor container height to match 56px compact header */
.editor-page .editor-container,
.editor-compact-header + .editor-container {
    height: calc(100vh - 56px) !important;
}

/* Left Section: Brand & Badge */
.editor-compact-header .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.editor-compact-header .demo-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: #0f172a;
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.editor-compact-header .demo-logo:hover {
    opacity: 0.85;
}

.editor-compact-header .demo-logo svg,
.editor-compact-header .text-accent {
    color: #ea580c;
}

.editor-compact-header .demo-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(234, 88, 12, 0.1);
    border: 1px solid rgba(234, 88, 12, 0.35);
    border-radius: 9999px;
    color: #ea580c;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.editor-compact-header .project-badge {
    background: rgba(0, 88, 163, 0.08);
    border-color: rgba(0, 88, 163, 0.25);
    color: #0058a3;
    max-width: 200px;
}

.editor-compact-header .project-badge #projectName {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 700;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.editor-compact-header .pulse-dot {
    width: 7px;
    height: 7px;
    background: currentColor;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.5);
    animation: pulseHeaderDot 2s infinite;
}

@keyframes pulseHeaderDot {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(234, 88, 12, 0.6);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 5px rgba(234, 88, 12, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(234, 88, 12, 0);
    }
}

/* Center Section: Controls & Tools */
.editor-compact-header .header-center {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
    min-width: 0;
    flex-shrink: 1;
}

/* View Switcher Pill Group */
.editor-compact-header .view-switch-group {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 3px;
    border-radius: 10px;
    display: flex;
    gap: 2px;
    align-items: center;
    flex-shrink: 0;
}

.editor-compact-header .view-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.editor-compact-header .view-btn:hover {
    color: #0f172a;
    background: rgba(0, 0, 0, 0.04);
}

.editor-compact-header .view-btn.active {
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.35);
}

.editor-compact-header .tool-divider {
    width: 1px;
    height: 20px;
    background: #e2e8f0;
    margin: 0 2px;
    flex-shrink: 0;
}

/* Tool Buttons */
.editor-compact-header .tool-btn {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 9px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    white-space: nowrap;
    flex-shrink: 0;
}

.editor-compact-header .tool-btn:hover {
    color: #0f172a;
    border-color: #cbd5e1;
    background: #f8fafc;
    transform: translateY(-1px);
}

.editor-compact-header .tool-btn:active {
    transform: translateY(0);
}

.editor-compact-header .tool-btn.active {
    background: rgba(234, 88, 12, 0.1);
    border-color: #ea580c;
    color: #ea580c;
}

.editor-compact-header .tool-btn-icon {
    padding: 5px 8px;
    min-width: 32px;
    justify-content: center;
}

.editor-compact-header .tool-btn-warning:hover {
    border-color: #f59e0b;
    color: #d97706;
    background: rgba(245, 158, 11, 0.08);
}

/* Responsive Hide Labels */
@media (max-width: 1540px) {
    .editor-compact-header .tool-btn .btn-label {
        display: none;
    }
    .editor-compact-header .tool-btn {
        padding: 5px 8px;
        min-width: 32px;
        justify-content: center;
    }
}

@media (max-width: 1300px) {
    .editor-compact-header #bomLiveCount,
    .editor-compact-header .bom-sep {
        display: none;
    }
}

/* Right Section: BOM & CTA Actions */
.editor-compact-header .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Live BOM Pill */
.editor-compact-header .live-bom-pill {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 6px 14px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    white-space: nowrap;
}

.editor-compact-header .live-bom-pill:hover {
    border-color: #ea580c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.15);
}

.editor-compact-header .bom-sep {
    color: #cbd5e1;
}

.editor-compact-header .bom-price {
    font-weight: 700;
    color: #ea580c;
}

/* Ghost / Back Button */
.editor-compact-header .btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    cursor: pointer;
    background: transparent;
}

.editor-compact-header .btn-ghost:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #e2e8f0;
}

/* Primary CTA Button (Salva / Registrati) */
.editor-compact-header .btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #ffffff !important;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
    border: none;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(234, 88, 12, 0.35);
    white-space: nowrap;
    flex-shrink: 0;
}

.editor-compact-header .btn-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(234, 88, 12, 0.45);
    filter: brightness(1.05);
}

.editor-compact-header .btn-cta:active {
    transform: translateY(0);
}

.editor-compact-header .btn-disabled {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 9px;
    font-size: 0.8rem;
    color: #94a3b8;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    cursor: not-allowed;
}

/* ==========================================================================
   Dark Theme Variant
   ========================================================================== */
body.dark-theme .editor-compact-header,
body[data-theme="dark"] .editor-compact-header {
    background: rgba(18, 24, 38, 0.95);
    border-bottom-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.dark-theme .editor-compact-header .demo-logo,
body[data-theme="dark"] .editor-compact-header .demo-logo {
    color: #f8fafc;
}

body.dark-theme .editor-compact-header .view-switch-group,
body[data-theme="dark"] .editor-compact-header .view-switch-group {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .editor-compact-header .view-btn,
body[data-theme="dark"] .editor-compact-header .view-btn {
    color: #94a3b8;
}

body.dark-theme .editor-compact-header .view-btn:hover,
body[data-theme="dark"] .editor-compact-header .view-btn:hover {
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.08);
}

body.dark-theme .editor-compact-header .tool-divider,
body[data-theme="dark"] .editor-compact-header .tool-divider {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-theme .editor-compact-header .tool-btn,
body[data-theme="dark"] .editor-compact-header .tool-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
}

body.dark-theme .editor-compact-header .tool-btn:hover,
body[data-theme="dark"] .editor-compact-header .tool-btn:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.1);
}

body.dark-theme .editor-compact-header .live-bom-pill,
body[data-theme="dark"] .editor-compact-header .live-bom-pill {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

body.dark-theme .editor-compact-header .bom-sep,
body[data-theme="dark"] .editor-compact-header .bom-sep {
    color: #475569;
}

body.dark-theme .editor-compact-header .btn-ghost,
body[data-theme="dark"] .editor-compact-header .btn-ghost {
    color: #94a3b8;
}

body.dark-theme .editor-compact-header .btn-ghost:hover,
body[data-theme="dark"] .editor-compact-header .btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   Properties Sidebar Alignment (flush under compact header: 56px)
   ========================================================================== */
.properties-sidebar {
    top: 56px !important;
    height: calc(100vh - 56px) !important;
    border-left: 1px solid #e2e8f0;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.08) !important;
}

.properties-panel {
    top: 76px !important;
}

body.dark-theme .properties-sidebar,
body[data-theme="dark"] .properties-sidebar {
    background: #0f172a;
    border-left-color: #1e293b;
    color: #f8fafc;
}

/* ==========================================================================
   Floating In-Scene Quick Action Bar (Object HUD)
   ========================================================================== */
.object-quick-hud {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 120;
    pointer-events: auto;
    animation: hudSlideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: calc(100% - 32px);
}

/* When right properties sidebar is open, center in the remaining visible 3D canvas area so it never overlaps on the right! */
.editor-container:has(.properties-sidebar.open) .object-quick-hud,
body.has-properties-open .object-quick-hud {
    left: calc(50% - 170px);
}

.editor-container:has(.properties-sidebar.open) .viewer-controls,
body.has-properties-open .viewer-controls {
    right: 360px;
    transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Hide obsolete bottom status bar permanently to eliminate overlapping */
.status-bar,
#statusBar {
    display: none !important;
}

@keyframes hudSlideUp {
    from {
        opacity: 0;
        transform: translate(-50%, 14px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

.hud-pill {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 5px 8px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 9999px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32), 0 2px 6px rgba(0, 0, 0, 0.2);
    color: #f8fafc;
}

.hud-item.hud-name {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 6px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fdba74;
    white-space: nowrap;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hud-item.hud-name svg {
    width: 13px !important;
    height: 13px !important;
    max-width: 13px !important;
    max-height: 13px !important;
    flex-shrink: 0;
    display: block;
}

.hud-sep {
    width: 1px;
    height: 16px;
    background: rgba(255, 255, 255, 0.16);
    margin: 0 2px;
}

.hud-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    background: transparent;
    border: none;
    border-radius: 9999px;
    color: #e2e8f0;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.16s ease;
    white-space: nowrap;
}

.hud-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    transform: translateY(-1px);
}

.hud-btn:active {
    transform: translateY(0);
}

.hud-btn-danger {
    color: #fca5a5;
}

.hud-btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fecaca;
}

/* ==========================================================================
   Finishes & Materials Modal Styling
   ========================================================================== */
.finishes-tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
}

.finishes-tab-btn.active {
    background: #0f172a;
    color: #ffffff;
}

.finishes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    max-height: 420px;
    overflow-y: auto;
    padding: 4px;
}

.finish-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.finish-card:hover {
    border-color: #ea580c;
    box-shadow: 0 6px 18px rgba(234, 88, 12, 0.12);
    transform: translateY(-2px);
}

.finish-card.active {
    border-color: #ea580c;
    background: #fff7ed;
    box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.25);
}

.finish-preview {
    width: 100%;
    height: 70px;
    border-radius: 6px;
    margin-bottom: 8px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.finish-title {
    font-size: 0.74rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    margin-bottom: 2px;
}

.finish-tag {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #94a3b8;
}

/* ==========================================================================
   Wall Distance & Alignment Helper in Properties Sidebar
   ========================================================================== */
.wall-align-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 8px;
}

.wall-dist-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 4px;
    text-align: center;
}

.wall-dist-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    display: block;
    margin-bottom: 2px;
}

.wall-dist-val {
    font-size: 0.74rem;
    font-weight: 800;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.wall-snap-btn {
    margin-top: 4px;
    width: 100%;
    padding: 3px 0;
    background: #e2e8f0;
    border: none;
    border-radius: 4px;
    font-size: 0.64rem;
    font-weight: 700;
    color: #334155;
    cursor: pointer;
    transition: background 0.15s;
}

.wall-snap-btn:hover {
    background: #cbd5e1;
    color: #0f172a;
}
