/* ============================================
   FLOOR PLAN DESIGNER
   Visual drag & drop editor
============================================ */

.fpd {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-primary);
    overflow: hidden;
}

/* ---- Toolbar ---- */
.fpd-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-shrink: 0;
}

.fpd-toolbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
    min-width: 0;
}

.fpd-toolbar-right {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

.fpd-zoom {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px;
}

.fpd-zoom-btn {
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fpd-zoom-btn:hover { background: var(--bg-surface-hover); }

.fpd-zoom-val {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 36px;
    text-align: center;
}

.fpd-grid-input {
    width: 50px;
    height: 28px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-primary);
    text-align: center;
    font-size: 12px;
    font-weight: 600;
}
.fpd-grid-input:focus { border-color: var(--accent); outline: none; }

.fpd-title {
    font-size: 16px;
    font-weight: 800;
    white-space: nowrap;
}

.fpd-zone-tabs {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.fpd-ztab {
    padding: 6px 14px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.fpd-ztab:hover { border-color: var(--text-muted); }
.fpd-ztab.active {
    background: var(--orange);
    border-color: var(--orange);
    color: #fff;
}

/* ---- Status Bar ---- */
.fpd-status {
    display: none;
    padding: 8px 16px;
    background: rgba(245, 158, 11, 0.12);
    border-bottom: 1px solid var(--orange);
    color: var(--orange);
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ---- Main Layout ---- */
.fpd-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ---- Palette (Left Sidebar) ---- */
.fpd-palette {
    width: 180px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 8px;
}

.fpd-pal-cat {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 10px 6px 4px;
}

.fpd-pal-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.12s;
    user-select: none;
}

.fpd-pal-item:hover {
    background: var(--bg-surface-hover);
}

.fpd-pal-item:active {
    background: rgba(245, 158, 11, 0.15);
}

.fpd-pal-item.active {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid var(--orange);
    border-radius: var(--radius-md);
}

.fpd-pal-icon {
    font-size: 18px;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.fpd-pal-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ---- Canvas ---- */
.fpd-canvas-wrap {
    flex: 1;
    overflow: auto;
    background: var(--bg-primary);
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.fpd-canvas {
    position: relative;
    background-color: #2a3a52;
    border: 2px solid var(--border);
    border-radius: 8px;
    background-image:
        linear-gradient(rgba(255,255,255,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.06) 1px, transparent 1px);
    background-size: 20px 20px;
    flex-shrink: 0;
}

.fpd-canvas.fpd-placing {
    cursor: crosshair;
    border-color: var(--orange);
}

/* ---- Canvas Items ---- */
.fpd-item {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    z-index: 1;
}

.fpd-item:active { cursor: grabbing; z-index: 10; }
.fpd-item.selected { z-index: 5; }

/* ---- Tables ---- */
.fpd-table {
    background: #253552;
    border: 2px solid rgba(255,255,255,0.15);
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

.fpd-table.selected {
    border-color: var(--orange);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3), 0 2px 12px rgba(0,0,0,0.4);
}

.fpd-table:hover:not(.selected) {
    border-color: var(--text-muted);
}

/* Shapes */
.fpd-table.shape-square { border-radius: 8px; }
.fpd-table.shape-round { border-radius: 50%; }
.fpd-table.shape-rectangle { border-radius: 10px; }
.fpd-table.shape-booth {
    border-radius: 10px;
    border-left: 5px solid #8b5cf6;
}
.fpd-table.shape-bar_stool { border-radius: 50%; }

.fpd-item-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.fpd-item-sub {
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 1px;
}

/* ---- Decorative Elements ---- */
.fpd-element {
    border: 2px dashed var(--border);
    border-radius: 4px;
    opacity: 0.85;
}

.fpd-element.selected {
    border-color: var(--orange);
    border-style: solid;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.3);
    opacity: 1;
}

.fpd-element .fpd-item-label {
    font-size: 14px;
}

.etype-wall {
    background: #475569;
    border-style: solid;
    border-color: #64748b;
    border-radius: 2px;
}

.etype-wall .fpd-item-label { display: none; }

.etype-door {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
}

.etype-plant {
    background: rgba(34, 197, 94, 0.1);
    border-color: #22c55e;
    border-radius: 50%;
}

.etype-bar_counter {
    background: #78350f;
    border-style: solid;
    border-color: #92400e;
    border-radius: 6px;
}

.etype-bar_counter .fpd-item-label { color: #fbbf24; }

.etype-host_stand {
    background: rgba(168, 85, 247, 0.1);
    border-color: #a855f7;
    border-radius: 6px;
}

.etype-restroom {
    background: rgba(100, 116, 139, 0.15);
    border-color: #64748b;
    border-radius: 6px;
}

.etype-divider {
    background: #334155;
    border-style: solid;
    border-color: #475569;
    border-radius: 2px;
}

.etype-divider .fpd-item-label { display: none; }

.etype-label {
    background: transparent;
    border: none;
}

.etype-label .fpd-item-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
}

/* -- Furniture -- */
.etype-chair {
    background: rgba(168, 85, 247, 0.12);
    border-color: #a855f7;
    border-radius: 50%;
}

.etype-sofa {
    background: rgba(139, 92, 246, 0.15);
    border-color: #8b5cf6;
    border-radius: 8px;
}

.etype-armchair {
    background: rgba(139, 92, 246, 0.12);
    border-color: #8b5cf6;
    border-radius: 10px;
}

.etype-bench {
    background: #3f3f46;
    border-style: solid;
    border-color: #52525b;
    border-radius: 3px;
}

.etype-counter {
    background: #44403c;
    border-style: solid;
    border-color: #78716c;
    border-radius: 4px;
}

.etype-shelf {
    background: rgba(120, 53, 15, 0.4);
    border-style: solid;
    border-color: #92400e;
    border-radius: 2px;
}

.etype-podium {
    background: rgba(234, 179, 8, 0.12);
    border-color: #eab308;
    border-radius: 6px;
}

/* -- Decor -- */
.etype-fountain {
    background: rgba(56, 189, 248, 0.12);
    border-color: #38bdf8;
    border-radius: 50%;
}

.etype-statue {
    background: rgba(148, 163, 184, 0.15);
    border-color: #94a3b8;
    border-radius: 6px;
}

.etype-rug {
    background: rgba(180, 83, 9, 0.12);
    border-color: #b45309;
    border-radius: 4px;
    border-style: dashed;
}

/* -- Structure -- */
.etype-double_door {
    background: rgba(59, 130, 246, 0.15);
    border-color: #3b82f6;
}

.etype-window {
    background: rgba(125, 211, 252, 0.15);
    border-color: #7dd3fc;
    border-style: dashed;
}

.etype-pillar {
    background: #6b7280;
    border-style: solid;
    border-color: #9ca3af;
    border-radius: 2px;
}

.etype-pillar .fpd-item-label { display: none; }

.etype-stairs {
    background: rgba(148, 163, 184, 0.15);
    border-color: #94a3b8;
    border-radius: 4px;
}

/* -- Facilities -- */
.etype-kitchen {
    background: rgba(234, 88, 12, 0.1);
    border-color: #ea580c;
    border-radius: 6px;
}

.etype-cashier {
    background: rgba(34, 197, 94, 0.1);
    border-color: #22c55e;
    border-radius: 6px;
}

.etype-exit {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
}

.etype-storage {
    background: rgba(100, 116, 139, 0.12);
    border-color: #64748b;
    border-radius: 4px;
}

/* ---- Ghost (drag preview) ---- */
.fpd-ghost {
    position: absolute;
    background: rgba(245, 158, 11, 0.15);
    border: 2px dashed var(--orange);
    border-radius: 8px;
    pointer-events: none;
    z-index: 100;
}

/* ---- Properties Panel (Right Sidebar) ---- */
.fpd-props {
    width: 220px;
    flex-shrink: 0;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px 14px;
}

.fpd-props-empty {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 40px 10px;
}

.fpd-props-title {
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.fpd-props label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    margin: 10px 0 4px;
}

.fpd-props input,
.fpd-props select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
}

.fpd-props input:focus,
.fpd-props select:focus {
    border-color: var(--orange);
    outline: none;
}

.fpd-props input[type="color"] {
    height: 36px;
    padding: 3px;
    cursor: pointer;
}

.fpd-props-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.fpd-props-row input { flex: 1; }
.fpd-props-row span { color: var(--text-muted); font-size: 14px; }

.fpd-props-val {
    padding: 8px 10px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.fpd-props-btn {
    width: 100%;
    margin-top: 10px;
}

.fpd-rot-row {
    display: flex;
    gap: 4px;
    align-items: center;
}

.fpd-rot-row input { flex: 1; text-align: center; }

.fpd-rot-btn {
    width: 34px;
    height: 34px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.fpd-rot-btn:hover {
    border-color: var(--orange);
    background: var(--bg-surface-hover);
}

/* ---- Nudge Pad ---- */
.fpd-nudge-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3px;
    margin: 12px 0 4px;
}

.fpd-nudge {
    width: 100%;
    height: 34px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fpd-nudge:hover {
    background: var(--bg-surface-hover);
    border-color: var(--orange);
}

.fpd-nudge:active {
    background: var(--orange);
    color: #fff;
}

.fpd-nudge-center {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* ---- Touch / Responsive ---- */
/* ==================== GHOST SNAP PREVIEW ==================== */
.fpd-snap-ghost {
    position: absolute;
    border: 2px dashed var(--orange);
    background: rgba(245, 158, 11, 0.15);
    border-radius: var(--radius-sm);
    pointer-events: none;
    z-index: 50;
    transition: left 0.08s ease, top 0.08s ease, width 0.08s ease, height 0.08s ease;
}

/* Floating ghost when dragging from palette */
.fpd-drag-ghost {
    position: fixed;
    background: rgba(59, 130, 246, 0.2);
    border: 2px solid var(--blue);
    border-radius: var(--radius-md);
    pointer-events: none;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.fpd-drag-ghost span {
    font-size: 12px;
    color: var(--text-primary);
    white-space: nowrap;
    padding: 2px 6px;
}

/* Item being dragged */
.fpd-item-dragging {
    opacity: 0.7 !important;
    z-index: 100 !important;
    cursor: grabbing !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* Palette items draggable cursor */
.fpd-pal-item {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}
.fpd-pal-item:active {
    cursor: grabbing;
}

/* Responsive */

/* 1920×1080 fixed — no responsive breakpoints */
