/* Floor plan editor - Track C. B60 OS tokens only (--ds-* via main.css aliases). */

.floor-plan-page {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-4);
    min-height: calc(100vh - 120px);
    height: calc(100vh - 120px);
}

.fp-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: var(--ds-space-4);
    align-items: stretch;
    flex: 1;
    min-height: 0;
}

@media (max-width: 1023px) {
    .fp-shell {
        grid-template-columns: 1fr;
    }
    .fp-props-panel {
        order: 2;
    }
}

.fp-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ds-space-2);
    padding: var(--ds-space-3) var(--ds-space-4);
    background: var(--ds-bg-surface);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-lg);
}

.fp-toolbar-group {
    display: flex;
    align-items: center;
    gap: var(--ds-space-2);
    flex-wrap: wrap;
}

.fp-toolbar-divider {
    width: 1px;
    height: 28px;
    background: var(--ds-border-default);
    margin-inline: var(--ds-space-1);
}

.fp-floor-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ds-space-2);
    margin-block-end: var(--ds-space-3);
}

.fp-floor-tab {
    border: 1px solid var(--ds-border-default);
    background: var(--ds-bg-surface);
    color: var(--ds-text-secondary);
    border-radius: var(--ds-radius-pill);
    padding: 6px 14px;
    font-size: var(--ds-text-sm);
    font-weight: var(--ds-fw-medium);
    cursor: pointer;
    transition: background var(--ds-motion-hover) var(--ds-ease-standard),
                color var(--ds-motion-hover) var(--ds-ease-standard),
                border-color var(--ds-motion-hover) var(--ds-ease-standard);
}

.fp-floor-tab.is-active {
    background: var(--ds-primary);
    border-color: var(--ds-primary);
    color: var(--ds-text-on-primary);
}

.fp-save-indicator {
    font-size: var(--ds-text-xs);
    color: var(--ds-text-tertiary);
    min-width: 72px;
    text-align: end;
}

.fp-save-indicator.is-saving {
    color: var(--ds-primary);
}

.fp-save-indicator.is-error {
    color: var(--ds-danger);
}

.fp-editor-wrap {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
    min-width: 0;
    min-height: 0;
    flex: 1;
}

.fp-stage-outer {
    position: relative;
    flex: 1;
    min-height: 320px;
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-lg);
    background: var(--ds-bg-inset);
    overflow: hidden;
    touch-action: none;
    user-select: none;
}

.fp-stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    cursor: default;
}

.fp-stage.is-panning {
    cursor: grab;
}

.fp-stage.is-panning:active {
    cursor: grabbing;
}

.fp-viewport {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
}

.fp-floor-surface {
    position: relative;
    background: var(--ds-bg-surface);
    box-shadow: var(--ds-shadow-card);
    border-radius: var(--ds-radius-md);
    overflow: hidden;
}

.fp-floor-surface.is-grid {
    background-color: var(--ds-bg-surface);
    background-image: radial-gradient(circle, var(--ds-border-strong) 1px, transparent 1px);
    background-size: 16px 16px;
    background-position: 0 0;
}

.fp-bg-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: fill;
    pointer-events: none;
}

.fp-tables-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.fp-table {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: center center;
    will-change: transform;
    pointer-events: auto;
    touch-action: none;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ds-bg-surface);
    border: 2px solid var(--ds-border-default);
    box-shadow: var(--ds-shadow-card);
    color: var(--ds-text-primary);
    font-size: 12px;
    font-weight: var(--ds-fw-semibold);
    text-align: center;
    padding: 4px;
    cursor: move;
}

.fp-table.is-selected {
    border-color: var(--ds-primary);
    box-shadow: 0 0 0 2px var(--ds-primary-tint), var(--ds-shadow-pop);
    z-index: 4;
}

.fp-table.is-round {
    border-radius: 50%;
}

.fp-table.is-square,
.fp-table.is-rectangle {
    border-radius: var(--ds-radius-md);
}

.fp-table.is-booth {
    border-radius: var(--ds-radius-lg) var(--ds-radius-lg) var(--ds-radius-sm) var(--ds-radius-sm);
}

.fp-table.is-bar_stool {
    border-radius: 50%;
    min-width: 32px;
    min-height: 32px;
}

