:root {
    --p-bg: #030712;
    --p-sidebar: rgba(11, 15, 26, 0.7);
    --p-dark: #f8fafc;
    --p-border: rgba(255, 255, 255, 0.08);
    --p-accent: #6d28d9;
    --p-accent-bright: #a855f7;
    --p-grid: rgba(255, 255, 255, 0.02);
    --p-card-bg: rgba(30, 41, 59, 0.4);
    --p-glass: blur(16px);
    --p-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
}

* {
    box-sizing: border-box;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

body {
    overflow-y: auto !important;
    overflow-x: hidden;
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--p-bg);
}

/* Hide Site Header on Planner */
#mainHeader,
.mobile-bottom-nav {
    display: none !important;
}

body {
    overflow: hidden !important;
    /* Lock scroll for full screen app experience */
    margin: 0;
    height: 100vh;
}

.planner-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    background: var(--p-bg);
    overflow: hidden;
}

.planner-toolbar {
    height: 70px;
    background: var(--p-sidebar);
    backdrop-filter: var(--p-glass);
    border-bottom: 1px solid var(--p-border);
    display: flex;
    align-items: center;
    padding: 0 25px;
    justify-content: space-between;
    box-shadow: var(--p-shadow);
    z-index: 1000;
    position: sticky;
    top: 0;
}

.brand {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--p-dark);
}

.brand sup {
    color: var(--p-accent);
    font-size: 0.7rem;
}

.actions {
    display: flex;
    gap: 8px;
    align-items: center;
    overflow: visible !important;
    /* 🕵️‍♂️ Gizli Not: Dropdown menülerin gözükmesi için 'visible' olmalı. */
}

.actions::-webkit-scrollbar {
    display: none;
}

.btn-tool {
    background: transparent;
    border: 1px solid transparent;
    padding: 8px 15px;
    border-radius: 6px;
    color: #64748b;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-tool:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

@media (max-width: 1200px) {
    .btn-tool span {
        display: none;
    }

    .btn-tool {
        padding: 10px;
        font-size: 1.1rem;
    }
}

.btn-tool.active {
    background: rgba(139, 92, 246, 0.15);
    color: var(--p-accent);
    border-color: var(--p-accent);
}

.layer-row.active {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--p-accent);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.2);
}

.layer-row.locked {
    background: rgba(245, 158, 11, 0.05);
    border-color: rgba(245, 158, 11, 0.3);
}

.layer-row.locked .layer-info {
    opacity: 0.7;
}

.btn-action {
    background: var(--p-accent);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.btn-action:hover {
    background: #4f46e5;
}

.divider {
    width: 1px;
    height: 25px;
    background: var(--p-border);
    margin: 0 5px;
}

/* Professional Menu Bar */
.menu-item {
    position: relative;
    display: inline-block;
}

.menu-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 8px 15px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.menu-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #1e293b;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    border: 1px solid var(--p-border);
    border-radius: 8px;
    top: 100%;
    left: 0;
    padding: 8px 0;
    animation: fadeIn 0.2s ease;
}

.menu-item:hover .dropdown-content {
    display: block;
}

.dropdown-content button,
.dropdown-content .sub-title {
    color: #cbd5e1;
    padding: 10px 15px;
    text-decoration: none;
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-content button i {
    width: 20px;
    margin-right: 8px;
    color: #94a3b8;
}

.dropdown-content button:hover {
    background-color: var(--p-accent);
    color: white;
}

.dropdown-content button:hover i {
    color: white;
}

.sub-divider {
    height: 1px;
    background: var(--p-border);
    margin: 5px 0;
}

.sub-menu {
    position: relative;
}

.sub-dropdown {
    display: none;
    position: absolute;
    left: 100%;
    top: -8px;
    min-width: 160px;
    background-color: #1e293b;
    box-shadow: 8px 8px 16px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--p-border);
    border-radius: 8px;
    padding: 8px 0;
}

