/* Warm Seats - Wedding Seating Planner */

/* ===== Theme variables ===== */
:root {
    --bg-page: #fffbeb;
    --bg-card: #ffffff;
    --bg-card-hover: #fefce8;
    --bg-input: #ffffff;
    --bg-nav: #92400e;
    --bg-tray: #ffffff;
    --bg-table-surface: #d97706;
    --bg-table-surface-inner: #b45309;
    --bg-guest: #fffbeb;
    --bg-guest-hover: #fef3c7;
    --bg-modal-overlay: rgba(0,0,0,0.5);
    --bg-modal: #ffffff;
    --border-guest: #d97706;
    --border-table: #fbbf24;
    --border-table-dashed: #fde68a;
    --text-primary: #78350f;
    --text-secondary: #92400e;
    --text-muted: #a16207;
    --text-body: #374151;
    --text-heading: #78350f;
    --text-nav: #ffffff;
    --text-nav-accent: #fde68a;
    --text-input: #1f2937;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --guest-changed-bg: #eff6ff;
    --guest-changed-border: #3b82f6;
}

.dark {
    --bg-page: #1a1a1a;
    --bg-card: #2a2a2a;
    --bg-card-hover: #333333;
    --bg-input: #333333;
    --bg-nav: #1f1f1f;
    --bg-tray: #2a2a2a;
    --bg-table-surface: #92400e;
    --bg-table-surface-inner: #78350f;
    --bg-guest: #333333;
    --bg-guest-hover: #3d3d3d;
    --bg-modal-overlay: rgba(0,0,0,0.7);
    --bg-modal: #2a2a2a;
    --border-guest: #b45309;
    --border-table: #92400e;
    --border-table-dashed: #78350f;
    --text-primary: #fbbf24;
    --text-secondary: #f59e0b;
    --text-muted: #d97706;
    --text-body: #d4d4d4;
    --text-heading: #fbbf24;
    --text-nav: #e5e5e5;
    --text-nav-accent: #fbbf24;
    --text-input: #e5e5e5;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --guest-changed-bg: #1e3a5f;
    --guest-changed-border: #3b82f6;
}

/* ===== Base ===== */
body {
    background: var(--bg-page);
    color: var(--text-body);
    transition: background 0.3s, color 0.3s;
}

/* ===== Nav overrides ===== */
nav.site-nav {
    background: var(--bg-nav) !important;
    color: var(--text-nav);
    box-shadow: var(--shadow-md);
}
nav.site-nav a { color: var(--text-nav); }
nav.site-nav a:hover, nav.site-nav a.active { color: var(--text-nav-accent); }
nav.site-nav .user-label { color: var(--text-nav-accent); opacity: 0.8; }

/* Dark mode toggle */
.dark-toggle {
    background: none;
    border: 1px solid var(--text-nav-accent);
    color: var(--text-nav-accent);
    border-radius: 8px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.2s;
}
.dark-toggle:hover { background: rgba(255,255,255,0.1); }

/* ===== Guest card ===== */
.guest-card {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 3px 7px;
    border-radius: 6px;
    background: var(--bg-guest);
    border: 1px solid var(--border-guest);
    cursor: grab;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-primary);
    transition: box-shadow 0.15s, transform 0.15s, background 0.15s;
    white-space: nowrap;
    user-select: none;
    min-width: 160px;
    box-sizing: border-box;
}

.guest-card:hover {
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
    transform: translateY(-1px);
    background: var(--bg-guest-hover);
}

.guest-card.sortable-ghost {
    opacity: 0.4;
    background: #fde68a;
}

.guest-card.sortable-chosen {
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.4);
}

.guest-card .tag-dots {
    display: inline-flex;
    gap: 2px;
    margin-left: 4px;
}

.guest-card .tag-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.guest-card .edit-tags-btn {
    opacity: 0;
    cursor: pointer;
    font-size: 0.65rem;
    margin-left: 2px;
    transition: opacity 0.15s;
}

.guest-card:hover .edit-tags-btn { opacity: 0.6; }
.guest-card .edit-tags-btn:hover { opacity: 1; }

