/* seating-chart.css */

/* General styles for the seating chart */
.seating-chart {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #f9f9f9;
    border: 1px solid #ccc;
}

/* Table styles */
.table {
    position: absolute;
    width: 100px; /* Adjust as needed */
    height: 100px; /* Adjust as needed */
    background-color: #fff;
    border: 2px solid #0073aa;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s;
}

.table:hover {
    transform: scale(1.05);
}

/* Table image styles */
.table img {
    width: 100%;
    height: auto;
    border-radius: 5px;
}

/* Popup modal styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 600px;
    border-radius: 5px;
}

/* Close button styles */
.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* table shape + seats */
.scb-table { pointer-events: auto; }
.scb-table-label { margin-bottom: 6px; }
.scb-table-shape { background: #fff; }
.scb-table-seat {
    transition: box-shadow .12s, transform .12s;
    z-index: 3;
}
.scb-table-seat:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
    transform: scale(1.08);
}

/* guest sidebar */
#scb-guest-list .scb-guest-group { padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
#scb-guest-list .scb-guest-item { white-space: nowrap; }
#scb-guest-list .scb-guest-group-header { text-transform: uppercase; letter-spacing: .6px; }

/* Couple badge styles: show circular badge to the right for the 'Couple' relation */
.scb-guest-item.scb-guest-couple {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}
.scb-couple-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    flex: 0 0 auto;
    margin-left: 6px;
}
/* attendance variants applied to badge */
.scb-guest-item.scb-attending .scb-couple-badge { background: #28a745; }
.scb-guest-item.scb-pending .scb-couple-badge { background: #ffd400; }
/* default icon inside badge (smaller and always white) */
.scb-guest-item.scb-guest-couple .scb-guest-icon { color: #fff; font-size: 16px; }

/* inline SVG inside the couple badge */
.scb-couple-badge .scb-couple-icon { width: 16px; height: 16px; display: block; color: #fff; }
/* ensure pending badge icon is white too (match design) */
.scb-guest-item.scb-pending .scb-couple-badge .scb-couple-icon { color: #fff; }
.scb-guest-item.scb-guest-couple .scb-couple-badge .scb-couple-icon { color: #fff; }
/* remove left margin for icons inside the badge */
.scb-guest-item.scb-guest-couple .scb-guest-icon { margin-left: 0; }

.scb-guest-icon { color: #666; margin-left: 8px; }
.scb-guest-item.scb-attending .scb-guest-icon { color: #28a745 !important; }
.scb-guest-item.scb-pending .scb-guest-icon { color: #ffd400 !important; }
#scb-guest-list::-webkit-scrollbar { width: 8px; }
#scb-guest-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,.06); border-radius: 8px; }
/* small responsive adjustment for narrow screens */
@media (max-width: 700px) {
    #scb-guest-list { max-height: 260px; }
}

/* Palette: show icons in a horizontal scroller (matches reference) */
#scb-palette {
    box-sizing: border-box;
    padding: 10px;
}
#scb-palette > div {
    /* make a single-row horizontal scroller */
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 10px !important;
    align-items: center;
    justify-content: flex-start;
    max-width: 160px; /* keep within left-panel width */
    max-height: 120px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
}

/* each icon item */
#scb-palette > div > div {
    flex: 0 0 auto;
    width: 64px !important;
    text-align: center;
    cursor: pointer;
}

/* icon visuals */
#scb-palette > div > div img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border: 1px solid #e6e6e6;
    padding: 6px;
    border-radius: 6px;
    background: #fff;
    transition: box-shadow .12s, transform .12s;
}

/* make palette + guest list scrollbars black (WebKit + Firefox) */
#scb-palette > div::-webkit-scrollbar { height: 8px; }
#scb-palette > div::-webkit-scrollbar-thumb { background: #000; border-radius: 8px; }
#scb-palette > div::-webkit-scrollbar-track { background: rgba(0,0,0,0.04); border-radius: 8px; }

#scb-guest-list::-webkit-scrollbar { width: 8px; }
#scb-guest-list::-webkit-scrollbar-thumb { background: #000; border-radius: 8px; }
#scb-guest-list::-webkit-scrollbar-track { background: rgba(0,0,0,0.04); border-radius: 8px; }

/* Firefox */
#scb-palette > div,
#scb-guest-list {
    scrollbar-color: #000 rgba(0,0,0,0.04);
    scrollbar-width: thin;
}

/* small screens: fallback to vertical list */
@media (max-width: 520px) {
    #scb-palette > div { flex-direction: column !important; max-width: 100%; max-height: 420px; overflow-x: hidden; overflow-y: auto; }
}

/* ensure markers are not clipped */
.scb-table,
.scb-table-shape,
.scb-seat {
    overflow: visible !important;
}

/* ensure seats are positioning contexts and don't clip markers */
.scb-seat {
    position: relative;
    overflow: visible !important;
}

/* default marker (kept for above/below variants) */
.scb-seat-guest {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
    z-index: 60;
    white-space: nowrap;
}

/* modifier: place avatar centered inside seat, label stacked below */
.scb-seat-guest--inside {
    left: 50%;
    top: 50%;
    transform: translate(-50%,-50%);  /* center both axes */
    display: block;
    position: absolute;
    pointer-events: auto;
    z-index: 60;
}

/* avatar sized to exactly match seat size (falls back to 30px) */
.scb-seat-guest--inside .scb-seat-avatar {
    width: var(--scb-seat-size, 30px);
    height: var(--scb-seat-size, 30px);
    border-radius: 50%;
    background: #ffd400;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    box-sizing: border-box;
}

/* seat icon (Font Awesome) inherits avatar color */
.scb-seat-avatar .scb-seat-icon {
    color: inherit;
    font-size: 28px;
    line-height: 1;
    display: block;
}

/* attendance variants for in-seat avatar */
.scb-seat-guest.scb-attending .scb-seat-avatar { background: #28a745; color: #fff; }
.scb-seat-guest.scb-pending   .scb-seat-avatar { background: #ffd400; color: #fff; }
.scb-seat-guest.scb-attending .scb-seat-avatar svg path { fill: #ffffff; }
.scb-seat-guest.scb-pending   .scb-seat-avatar svg path { fill: #ffffff; }

/* make icon inside avatar smaller so it fits neatly */
.scb-seat-guest--inside .scb-seat-avatar svg {
    width: 60%;
    height: 60%;
    display: block;
}

/* label positioned below the seat using the seat-size variable */
.scb-seat-guest--inside .scb-seat-label {
    position: absolute;
    left: 50%;
    top: calc(50% + (var(--scb-seat-size, 30px) / 2) + 6px);
    transform: translateX(-50%);
    background: rgba(255,255,255,0.98);
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    color: #222;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    white-space: nowrap;
    z-index: 70;
}

/* fallback: if there's no --scb-seat-size the calc uses default 30px */

/* small screens: reduce label size */
@media (max-width:700px) {
    .scb-seat-icon { font-size: 18px; }
    .scb-seat-label { font-size: 11px; padding: 2px 6px; }
}

/* hide assigned guest in sidebar */
.scb-guest-item.scb-guest-assigned { opacity: 0.6; pointer-events: none; }

/* Layout for list view area */
#scb-list-view {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: flex-start;
    justify-content: flex-start; /* change to center if you want cards centered */
    padding: 16px;
    box-sizing: border-box;
    background: #fafafa;
}

/* Card (per table) */
.scb-list-card {
    width: 320px;
    min-width: 260px;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 6px;
    padding: 14px;
    box-sizing: border-box;
    box-shadow: 0 6px 18px rgba(0,0,0,0.04);
    transition: transform .08s ease, box-shadow .12s ease;
}
.scb-list-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.06);
}

/* Header row inside card */
.scb-list-card > div:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.scb-table-name { font-weight: 700; font-size: 14px; color: #222; }
.scb-table-meta { font-size: 12px; color: #777; }

/* Assigned guest list */
.scb-assigned-list { margin-top: 10px; display:flex; flex-direction:column; gap:10px; }
.scb-assigned-row { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:13px; color:#222; }
.scb-assigned-row .guest-label { color:#333; }
.scb-assigned-row .guest-meta { color:#888; font-size:12px; }

/* Unassign button (blue like reference) */
.scb-assigned-row button {
    background: #0073aa;
    color: #fff;
    border: 0;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}
.scb-assigned-row button:hover { opacity: .9; }

/* Toolbar top-right */
#scb-view-toolbar {
    /*position: absolute;*/
    right: 18px;
    top: 18px;
    /*z-index: 12000;*/
    display: flex;
    gap: 8px;
}
#scb-view-toolbar button {
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}
#scb-view-toolbar button:disabled,
#scb-view-toolbar button.active {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* Guest strip / sidebar item styles */
.scb-guest-group { margin-bottom: 12px; }
.scb-guest-item {
    border: 1px solid #eee;
    padding: 6px 10px;
    border-radius: 18px;
    background: #fff;
    cursor: grab;
    display:inline-flex;
    align-items:center;
    gap:8px;
}

/* toggle button style (placed in sidebar or fixed top-left) */
.scb-sidebar-toggle {
    background: #fff;
    color: #222;
    border: 1px solid #ddd;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    box-shadow: 0 6px 18px rgba(0,0,0,.06);
}
.scb-sidebar-toggle:focus { outline: none; box-shadow: 0 0 0 3px rgba(0,115,170,0.12); }

/* ensure left panel keeps a fixed width and main area can grow */
#scb-left-panel {
    flex: 0 0 200px;
    width: 200px;
    box-sizing: border-box;
}

/* make the tables/container expand to available space and allow children to shrink */
#tables-container,
.seating-chart-root {
    flex: 1 1 auto;
    min-width: 0;          /* important: allow flex item to shrink instead of forcing overflow */
    width: 100%;
    box-sizing: border-box;
     position: relative;    /* absolute-positioned tables will be relative to this container */
     /* Always show a vertical scrollbar so users can scroll to the bottom
         and drop/place tables even when content does not initially overflow. */
     overflow-x: auto;
     overflow-y: scroll;
     /* Fix the canvas height so the scrollbar belongs to the seating canvas
         rather than the whole page. Adjust the offset to suit your site header. */
     height: calc(100vh - 120px);

     /* Scrollbar styling: much thicker and darker for better visibility */
     --scb-scrollbar-width: 28px;
}

/* WebKit/Blink scrollbar styles */
#tables-container::-webkit-scrollbar,
.seating-chart-root::-webkit-scrollbar {
    width: var(--scb-scrollbar-width) !important;
}
#tables-container::-webkit-scrollbar-thumb,
.seating-chart-root::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.65) !important;
    border-radius: 12px !important;
    border: 4px solid rgba(255,255,255,0.06) !important; /* subtle inner padding */
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.08) !important;
}
#tables-container::-webkit-scrollbar-track,
.seating-chart-root::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.08) !important;
    border-radius: 12px !important;
}
#tables-container::-webkit-scrollbar-thumb:hover,
.seating-chart-root::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.85) !important;
}