.sub-menu:hover .sub-dropdown {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Professional Menu System */
.menu-bar {
    display: flex;
    gap: 5px;
    align-items: center;
}

.menu-item {
    position: relative;
}

.menu-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    padding: 8px 15px;
    cursor: pointer;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: 0.2s;
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #1e293b;
    border: 1px solid var(--p-border);
    border-radius: 8px;
    min-width: 220px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    padding: 5px;
    margin-top: 5px;
}

.menu-item:hover .dropdown-content {
    display: block;
}

.dropdown-content button {
    width: 100%;
    background: transparent;
    border: none;
    color: #cbd5e1;
    padding: 10px 15px;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-content button:hover {
    background: rgba(139, 92, 246, 0.2);
    color: white;
}

.dropdown-content button.active {
    background: rgba(139, 92, 246, 0.3);
    color: var(--p-accent);
}

.dropdown-content button i {
    width: 16px;
    text-align: center;
}

.sub-divider {
    height: 1px;
    background: var(--p-border);
    margin: 5px 0;
}

/* Sub-menu (nested) support */
.sub-menu {
    position: relative;
}

.sub-title {
    display: block;
    padding: 10px 15px;
    color: #cbd5e1;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: 0.2s;
}

.sub-title:hover {
    background: rgba(139, 92, 246, 0.2);
    color: white;
}

.sub-title i:first-child {
    margin-right: 10px;
}

.sub-dropdown {
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    background: #1e293b;
    border: 1px solid var(--p-border);
    border-radius: 8px;
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 5px;
    margin-left: 5px;
}

.sub-menu:hover .sub-dropdown {
    display: block;
}

.sub-dropdown button {
    width: 100%;
    background: transparent;
    border: none;
    color: #cbd5e1;
    padding: 10px 15px;
    text-align: left;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sub-dropdown button:hover {
    background: rgba(139, 92, 246, 0.2);
    color: white;
}

.sub-dropdown button i {
    width: 16px;
    text-align: center;
}

.planner-main {
    flex: 1;
    display: flex;
    overflow: hidden;
    /* No global scroll */
    height: calc(100vh - 70px);
}

.planner-sidebar {
    width: 320px;
    background: var(--p-sidebar);
    backdrop-filter: var(--p-glass);
    border-right: 1px solid var(--p-border);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 100;
}

.sidebar-tabs {
    display: flex;
    border-bottom: 1px solid var(--p-border);
    flex-shrink: 0;
}

.sidebar-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.tab-btn {
    flex: 1;
    padding: 12px 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #94a3b8;
    border-bottom: 2px solid transparent;
    position: relative;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

/* Tooltip implementation */
.tab-btn::after {
    content: attr(data-title);
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #1e293b;
    color: #fff;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 1000;
    border: 1px solid var(--p-border);
}

.tab-btn:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.tab-btn.active {
    color: var(--p-accent-bright);
    border-bottom: 2px solid var(--p-accent-bright);
    background: linear-gradient(to bottom, transparent, rgba(139, 92, 246, 0.05));
}

.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow-y: auto !important;
    padding: 20px;
    min-height: 0;
}

.tab-content.active {
    display: flex !important;
}

.cat-pill {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--p-border);
    color: #94a3b8;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cat-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    transform: translateY(-1px);
}

.cat-pill.active {
    background: linear-gradient(135deg, var(--p-accent), var(--p-accent-bright));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.4);
}

.p-card {
    background: var(--p-card-bg);
    border: 1px solid var(--p-border);
    border-radius: 12px;
    overflow: hidden;
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #fff;
    position: relative;
}

.p-card:hover {
    border-color: var(--p-accent-bright);
    background: rgba(30, 41, 59, 0.6);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
}

.p-img-box {
    height: 110px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    position: relative;
}

.p-img-box img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease;
}

.p-card:hover .p-img-box img {
    transform: scale(1.1);
}

.p-info {
    padding: 10px;
}

.p-title {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    line-height: 1.2;
}

.p-dims {
    font-size: 0.7rem;
    color: #94a3b8;
}

