/* ── Room Canvas ──────────────────────────────────────────────────────── */
.room-canvas-wrapper {
    flex: 1;
    overflow: auto;
    background: color-mix(in srgb, var(--text-main) 6%, var(--bg-color));
    padding: 2rem;
}

.room-canvas {
    width: 2000px;
    height: 1400px;
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
}

.canvas-hint {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    color: var(--text-muted);
    font-size: 1rem;
    text-align: center;
    pointer-events: none;
    white-space: nowrap;
}

/* ── Table Cards ──────────────────────────────────────────────────────── */
.table-card {
    position: absolute;
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    min-width: 150px;
    user-select: none;
    z-index: 10;
}

.table-card.drag-over .table-card-body {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary), var(--shadow);
}

.table-card.shape-round { min-width: 0; }

.table-card-header {
    display: flex;
    justify-content: center;
    align-items: center;
    align-self: center;
    padding: 0.2rem 0.55rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 99px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    gap: 0.4rem;
    flex-shrink: 0;
    margin-bottom: 0.3rem;
    white-space: nowrap;
}

.table-card-header:active { cursor: grabbing; }

.table-card-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.table-card-capacity {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

.table-card-body {
    padding: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    flex: 1;
    align-content: flex-start;
    min-height: 40px;
    background: var(--surface);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.table-card.shape-round .table-card-body.round-body {
    position: relative;
    padding: 0;
    overflow: visible;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    flex: none;
    min-height: unset;
}

.table-card.shape-round .seat-slot { width: 26px; height: 26px; font-size: 0.55rem; }

.table-card .guest-chip {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
    max-width: none;
    font-size: 0.65rem;
}

.table-card .guest-chip > span { overflow: visible; text-overflow: clip; }

.chip-tooltip {
    position: fixed;
    z-index: 9999;
    background: rgba(30, 30, 30, 0.9);
    color: #fff;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    pointer-events: none;
    white-space: nowrap;
    font-family: 'Inter', sans-serif;
}
.table-card.shape-round .guest-chip { width: 26px; height: 26px; font-size: 0.6rem; }

.table-card-body.two-sided {
    flex-direction: column;
    padding: 0;
    gap: 0;
    align-content: stretch;
    min-height: unset;
}

.seat-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.35rem 0.5rem;
    justify-content: center;
}

/* ── Guest Chips ──────────────────────────────────────────────────────── */
.guest-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    background: var(--surface);
    color: var(--text-main);
    border: 1.5px solid var(--border-color);
    padding: 0.18rem 0.45rem;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: 'Inter', 'Spectral', sans-serif;
    cursor: grab;
    white-space: nowrap;
    max-width: 130px;
    overflow: hidden;
    transition: opacity 0.15s, border-color 0.15s;
}

.guest-chip:active { cursor: grabbing; }
.guest-chip:hover { border-color: #888; }
.guest-chip > span { overflow: hidden; text-overflow: ellipsis; }
.guest-chip.dragging { opacity: 0.35; }

.guest-chip .chip-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.1s;
}

.guest-chip .chip-remove:hover { color: var(--text-main); }

.list-seat-item .guest-chip { max-width: none; }
.list-seat-item .guest-chip > span { overflow: visible; text-overflow: clip; white-space: normal; }

/* ── Seat Slots ───────────────────────────────────────────────────────── */
.seat-slot {
    width: 28px;
    height: 28px;
    border: 1.5px dashed var(--border-color);
    border-radius: 99px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s;
}

.seat-slot.drag-over {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, var(--surface));
    color: var(--primary);
}

/* ── Unassigned Panel ─────────────────────────────────────────────────── */
.unassigned-panel { width: 200px; z-index: 20; }

.unassigned-panel-body {
    background: var(--surface);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.unassigned-panel.drag-over .unassigned-panel-body {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary), var(--shadow);
}

.panel-filter-wrap {
    padding: 0.4rem 0.4rem 0.2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
}

.panel-filter-wrap .rsvp-filter-row {
    gap: 0.25rem;
    padding-top: 0;
}

.panel-filter-wrap .rsvp-check-label {
    font-size: 0.68rem;
}

.panel-filter-wrap .rsvp-check-label input[type="checkbox"] {
    width: 12px;
    height: 12px;
}

.panel-search-wrap {
    padding: 0.3rem 0.4rem 0.2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border-color);
}

.panel-search {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.2rem 0.4rem;
    font-size: 0.72rem;
    outline: none;
    background: var(--bg-color);
    color: var(--text-main);
    height: auto;
}