/* Encourage the browser to reserve space for the scrollbar to avoid layout shift */
#tables-container,
.seating-chart-root {
    scrollbar-gutter: stable both-edges;
    scrollbar-color: rgba(0,0,0,0.65) rgba(0,0,0,0.08);
    scrollbar-width: auto; /* ensure Firefox uses a visible width */
}

/* Firefox scrollbar styling */
#tables-container,
.seating-chart-root {
    scrollbar-color: rgba(0,0,0,0.55) rgba(0,0,0,0.08);
    scrollbar-width: auto; /* let Firefox use its default (wider) size */
}

/* Firefox scrollbar styling */
#tables-container,
.seating-chart-root {
    scrollbar-color: rgba(0,0,0,0.45) rgba(0,0,0,0.06);
    scrollbar-width: auto;
}

/* Provide additional non-interactive bottom space so users can scroll further
   down to place tables near the bottom of the canvas. Adjust the height as needed. */
#tables-container::after,
.seating-chart-root::after {
    content: '';
    display: block;
    height: 800px; /* extra scroll room */
    pointer-events: none;
}

/* keep top-right toolbar positioning from affecting layout */
#scb-view-toolbar { right: 18px; left: auto; }

/* Responsive */
@media (max-width: 900px) {
    .scb-list-card { width: calc(50% - 24px); }
}
@media (max-width: 520px) {
    .scb-list-card { width: calc(100% - 24px); }
}

.scb-seat,
.scb-table-seat,
.scb-seat *,
.scb-table-seat * {
    pointer-events: auto;
    touch-action: manipulation;
}