.fp-table-label {
    pointer-events: none;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.fp-table-seats {
    display: block;
    font-size: 10px;
    font-weight: var(--ds-fw-regular);
    color: var(--ds-text-secondary);
}

.fp-handle {
    position: absolute;
    width: 10px;
    height: 10px;
    background: var(--ds-bg-surface);
    border: 2px solid var(--ds-primary);
    border-radius: 2px;
    box-sizing: border-box;
    pointer-events: auto;
    touch-action: none;
    z-index: 6;
}

.fp-handle-nw { top: -6px; left: -6px; cursor: nwse-resize; }
.fp-handle-ne { top: -6px; right: -6px; cursor: nesw-resize; }
.fp-handle-sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.fp-handle-se { bottom: -6px; right: -6px; cursor: nwse-resize; }

.fp-rotate-handle {
    position: absolute;
    top: -28px;
    left: 50%;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    border-radius: 50%;
    background: var(--ds-primary);
    border: 2px solid var(--ds-bg-surface);
    cursor: grab;
    pointer-events: auto;
    touch-action: none;
    z-index: 6;
}

.fp-rotate-handle::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    width: 1px;
    height: 10px;
    background: var(--ds-primary);
    transform: translateX(-50%);
}

.fp-marquee {
    position: absolute;
    border: 1px dashed var(--ds-primary);
    background: var(--ds-primary-tint);
    pointer-events: none;
    z-index: 8;
}

.fp-zoom-controls {
    position: absolute;
    left: var(--ds-space-3);
    bottom: var(--ds-space-3);
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-1);
    z-index: 10;
}

.fp-zoom-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-md);
    background: var(--ds-bg-surface);
    color: var(--ds-text-primary);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--ds-shadow-card);
}

.fp-zoom-btn:hover {
    border-color: var(--ds-primary);
    color: var(--ds-primary);
}

.fp-zoom-readout {
    font-size: var(--ds-text-xs);
    text-align: center;
    color: var(--ds-text-secondary);
    background: var(--ds-bg-surface);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-sm);
    padding: 2px 6px;
}

.fp-palette {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ds-space-2);
}

.fp-palette-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 64px;
    padding: var(--ds-space-2);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-md);
    background: var(--ds-bg-surface);
    cursor: grab;
    font-size: var(--ds-text-xs);
    color: var(--ds-text-secondary);
    touch-action: none;
}

.fp-palette-item.is-active {
    border-color: var(--ds-primary);
    background: var(--ds-primary-tint);
    color: var(--ds-primary);
}

.fp-palette-shape {
    width: 36px;
    height: 28px;
    border: 2px solid var(--ds-border-strong);
    background: var(--ds-bg-inset);
}

.fp-palette-shape.is-round { border-radius: 50%; width: 32px; height: 32px; }
.fp-palette-shape.is-square { border-radius: var(--ds-radius-sm); }
.fp-palette-shape.is-rectangle { width: 44px; border-radius: var(--ds-radius-sm); }
.fp-palette-shape.is-booth { width: 48px; border-radius: var(--ds-radius-md) var(--ds-radius-md) 4px 4px; }
.fp-palette-shape.is-bar_stool { width: 20px; height: 20px; border-radius: 50%; }

.fp-props-panel {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
    padding: var(--ds-space-4);
    background: var(--ds-bg-surface);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-lg);
    min-height: 0;
    overflow: auto;
}

.fp-props-panel h3 {
    margin: 0;
    font-size: var(--ds-text-md);
    font-weight: var(--ds-fw-semibold);
}

.fp-props-empty {
    color: var(--ds-text-secondary);
    font-size: var(--ds-text-sm);
}

.fp-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fp-field label {
    font-size: var(--ds-text-xs);
    color: var(--ds-text-secondary);
    font-weight: var(--ds-fw-medium);
}

.fp-readout {
    font-size: var(--ds-text-sm);
    color: var(--ds-text-primary);
    padding: var(--ds-space-2) var(--ds-space-3);
    background: var(--ds-bg-inset);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-sm);
}

.fp-section-label {
    font-size: var(--ds-text-sm);
    color: var(--ds-text-primary);
}

.fp-floor-props {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
}

.fp-bg-controls {
    display: flex;
    flex-direction: column;
    gap: var(--ds-space-3);
    padding: var(--ds-space-3);
    border: 1px solid var(--ds-border-default);
    border-radius: var(--ds-radius-md);
    background: var(--ds-bg-inset);
}

.fp-bg-preview {
    width: 100%;
    height: 72px;
    object-fit: cover;
    border-radius: var(--ds-radius-sm);
    border: 1px solid var(--ds-border-default);
    background: var(--ds-bg-surface);
}

.fp-bg-preview.is-empty {
    display: none;
}

.fp-inline-error {
    margin: 0;
    color: var(--ds-danger);
    font-size: var(--ds-text-sm);
    font-weight: var(--ds-fw-semibold);
}

.fp-inline-error[hidden] {
    display: none;
}

.fp-toggle.is-on {
    background: var(--ds-primary-tint);
    border-color: var(--ds-primary);
    color: var(--ds-primary);
}