.panel-search:focus { border-color: var(--primary); }

.panel-guest-list {
    padding: 0.5rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 280px;
    overflow-y: auto;
    background: var(--surface);
    border-radius: 0 0 var(--radius) var(--radius);
}

.panel-guest-list .guest-chip {
    width: auto;
    height: auto;
    min-height: 28px;
    border-radius: 99px;
    padding: 0.3rem 0.5rem;
    justify-content: flex-start;
    max-width: 100%;
    font-size: 0.75rem;
    flex-shrink: 0;
    box-sizing: border-box;
}

.panel-guest-list .guest-chip > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.all-assigned-msg {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.2rem 0;
}

/* ── Tables Sidebar List ──────────────────────────────────────────────── */
.tables-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.table-sidebar-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.82rem;
    background: var(--surface);
    color: var(--text-main);
}

.table-sidebar-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.shape-badge {
    font-size: 0.63rem;
    color: var(--text-muted);
    background: color-mix(in srgb, var(--text-main) 8%, transparent);
    padding: 0.1rem 0.35rem;
    border-radius: 99px;
    text-transform: capitalize;
    flex-shrink: 0;
}

.capacity-badge {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.edit-table-btn, .delete-table-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;
}

.edit-table-btn   { color: var(--text-muted); font-size: 0.85rem; }
.edit-table-btn:hover { color: var(--primary); }
.delete-table-btn { color: var(--text-muted); font-size: 1rem; }
.delete-table-btn:hover { color: #dc3545; }

/* ── Edit Table Form (matches add-table layout) ───────────────────────── */
.sm-edit-table-wrap {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 0.85rem;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sm-edit-table-wrap .input-row {
    margin-bottom: 0;
}

.sm-edit-table-wrap .edit-table-input {
    height: 34px;
    padding: 0 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    background: var(--bg-color);
    color: var(--text-main);
    user-select: text;
    -webkit-user-select: text;
}

.sm-edit-table-wrap .edit-table-input:focus { border-color: var(--primary); }

.sm-edit-btn-row {
    display: flex;
    gap: 0.5rem;
}

.sm-edit-btn-row .secondary-btn,
.sm-edit-btn-row .primary-btn {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.82rem;
    height: 34px;
}

/* ── List View ────────────────────────────────────────────────────────── */
.list-view-container {
    flex: 1;
    overflow: auto;
    padding: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-content: flex-start;
}

.list-table-block {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    min-width: 160px;
    box-shadow: var(--shadow-sm);
    break-inside: avoid;
}

.list-table-block h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border-color);
}

.list-table-block.drag-over {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary), var(--shadow-sm);
}

.list-table-block ul { list-style: none; padding: 0; margin: 0; font-size: 0.82rem; }

.list-seat-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.1rem 0.2rem;
    border-radius: 3px;
    min-height: 24px;
    transition: background 0.1s;
    list-style: none;
}

.list-seat-item.drag-over { background: color-mix(in srgb, var(--primary) 12%, transparent); outline: 1px dashed var(--primary); }

.seat-num { font-size: 0.7rem; color: var(--text-muted); flex-shrink: 0; min-width: 1.4em; text-align: right; }
.empty-seat { color: var(--text-muted); font-style: italic; }

/* ── Header Controls (view toggle + stats) ────────────────────────────── */
.sm-preview-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.sm-stats-right {
    justify-self: end;
}

.sm-view-toggle {
    margin-bottom: 0;
    height: 34px;
    padding: 3px;
}

.sm-view-toggle .tab-btn {
    font-size: 0.82rem;
    padding: 0 0.85rem;
}

/* ── List View Unseated Block ─────────────────────────────────────────── */
.list-unseated-block { min-width: 160px; }

.list-unseated-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    padding-top: 0.25rem;
}

.list-unseated-chips .guest-chip { max-width: none; }
.list-unseated-chips .guest-chip > span {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

/* ── Print ────────────────────────────────────────────────────────────── */
@media print {
    body.print-mode-map  .print-list-container { display: none !important; }
    body.print-mode-list .print-map-container  { display: none !important; }

    .print-map-canvas {
        position: relative;
        width: 100%;
        padding-bottom: 70%;
        page-break-after: always;
    }

    .print-map-canvas .table-card { cursor: default; }
    .print-map-canvas .table-card-header { cursor: default; }

    .print-list-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
        padding: 0.5cm;
    }

    .print-list-grid .list-table-block {
        break-inside: avoid;
        border: 1px solid #ccc;
    }
}