/* Tag dot colors */
.tag-dot-no_english { background: #ef4444; }
.tag-dot-family { background: #8b5cf6; }
.tag-dot-quarantine { background: #f97316; }
.tag-dot-vegetarian { background: #22c55e; }
.tag-dot-vegan { background: #16a34a; }
.tag-dot-allergy { background: #eab308; }
.tag-dot-sensitive { background: #ec4899; }
.tag-dot-social_glue { background: #3b82f6; }
.tag-dot-silent_type { background: #6b7280; }
.tag-dot-too_dutch { background: #f97316; border: 1px solid #ea580c; }

/* Legend tags */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 9999px;
    font-weight: 500;
    color: var(--text-body);
}

.tag::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.tag-no_english::before { background: #ef4444; }
.tag-family::before { background: #8b5cf6; }
.tag-quarantine::before { background: #f97316; }
.tag-vegetarian::before { background: #22c55e; }
.tag-vegan::before { background: #16a34a; }
.tag-allergy::before { background: #eab308; }
.tag-sensitive::before { background: #ec4899; }
.tag-social_glue::before { background: #3b82f6; }
.tag-silent_type::before { background: #6b7280; }
.tag-too_dutch::before { background: #f97316; }

/* ===== Tables grid — 3 columns flush like the physical layout ===== */
.tables-grid-wrap {
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: background 0.3s;
}

.tables-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 1fr;
    gap: 0;
    align-items: stretch;
}

/* ===== Table component ===== */
.table-card {
    background: var(--bg-card);
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    transition: background 0.3s;
    border-right: 1px solid var(--border-table-dashed);
    border-bottom: 1px solid var(--border-table-dashed);
    display: flex;
    flex-direction: column;
}

.table-card:nth-child(4n) {
    border-right: none;
}

.table-header {
    display: none;
}

.table-card {
    position: relative;
}

.table-label {
    display: none;
}

/* Table body: left seats | table surface | right seats */
.table-body {
    display: flex;
    align-items: stretch;
    min-height: 80px;
    padding: 4px 4px 6px 4px;
    flex: 1;
}

/* Editable table name */
.table-name-input {
    font-weight: 700;
    color: var(--text-heading);
    font-size: 0.85rem;
    background: transparent;
    border: none;
    border-bottom: 1px dashed transparent;
    outline: none;
    padding: 0;
    width: 80px;
    cursor: text;
}
.table-name-input:hover {
    border-bottom-color: var(--border-guest);
}
.table-name-input:focus {
    border-bottom-color: var(--text-heading);
}

.table-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 3px;
    min-height: 40px;
}

.table-side-left {
    align-items: flex-end;
}

.table-side-right {
    align-items: flex-start;
}

/* The table surface between left and right */
.table-surface {
    width: 44px;
    min-width: 44px;
    background: var(--bg-table-surface);
    border-radius: 8px;
    margin: 0 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.2);
}

.table-surface::before,
.table-surface::after {
    content: '';
    position: absolute;
    left: 3px;
    right: 3px;
    height: 2px;
    background: var(--bg-table-surface-inner);
    border-radius: 2px;
}
.table-surface::before { top: 5px; }
.table-surface::after { bottom: 5px; }

.table-surface .animal-emoji {
    font-size: 1.4rem;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
    line-height: 1;
    z-index: 1;
}

/* Unseated tray */
.unseated-tray {
    background: var(--bg-tray);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    padding: 12px 16px;
    transition: background 0.3s;
}
.unseated-tray h2 {
    color: var(--text-muted);
}

/* Anchor guests — locked in place */
.guest-card.anchor {
    border-style: double;
    border-width: 3px;
    opacity: 0.85;
    cursor: default;
}

.guest-card.anchor::after {
    content: '\1F512';
    font-size: 0.5rem;
    margin-left: 3px;
}

.ceremony-seat.anchor {
    border-style: double;
    border-width: 3px;
    cursor: default;
    opacity: 0.85;
}

/* Changed guest highlight */
.guest-card.changed {
    border-color: var(--guest-changed-border);
    background: var(--guest-changed-bg);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Modals */
.modal-overlay {
    background: var(--bg-modal-overlay);
}
.modal-content {
    background: var(--bg-modal);
    color: var(--text-body);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}
.modal-content input,
.modal-content textarea {
    background: var(--bg-input);
    color: var(--text-input);
    border-color: var(--border-guest);
}
.modal-content label {
    color: var(--text-body);
}

/* Guest list drop zone */
.guest-list {
    min-height: 30px;
}

/* ===== Board layout ===== */
.board-layout {
    display: block;
}

.board-main {
    min-width: 0;
}

/* Version drawer - left side */
.version-sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    width: 280px;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    padding: 16px;
    overflow-y: auto;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s ease, background 0.3s;
}

.version-sidebar.open {
    transform: translateX(0);
}

.version-drawer-toggle {
    position: fixed;
    top: 64px;
    left: 0;
    z-index: 41;
    background: var(--bg-table-surface);
    color: #fff;
    border: none;
    border-radius: 0 8px 8px 0;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    writing-mode: vertical-rl;
    letter-spacing: 1px;
    box-shadow: var(--shadow-md);
    transition: left 0.25s ease, background 0.2s;
}

.version-drawer-toggle.shifted {
    left: 280px;
}

.version-drawer-toggle:hover {
    background: var(--bg-table-surface-inner);
}

.version-entry {
    border-left: 3px solid var(--border-table-dashed);
    padding: 0 0 12px 10px;
    margin-bottom: 0;
    position: relative;
}

.version-entry:last-child {
    padding-bottom: 0;
}

.version-entry.version-active {
    border-left-color: var(--bg-table-surface);
}

.version-entry::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--border-table-dashed);
}

.version-entry.version-active::before {
    background: var(--bg-table-surface);
    box-shadow: 0 0 0 2px var(--bg-page);
}

.version-link {
    text-decoration: none;
    display: block;
}

.version-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.version-number {
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-heading);
}

.version-date {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.version-title {
    font-size: 0.7rem;
    color: var(--text-body);
    margin-top: 2px;
    line-height: 1.3;
}

.version-meta {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.version-changes {
    margin-top: 4px;
    padding: 4px 0;
}

.version-change {
    font-size: 0.6rem;
    color: var(--text-muted);
    padding: 1px 0;
    line-height: 1.4;
}

/* ===== Proposals page (dark mode compat) ===== */
.proposal-card {
    background: var(--bg-card);
    color: var(--text-body);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    padding: 16px;
    margin-bottom: 12px;
    display: block;
    transition: box-shadow 0.15s, background 0.3s;
    text-decoration: none;
}
.proposal-card:hover {
    box-shadow: var(--shadow-md);
    background: var(--bg-card-hover);
}
.proposal-card .name { font-weight: 600; color: var(--text-heading); }
.proposal-card .meta { font-size: 0.75rem; color: var(--text-muted); }
.proposal-card .desc { font-size: 0.875rem; color: var(--text-muted); margin-top: 4px; }

/* Status badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
}
.badge-stock   { background: #fef3c7; color: #92400e; }
.badge-pending { background: #fef9c3; color: #854d0e; }
.badge-approved{ background: #dcfce7; color: #166534; }
.badge-rejected{ background: #fee2e2; color: #991b1b; }
.badge-draft   { background: #f3f4f6; color: #374151; }

/* Action buttons — always visible in both themes */
.btn-primary {
    background: transparent;
    color: var(--bg-table-surface);
    border: 2px solid var(--bg-table-surface);
    padding: 6px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.btn-primary:hover {
    background: var(--bg-table-surface);
    color: #fff;
}
.btn-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 2px solid var(--border-table-dashed);
    padding: 6px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.btn-secondary:hover {
    background: var(--border-table-dashed);
    color: var(--text-heading);
}
.btn-approve {
    background: transparent;
    color: #16a34a;
    border: 2px solid #16a34a;
    padding: 6px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.btn-approve:hover {
    background: #16a34a;
    color: #fff;
}
.btn-reject {
    background: transparent;
    color: #dc2626;
    border: 2px solid #dc2626;
    padding: 6px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.btn-reject:hover {
    background: #dc2626;
    color: #fff;
}
.btn-export {
    background: transparent;
    color: var(--text-muted);
    border: 2px solid var(--text-muted);
    padding: 6px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}
.btn-export:hover {
    background: var(--text-muted);
    color: var(--bg-page);
}

/* ===== Ceremony seating ===== */
.ceremony-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    transition: background 0.3s;
}

.ceremony-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.ceremony-seat {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid var(--border-guest);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 0.6rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-guest);
    padding: 4px;
    line-height: 1.2;
    transition: box-shadow 0.15s, background 0.15s;
    word-break: break-word;
}

.ceremony-seat:hover {
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
}

.ceremony-seat.couple {
    width: 90px;
    height: 90px;
    border-color: var(--bg-table-surface);
    border-width: 3px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--bg-table-surface);
    color: #fff;
    box-shadow: 0 2px 12px rgba(217, 119, 6, 0.4);
}

.ceremony-seat.empty {
    border-style: dashed;
    opacity: 0.3;
}

.ceremony-row-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    width: 50px;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .tables-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .table-card:nth-child(4n) { border-right: 1px solid var(--border-table-dashed); }
    .table-card:nth-child(2n) { border-right: none; }
}
@media (max-width: 580px) {
    .tables-grid {
        grid-template-columns: 1fr;
    }
    .table-card { border-right: none !important; }
    .table-body {
        flex-direction: column;
    }
    .table-surface {
        width: 100%;
        min-width: unset;
        height: 36px;
        min-height: 36px;
        flex-direction: row;
        margin: 3px 0;
        border-radius: 6px;
    }
    .table-surface::before,
    .table-surface::after {
        top: 4px;
        bottom: 4px;
        height: auto;
        width: 2px;
    }
    .table-surface::before { left: 5px; right: auto; }
    .table-surface::after  { right: 5px; left: auto; }
    .table-side-left,
    .table-side-right {
        align-items: flex-start;
    }
}
