/* === Reset & Base === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f0;
    color: #333;
    line-height: 1.5;
    min-height: 100vh;
}

/* === Header === */
.header {
    background: #253848;
    border-bottom: none;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 400;
    color: rgba(255,255,255,0.8);
}

.logo img {
    height: 40px;
}

.logo span {
    font-weight: 400;
    color: rgba(255,255,255,0.8);
    margin-left: 0;
}

.header-right {
    display: flex;
    gap: 8px;
}

/* === Buttons === */
.btn {
    padding: 8px 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s;
    background: #fff;
    text-decoration: none;
}

.btn:hover {
    background: #f0f0f0;
}

.btn-primary {
    background: #253848;
    color: #fff;
    border-color: #253848;
}

.btn-primary:hover {
    background: #a9cae9;
    color: #253848;
    border-color: #a9cae9;
}

.btn-secondary {
    background: #fff;
    color: #555;
}

.header .btn {
    background: transparent;
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

.header .btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.5);
}

/* === Filters === */
.filters {
    background: #fff;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid #eee;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
}

.filter-group input,
.filter-group select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
    background: #fff;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: #253848;
}

/* === Event Selector === */
.event-selector {
    padding: 16px 24px;
}

.event-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.event-card {
    background: #fff;
    border: 2px solid #a9cae9;
    border-radius: 10px;
    padding: 16px 20px;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 200px;
}

.event-card:hover {
    border-color: #253848;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.event-card.active {
    border-color: #253848;
    background: #edf4fa;
}

.event-card .event-code {
    font-weight: 700;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 4px;
}

.event-card .event-type {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.event-card .event-meta {
    font-size: 0.85rem;
    color: #666;
}

.event-card .guest-count {
    font-size: 0.9rem;
    margin-top: 8px;
    font-weight: 600;
}

.event-card .guest-count .count {
    color: #253848;
}

/* === Hide Event Button === */
.event-card {
    position: relative;
}

.btn-hide-event {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #bbb;
    font-size: 18px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    border-radius: 50%;
    padding: 0;
    transition: all 0.15s;
}

.btn-hide-event:hover {
    background: #fee;
    color: #c0392b;
}

.btn-hide-event-mini {
    position: static;
    width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 20px;
    flex-shrink: 0;
}

/* === Section Header === */
.section-header {
    padding: 16px 24px 8px;
}

.section-header h2 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.summary-bar {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: #555;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.summary-item strong {
    color: #253848;
}

/* === Tables Grid (Seating) === */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 8px 24px 24px;
}

/* === Single Table === */
.table-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    overflow: hidden;
}

.table-header {
    background: #253848;
    color: #fff;
    text-align: center;
    padding: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
}

.table-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.table-side {
    display: flex;
    flex-direction: column;
}

.table-side-left {
    border-right: 2px solid #e8e8e4;
}

.seat {
    padding: 8px 10px;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    border-bottom: 1px solid #f0f0ec;
    transition: background 0.15s;
}

.seat:last-child {
    border-bottom: none;
}

.seat-empty {
    background: #f8f8f5;
    color: #bbb;
    font-style: italic;
    border: 1px dashed #ddd;
    border-bottom: 1px dashed #ddd;
}

.seat-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.seat-drink {
    font-size: 1rem;
    flex-shrink: 0;
}

.seat.checked-in {
    border-left: 3px solid #4caf50;
}

.seat.checked-in .seat-name::after {
    content: ' \2713';
    color: #4caf50;
    font-weight: 700;
}

.highlight-checkin {
    animation: pulse-green 0.5s ease-in-out 5;
    border: 3px solid #4CAF50 !important;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.5);
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 5px rgba(76, 175, 80, 0.3); }
    50% { box-shadow: 0 0 20px rgba(76, 175, 80, 0.7); }
}

/* === Attendees Table === */
#attendees-view {
    padding: 24px;
}

#attendees-view h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.table-wrapper {
    overflow-x: auto;
}

.attendees-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    font-size: 14px;
}

.attendees-table th {
    background: #253848;
    color: #fff;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.attendees-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0ec;
    vertical-align: middle;
}

.attendees-table tr:hover td {
    background: #fafaf7;
}


.col-checkin {
    width: 40px;
    text-align: center;
}

.col-count {
    width: 40px;
    text-align: center;
}

.col-drink {
    width: 40px;
    text-align: center;
}

.col-table {
    width: 50px;
    text-align: center;
}

.col-phone {
    white-space: nowrap;
}

.checkin-cb {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4caf50;
}

.remark-text {
    font-size: 14px;
    color: #333;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seating-warning {
    color: #e67e22;
    font-weight: 600;
    font-size: 14px;
}

/* === Footer === */
.footer {
    text-align: center;
    padding: 16px;
    font-size: 0.8rem;
    color: #999;
    border-top: 1px solid #eee;
    margin-top: 24px;
}

/* === Loading === */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 1rem;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top-color: #253848;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: #999;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: #777;
}

/* === Responsive === */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 16px;
    }

    .filter-group {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

    .filter-group label {
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 4px;
        text-align: left;
    }

    .filter-group input,
    .filter-group select {
        width: 100%;
        font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        font-size: 16px;
        padding: 10px 12px;
        height: 44px;
        border: 1px solid #ccc;
        border-radius: 8px;
        background: #fff;
        text-align: left;
        -webkit-appearance: none;
        appearance: none;
    }

    .filters .btn-primary {
        width: 100%;
        font-size: 16px;
        padding: 12px;
    }

    .tables-grid {
        grid-template-columns: 1fr;
        padding: 8px 12px;
    }

    .event-cards {
        flex-direction: column;
    }

    #attendees-view {
        padding: 12px;
    }

    .col-phone {
        display: none;
    }
}

/* === Print Styles === */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
        font-size: 10pt;
    }

    .header {
        position: static;
        border-bottom: 1px solid #000;
        padding: 8px 0;
    }

    .header-right {
        display: none;
    }

    .section-header {
        padding: 8px 0;
    }

    .tables-grid {
        padding: 0;
        gap: 8px;
        grid-template-columns: repeat(2, 1fr);
    }

    .table-card {
        box-shadow: none;
        border: 1px solid #333;
        page-break-inside: avoid;
    }

    .table-header {
        background: #333;
        padding: 4px 8px;
        font-size: 9pt;
    }

    .seat {
        padding: 3px 6px;
        min-height: 24px;
        font-size: 8pt;
    }

    .attendees-table {
        box-shadow: none;
        border: 1px solid #333;
        font-size: 8pt;
        page-break-before: always;
    }

    .attendees-table th {
        background: #333;
        padding: 4px 6px;
        font-size: 8pt;
    }

    .attendees-table td {
        padding: 3px 6px;
    }

    .footer {
        display: none;
    }

    @page {
        size: A4 landscape;
        margin: 10mm;
    }
}