.p-price {
    font-size: 0.85rem;
    color: var(--p-accent);
    font-weight: 800;
}

.planner-workspace {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #020617;
    cursor: grab;
    perspective: 2000px;
}

.scene-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
}

.room {
    position: relative;
    background: #1e293b;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    transform-style: preserve-3d;
    transition: width 0.3s, height 0.3s;
}

.floor {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 1;
}

.canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.marquee-selection {
    position: absolute;
    border: 1px dashed var(--p-accent);
    background: rgba(139, 92, 246, 0.15);
    pointer-events: none;
    z-index: 1000;
}

.room.hide-walls .wall {
    display: none !important;
}

.wall {
    position: absolute;
    background: #cbd5e1;
    z-index: 1;
    transition: background 0.3s;
}

.wall-back {
    width: 100%;
    height: 250px;
    top: -250px;
    left: 0;
    transform-origin: bottom;
    transform: rotateX(90deg);
    border-bottom: 2px solid #cbd5e1;
    display: none;
}

.wall-left {
    width: 250px;
    height: 100%;
    left: -250px;
    top: 0;
    transform-origin: right;
    transform: rotateY(-90deg);
    border-right: 2px solid #cbd5e1;
    display: none;
}

.wall-right {
    width: 250px;
    height: 100%;
    right: -250px;
    top: 0;
    transform-origin: left;
    transform: rotateY(90deg);
    border-left: 2px solid #cbd5e1;
    display: none;
}

.mode-3d .wall-back,
.mode-3d .wall-left,
.mode-3d .wall-right {
    display: block;
}

@keyframes pulse-select {
    0% {
        box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.6);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(168, 85, 247, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(168, 85, 247, 0);
    }
}

.p-item {
    position: absolute;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 10;
    user-select: none;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 4px;
}

.p-item.is-selected {
    border-color: var(--p-accent-bright) !important;
    z-index: 50;
    animation: pulse-select 2s infinite;
    box-shadow: 0 0 25px rgba(168, 85, 247, 0.4);
}

.p-item.has-collision:not(.is-selected) {
    border: 2px dashed #ef4444 !important;
    background: rgba(239, 68, 68, 0.1) !important;
}

.p-item.is-draft {
    background: rgba(148, 163, 184, 0.05) !important;
    border: 2px dashed #94a3b8 !important;
    box-shadow: none;
}

.p-item.is-draft::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(#94a3b8 0.5px, transparent 0.5px);
    background-size: 10px 10px;
    opacity: 0.2;
    pointer-events: none;
}

.mode-3d .p-item {
    background: transparent;
    border: none;
    box-shadow: none !important;
}

.p-face {
    position: absolute;
    backface-visibility: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: none;
}

.mode-3d .p-face {
    display: block;
}

.p-face-top {
    width: 100%;
    height: 100%;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateZ(var(--h, 85px));
}

.p-face-side {
    background: linear-gradient(to bottom, #f8fafc, #cbd5e1);
}

.prop-panel {
    position: absolute;
    right: 20px;
    top: 20px;
    width: 240px;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    z-index: 1000;
    max-height: calc(100vh - 100px);
    overflow: hidden;
    /* Header stays, body scrolls */
    border: 1px solid var(--p-border);
    transition: transform 0.3s ease;
}

.prop-panel:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}

.prop-panel.active {
    display: block;
}

.prop-header {
    padding: 12px;
    background: #f8fafc;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
}

.prop-body {
    padding: 15px;
}

.custom-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
}

.custom-modal.active {
    display: flex;
}

