/* 3D Home Builder Styles */
.homebuilder-wrapper {
    position: relative;
    user-select: none;
    font-family: inherit;
}

/* 3D Viewport Host */
.hb-viewport-card {
    border-radius: 0.75rem;
    overflow: hidden;
    background: #0b131e;
}

.hb-canvas-wrapper {
    width: 100%;
    height: 600px;
    position: relative;
    outline: none;
    cursor: default;
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}

@media (max-width: 991.98px) {
    .hb-canvas-wrapper {
        height: 480px;
    }
}

@media (max-width: 575.98px) {
    .hb-canvas-wrapper {
        height: 380px;
    }
}

.hb-canvas-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
    outline: none;
}

/* Loading Overlay */
.hb-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.9);
    z-index: 50;
    backdrop-filter: blur(8px);
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.hb-loading-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Floating HUDs */
.hb-overlay-hud {
    position: absolute;
    z-index: 10;
    pointer-events: auto;
}

.hb-overlay-hud.top-left {
    top: 12px;
    left: 12px;
}

.hb-overlay-hud.top-right {
    top: 12px;
    right: 12px;
}

.hb-overlay-hud.bottom-left {
    bottom: 12px;
    left: 12px;
}

.hb-hud-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    backdrop-filter: blur(4px);
    transition: all 0.15s ease;
}

.hb-hud-btn:hover {
    background-color: rgba(255, 255, 255, 0.25) !important;
    transform: scale(1.05);
}

/* Placement Toast */
.hb-overlay-toast {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.85);
    color: #f8fafc;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(6px);
    z-index: 10;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@media (max-width: 575.98px) {
    .hb-overlay-toast {
        display: none;
    }
}

/* Catalog Panel */
.hb-catalog-card {
    height: 600px;
    display: flex;
    flex-direction: column;
}

.hb-catalog-scroll {
    overflow-y: auto;
    flex-grow: 1;
    max-height: 500px;
}

.hb-cat-pills .nav-link {
    border-radius: 6px;
    font-weight: 500;
    color: var(--bs-body-color);
}

.hb-cat-pills .nav-link.active {
    background-color: var(--bs-primary);
    color: #ffffff;
}

/* Catalog Item Tiles */
.hb-catalog-item {
    cursor: pointer;
    border: 1px solid var(--bs-border-color, #e2e8f0);
    border-radius: 8px;
    padding: 8px 6px;
    text-align: center;
    background: var(--bs-body-bg, #ffffff);
    transition: all 0.18s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 74px;
}

.hb-catalog-item:hover {
    border-color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle, #e0f2fe);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}

.hb-catalog-item.active-placing {
    border-color: var(--bs-primary);
    background: var(--bs-primary);
    color: #ffffff !important;
    box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.3);
}

.hb-catalog-item.active-placing i,
.hb-catalog-item.active-placing .hb-item-title {
    color: #ffffff !important;
}

.hb-catalog-item .hb-item-icon {
    font-size: 1.4rem;
    line-height: 1;
    margin-bottom: 4px;
}

.hb-catalog-item .hb-item-title {
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hb-catalog-item .hb-item-price {
    font-size: 0.68rem;
    opacity: 0.75;
    margin-top: 2px;
}

/* Mobile catalog item strip */
.mobile-catalog-strip {
    scrollbar-width: thin;
}

.mobile-catalog-strip .mobile-item-btn {
    min-width: 80px;
    flex-shrink: 0;
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 8px;
}

/* Inspector Card */
.hb-inspector-card {
    min-height: 400px;
}

.hb-material-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hb-mat-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.hb-mat-swatch:hover {
    transform: scale(1.15);
}

.hb-mat-swatch.active {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #0ea5e9;
    transform: scale(1.1);
}

/* Cost card */
.cost-estimate-card {
    background: var(--bs-tertiary-bg, #f1f5f9);
    border: 1px solid var(--bs-border-color, #e2e8f0);
}

/* Template Cards */
.template-card {
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.border-hover-primary:hover {
    border-color: var(--bs-primary) !important;
}

.border-hover-warning:hover {
    border-color: var(--bs-warning) !important;
}

.border-hover-success:hover {
    border-color: var(--bs-success) !important;
}

/* Walkthrough Mode HUD */
.hb-walk-overlay {
    position: absolute;
    inset: 0;
    z-index: 25;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
}

.hb-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.8rem;
    font-weight: 300;
    line-height: 1;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

.hb-walk-instructions {
    pointer-events: auto;
    max-width: 90%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    animation: fadeInDown 0.3s ease;
}

.hb-exit-walk-btn {
    pointer-events: auto;
    border-radius: 20px;
    padding: 6px 18px;
    font-weight: 600;
    animation: fadeInUp 0.3s ease;
}

/* Mobile Virtual Joystick */
.hb-mobile-walk-controls {
    position: absolute;
    bottom: 24px;
    left: 24px;
    pointer-events: auto;
    z-index: 30;
}

.hb-joystick-base {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    position: relative;
    backdrop-filter: blur(4px);
    touch-action: none;
}

.hb-joystick-thumb {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #0ea5e9;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.05s linear;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}