.modal-body {
    background: #fff;
    border-radius: 16px;
    width: 450px;
    max-width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-body.modal-lg {
    max-width: 95%;
    width: 900px;
}

.modal-head {
    padding: 20px;
    border-bottom: 1px solid var(--p-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Responsive Modal Grid */
@media (max-width: 900px) {
    .templates-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

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

.t-card {
    transition: all 0.2s;
}

/* Architectural 2D symbols */
.p-item-door .door-swing {
    position: absolute;
    width: 200%;
    /* Swinging arc */
    height: 200%;
    border: 1.5px dashed #475569;
    border-radius: 100% 0 0 0;
    top: -100%;
    left: 0;
    pointer-events: none;
    transform-origin: bottom left;
}

.p-item-window::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    background: #0369a1;
    transform: translateY(-0.5px);
}

.mode-3d .door-swing,
.mode-3d .p-item-window::before {
    display: none !important;
}

.p-item-pillar {
    background: #475569;
    background-image: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(255, 255, 255, 0.05) 5px, rgba(255, 255, 255, 0.05) 10px);
    border: 2px solid #1e293b;
}

.p-item-drain {
    background: radial-gradient(circle, #3b82f6 20%, transparent 20%, transparent 40%, #3b82f6 40%, #3b82f6 50%, transparent 50%);
    border: none;
}

.p-item-drain,
.p-item-gas,
.p-item-electric {
    background: transparent;
    border: none;
    box-shadow: none;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--p-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* AI Analysis Panel */
.ai-report-panel {
    position: absolute;
    right: 250px;
    /* Offset from prop-panel */
    top: 20px;
    bottom: 20px;
    width: 320px;
    background: #1e293b;
    color: #fff;
    border-radius: 12px;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
    display: none;
    flex-direction: column;
    z-index: 1001;
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
    border: 1px solid var(--p-border);
}

.ai-report-panel.active {
    display: flex;
}

.ai-header {
    padding: 20px;
    background: #0f172a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--p-accent);
}

.ai-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.ai-footer {
    padding: 15px;
    background: #0f172a;
    border-top: 1px solid var(--p-border);
}

.ai-msg {
    border-radius: 8px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease-out;
    max-width: 100%;
}

.ai-msg.critical {
    background: rgba(239, 68, 68, 0.1);
}

.ai-msg.warning {
    background: rgba(245, 158, 11, 0.1);
}

.ai-msg.info {
    background: rgba(59, 130, 246, 0.1);
}

/* 3D HUD Stats */
.scene-stats {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 10px 18px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 100;
    pointer-events: none;
    transition: all 0.3s ease;
    display: none;
    color: #fff;
    font-size: 0.85rem;
}

.mode-3d .scene-stats {
    display: block;
    animation: slideIn 0.5s ease;
}

/* Material Preset Pills */
.mat-preset {
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--p-border);
    border-radius: 4px;
    font-size: 0.65rem;
    cursor: pointer;
    color: #94a3b8;
    transition: 0.2s;
}

.mat-preset:hover {
    background: var(--p-accent);
    color: white;
}

.mat-row {
    display: flex;
    gap: 5px;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* Rotation Handle */
.p-item .rotation-handle {
    position: absolute;
    top: -25px;
    left: calc(50% - 12px);
    width: 24px;
    height: 24px;
    background: var(--p-accent);
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: crosshair;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.p-item .rotation-handle::after {
    content: '';
    /* FontAwesome Sync/Rotate icon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 12px;
}

.p-item.is-selected .rotation-handle {
    display: flex;
}

.p-item .rotation-handle:hover {
    transform: scale(1.2);
    background: #7c3aed;
}

/* Snap Guides */
.snap-guide {
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

/* Collision & Visual Feedback */
.p-item.has-collision {
    box-shadow: 0 0 0 3px #ef4444 !important;
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: #ef4444 !important;
}

.p-item.has-collision::after {
    content: '!';
    position: absolute;
    top: -12px;
    right: -12px;
    background: #ef4444;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 110;
    animation: bounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounce {
    0% {
        transform: scale(0);
    }

    80% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Cost Table Modal */
.cost-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.9rem;
}

.cost-table th {
    background: #f1f5f9;
    padding: 12px;
    text-align: left;
    color: #475569;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
}

.cost-table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    color: #1e293b;
}

.cost-table tr:hover {
    background: #f8fafc;
}

.cost-total-row td {
    border-top: 2px solid #e2e8f0;
    font-weight: bold;
    font-size: 1.1rem;
    color: var(--p-accent);
    background: #f8fafc;
}

/* 🛡️ AI Compliance: UI Utility Classes */
.planner-guest-alert {
    background: #f59e0b;
    color: #fff;
    text-align: center;
    padding: 8px;
    font-size: 0.9rem;
    position: relative;
    z-index: 900;
}

.planner-guest-alert a {
    color: #fff;
    font-weight: bold;
    text-decoration: underline;
}

.search-container {
    padding: 15px;
    border-bottom: 1px solid var(--p-border);
}

.search-input-wrapper {
    position: relative;
}

.search-icon-inline {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.search-input-field {
    width: 100%;
    padding: 10px 10px 10px 35px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--p-border);
    border-radius: 8px;
    color: #fff;
    font-size: 0.85rem;
}

.category-pills-scroll {
    display: flex;
    gap: 5px;
    margin-top: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.product-grid-container {
    padding: 15px;
    border-bottom: 1px solid var(--p-border);
    min-height: 100px;
}

.ai-panel-header {
    padding: 15px;
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-panel-title {
    margin: 0;
    color: #fff;
    font-size: 1.1rem;
}

.ai-panel-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1.2rem;
}

.ai-results-container {
    padding: 15px;
    overflow-y: auto;
    flex: 1;
    color: #cbd5e1;
}

.planner-modal-footer {
    margin-top: 20px;
    text-align: right;
}

.btn-secondary-outline {
    display: inline-block;
    width: auto;
    background: #475569;
    margin-right: 10px;
}

.btn-auto-width {
    display: inline-block;
    width: auto;
}

.planner-calc-display {
    width: 100%;
    padding: 15px;
    font-size: 1.5rem;
    text-align: right;
    border: 1px solid var(--p-border);
    border-radius: 6px;
    background: #0f172a;
    color: white;
    margin-bottom: 15px;
}

.calculator-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.planner-form-label {
    display: block;
    margin-bottom: 5px;
    color: #94a3b8;
    font-size: 0.85rem;
}

.planner-form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--p-border);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.planner-form-select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--p-border);
    border-radius: 6px;
    background: #1e293b;
    color: white;
}

.project-management-box {
    padding: 10px;
    background: rgba(139, 92, 246, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 8px;
    margin-bottom: 12px;
}

.btn-accent {
    background: var(--p-accent);
    color: white;
}

.project-load-section {
    border-top: 1px solid var(--p-border);
    padding-top: 10px;
}

.load-title {
    font-size: 0.7rem;
    color: #94a3b8;
    display: block;
    margin-bottom: 5px;
}

.mb-sm {
    margin-bottom: 8px !important;
}

.mb-ml {
    margin-bottom: 15px !important;
}

.template-card {
    border: 1px solid var(--p-border);
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: 0.2s;
    background: rgba(255, 255, 255, 0.03);
}

.layout-card {
    border: 2px solid #e2e8f0;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
}

.footer-links-container {
    padding: 10px 0;
    border-bottom: 1px solid var(--p-border);
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.glass-panel-overlay {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.planner-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    margin-bottom: 8px;
}

.planner-prompt-input {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    margin-bottom: 15px;
    outline: none;
    transition: 0.2s;
}

.toast-wrapper {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
}

.btn-map-product {
    background: rgba(139, 92, 246, 0.2);
    color: #8b5cf6;
    border: 1px solid #8b5cf6;
}

.planner-input-large {
    width: 100%;
    padding: 15px;
    border-radius: 12px;
    border: 1px solid var(--p-border);
    background: rgba(255, 255, 255, 0.03);
    color: #fff;
    outline: none;
    font-size: 1.1rem;
}

.planner-checker-bg {
    background: linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc),
        linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

.template-icon-box {
    height: 120px;
    background: rgba(120, 120, 120, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--p-accent);
}

.templates-modal-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.prop-divider {
    margin-top: 15px;
    border-top: 1px solid var(--p-border);
    padding-top: 15px;
}

.btn-tool-secondary {
    padding: 5px 10px;
    border-radius: 4px;
    border: 1px solid var(--p-accent);
    background: transparent;
    color: var(--p-accent);
    cursor: pointer;
}

.prop-row-between {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

/* AI Compliance Utility Classes */
.planner-toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
    pointer-events: none;
}

.planner-row-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
}

.planner-textarea-large {
    width: 100%;
    min-height: 100px;
    padding: 15px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-family: inherit;
    margin-bottom: 15px;
    outline: none;
    transition: 0.2s;
}

.planner-template-card {
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: 0.2s;
}

.planner-template-icon-box {
    height: 150px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
}

.modal-body-3d {
    width: 800px;
    height: 600px;
    background: #000;
    position: relative;
    display: flex;
    flex-direction: column;
}

.close-modal-3d {
    position: absolute;
    top: 15px;
    right: 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-ar-action {
    background-color: white;
    border-radius: 4px;
    border: none;
    position: absolute;
    top: 16px;
    right: 16px;
    width: auto;
    height: 30px;
    font-weight: 700;
    padding: 0 10px;
}

.modal-footer-dark {
    padding: 15px;
    background: #1e293b;
    color: #fff;
    text-align: center;
    font-size: 0.9rem;
}

.planner-section-header {
    padding: 15px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 15px;
}

.p-img-box-placeholder {
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
}

.planner-add-card-placeholder {
    cursor: pointer;
    border: 2px dashed var(--p-border);
    background: rgba(255, 255, 255, 0.02);
    height: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.planner-card-title-highlight {
    color: var(--p-accent-bright);
    font-weight: bold;
    font-size: 0.75rem;
    margin-top: 10px;
}

.btn-full-accent {
    background: var(--p-accent);
    color: white;
    margin-bottom: 20px;
    font-weight: bold;
    height: 45px;
    width: 100%;
}

.planner-note-text {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 5px;
    text-align: center;
}

.planner-label-small {
    font-size: 0.85rem;
    color: #64748b;
    display: block;
    margin-bottom: 5px;
}

.planner-input-wrapper-light {
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
}

.room-wrapper-full {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.abs-layer-100 {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

.abs-layer-110 {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 110;
}

.toolbar-divider {
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
    height: 20px;
    margin: 0 5px;
}

.prop-row-divider {
    border-top: 1px solid #e2e8f0;
    margin-top: 10px;
    padding-top: 10px;
}

.icon-rotated-l {
    color: #64748b;
    margin-bottom: 5px;
    transform: rotate(90deg);
}

.planner-flex-col-2 {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.planner-texture-checkered {
    background: linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc),
        linear-gradient(45deg, #ccc 25%, transparent 25%, transparent 75%, #ccc 75%, #ccc);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

.toolbar-vertical-divider-large {
    color: rgba(255, 255, 255, 0.1);
    font-size: 1.5rem;
    font-weight: 100;
}

.zoom-level-text {
    min-width: 45px;
    text-align: center;
    font-weight: 700;
    font-size: 0.8rem;
}

/* --- 📝 Technical Annotations (Notes) --- */
.planner-note-marker {
    position: absolute;
    z-index: 1000;
    pointer-events: auto;
    transform: translate(-50%, -50%);
}

.note-pin {
    background: #f59e0b;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s;
}

.note-pin:hover {
    transform: rotate(-45deg) scale(1.1);
}

.note-pin i {
    transform: rotate(45deg);
    font-size: 14px;
}

.note-popover {
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(8px);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
    margin-bottom: 5px;
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    font-weight: 500;
}

.planner-note-marker:hover .note-popover {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

.note-delete {
    position: absolute;
    top: -12px;
    right: -12px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.planner-note-marker:hover .note-delete {
    display: flex;
}

.planner-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    color: white;
    font-size: 24px;
    box-shadow: 0 10px 25px rgba(59, 130, 246, 0.5);
    cursor: pointer;
    z-index: 9998;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.planner-fab:hover {
    transform: scale(1.1) rotate(10deg);
}