* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f6fa;
    color: #1f2937;
    line-height: 1.6;
}

header {
    position: relative;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

#header-image {
    width: 100%;
    height: auto;
    display: block;
}

#footer-image {
    width: 100%;
    height: auto;
    display: block;
}

/* Matches the width of #info-blocks / #seatplan-section above it. */
#footer-text {
    width: 80vw;
    margin: 0 auto 1.5rem;
    color: #6b7280;
    font-size: 0.85rem;
    line-height: 1.6;
}

#footer-text a { color: #6154af; }

@media (max-width: 600px) and (orientation: portrait) {
    #footer-text {
        width: auto;
        margin: 0 1.1rem 1.25rem;
    }
}

#basket-summary {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: #ffffff;
    color: #6154af;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

#basket-summary:hover {
    background: #f0f0f0;
    transform: scale(1.04);
}

main {
    display: flex;
    flex-direction: column;
    max-width: 680px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    gap: 2rem;
}

/* Ticket hero */
.ticket-hero {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.09);
}

.ticket-hero-image img {
    width: 50%;
    height: auto;
    aspect-ratio: 1089 / 570;
    display: block;
    margin: 0 auto;
}

.ticket-hero-info {
    padding: 1.75rem;
}

.ticket-title {
    font-size: 1.65rem;
    font-weight: 800;
    color: #111827;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.ticket-subtitle {
    font-size: 0.95rem;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 0.4rem;
}

.ticket-info {
    font-size: 0.88rem;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.ticket-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: #6154af;
    margin-bottom: 1.75rem;
}

.qty-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
}

.hero-quantity-controls {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.qty-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #6154af;
    background: white;
    color: #6154af;
    font-size: 1.5rem;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    user-select: none;
    line-height: 1;
}

.qty-btn:hover {
    background: #6154af;
    color: white;
}

#hero-quantity {
    font-size: 2rem;
    font-weight: 800;
    color: #111827;
    min-width: 2.5rem;
    text-align: center;
}

#catalogue.hidden {
    display: none;
}

/* Info blocks (loaded from info-block-1.html / info-block-2.html, shown above
   the seat plan): side by side on wide viewports, stacked on narrow portrait
   ones. */
#info-blocks {
    display: flex;
    flex-direction: row;
    gap: 1.75rem;
    /* Break out of main's max-width and center on the viewport instead. */
    position: relative;
    left: 50%;
    width: 80vw;
    margin-left: -40vw;
}

.info-block {
    flex: 1 1 0;
    min-width: 0;
    background: white;
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.09);
    color: #374151;
    line-height: 1.6;
}

.info-block.hidden {
    display: none;
}

.info-block h1,
.info-block h2,
.info-block h3 {
    color: #111827;
    line-height: 1.25;
    margin-bottom: 0.6rem;
}

.info-block h2 { font-size: 1.35rem; font-weight: 800; }
.info-block h3 { font-size: 1.05rem; font-weight: 700; margin-top: 1rem; }
.info-block p { margin-bottom: 0.75rem; }
.info-block p:last-child { margin-bottom: 0; }
.info-block a { color: #6154af; }
.info-block ul, .info-block ol { margin: 0 0 0.75rem 1.25rem; }

.info-block img.align-right {
    display: block;
    margin-left: auto;
    max-width: 220px;
    height: auto;
}

.info-block .text-with-image {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.info-block .text-with-image p { margin: 0; }
.info-block .text-with-image img { flex-shrink: 0; max-width: 40%; }

@media (max-width: 600px) {
    .info-block { padding: 1rem 1.1rem; }
}

@media (max-width: 600px) and (orientation: portrait) {
    #info-blocks {
        flex-direction: column;
        gap: 1.25rem;
        width: 100vw;
        margin-left: -50vw;
    }
}

/* Seat plan */
#seatplan-section {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.09);
    /* Match #info-blocks' width: break out of main's max-width and center
       on the viewport instead. */
    position: relative;
    left: 50%;
    width: 80vw;
    margin-left: -40vw;
}

@media (max-width: 600px) and (orientation: portrait) {
    #seatplan-section {
        width: 100vw;
        margin-left: -50vw;
    }
}

#seatplan-section.hidden {
    display: none;
}

#seatplan-section h2,
#event-picker h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 1rem;
}

#event-picker {
    margin-bottom: 1.25rem;
}

#event-picker.hidden,
#seatplan-body.hidden {
    display: none;
}

#event-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.event-btn {
    flex: 1 1 14rem;
    padding: 0.9rem 1.2rem;
    border: 2px solid #6154af;
    border-radius: 12px;
    background: #ffffff;
    color: #6154af;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.event-btn:hover {
    background: #efedfa;
}

.event-btn.active {
    background: #6154af;
    color: #ffffff;
}

#basket-event {
    font-weight: 600;
    color: #6154af;
    margin-bottom: 0.75rem;
}

#basket-event.hidden {
    display: none;
}

#seatplan-wrap {
    position: relative;
}

#seatplan {
    overflow-x: auto;
}

#seatplan.loading {
    pointer-events: none;
    opacity: 0.6;
}

#seatplan svg {
    width: 100%;
    height: auto;
    max-width: 932px;
    display: block;
    margin: 0 auto;
}

#seatplan-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

#seatplan-loading.hidden {
    display: none;
}

.bagel-spinner {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 12px solid #e5e7eb;
    border-top-color: #6154af;
    animation: bagel-spin 0.8s linear infinite;
}

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

#table-intro {
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: -0.5rem 0 1rem;
}

/* Table cards of the seat plan SVG (classes set by app.js). The #seatplan
   scope outranks the SVG's own .cls-* rules. */
#seatplan .tbl-card {
    fill: #f2f8f1;
    stroke: #d8e4d9;
    stroke-width: 1.5px;
}

#seatplan .tbl-card.full {
    fill: #f8f3f1;
    stroke: #eee1dc;
}

#seatplan .tbl-card.active {
    fill: #fff7e9;
    stroke: #b47834;
    stroke-width: 2px;
}

#seatplan .tbl-badge        { fill: #deecdd; }
#seatplan .tbl-badge.full   { fill: #f0dfd8; }
#seatplan .tbl-badge.active { fill: #f3dfbd; }

#seatplan .tbl-badge-text {
    text-anchor: middle;
    fill: #315c43;
}

#seatplan .tbl-badge-text.full   { fill: #805b51; }
#seatplan .tbl-badge-text.active { fill: #755021; }

#seatplan .tbl-count {
    text-anchor: middle;
}

#seatplan .tbl-free {
    font-family: Arial, sans-serif;
    font-size: 14px;
    fill: #53685b;
}

#seatplan .tbl-btn {
    cursor: pointer;
}

#seatplan .tbl-btn rect {
    fill: #ffffff;
    stroke: #cbdccc;
    transition: fill 0.12s;
}

#seatplan .tbl-btn text {
    fill: #244b36;
}

#seatplan .tbl-btn:not(.disabled):hover rect {
    fill: #eef5ee;
}

#seatplan .tbl-btn:focus {
    outline: none;
}

#seatplan .tbl-btn:focus-visible rect {
    stroke: #a66d2b;
    stroke-width: 3px;
}

#seatplan .tbl-btn.disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.basket-item.table-row {
    grid-template-columns: 1fr auto auto;
}

.selection-clear {
    width: 24px;
    height: 24px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.selection-clear:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
}

#basket-detail {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    background: #f2f7ef;
    color: #526b58;
    font-size: 0.85rem;
    line-height: 1.5;
}

#basket-detail.warn {
    background: #fff2dd;
    color: #7c5429;
}

#basket-detail.hidden {
    display: none;
}

/* Basket */
#basket {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
    border: 1px solid #f0f0f0;
}

#basket h2 {
    margin-bottom: 1.25rem;
    color: #111827;
    font-size: 1.25rem;
    font-weight: 700;
}

.basket-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
    align-items: center;
}

.basket-item-info h4 {
    font-size: 0.9rem;
    color: #111827;
    font-weight: 600;
}

.item-subtotal {
    font-weight: 700;
    color: #111827;
    font-size: 0.95rem;
    min-width: 3.5rem;
    text-align: right;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.quantity-controls button {
    width: 28px;
    height: 28px;
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.quantity-controls button:hover {
    background: #6154af;
    border-color: #6154af;
    color: white;
}

.quantity-controls span {
    min-width: 24px;
    text-align: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.empty-basket {
    text-align: center;
    padding: 1.5rem;
    color: #9ca3af;
    font-size: 0.9rem;
}

#basket-footer {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #f3f4f6;
}

#total-line {
    display: flex;
    justify-content: space-between;
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #111827;
}

#checkout-btn {
    width: 100%;
    padding: 1rem;
    background: #6154af;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    letter-spacing: 0.01em;
}

#checkout-btn:hover:not(:disabled) {
    background: #4a3e8a;
    transform: scale(1.01);
}

#checkout-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
}

#switch-off-message {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 600;
    color: #374151;
    text-align: center;
    padding: 2rem;
    max-width: 80%;
    margin: 0 auto;
}

#switch-off-message.hidden {
    display: none;
}

main.hidden {
    display: none;
}

#loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem 3rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    z-index: 100;
    font-weight: 600;
    color: #6154af;
}

#loading.hidden {
    display: none;
}

#error-message {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #ef4444;
    color: white;
    padding: 1rem 2rem;
    border-radius: 8px;
    display: none;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(239,68,68,0.3);
}

#error-message.visible {
    display: block;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    position: relative;
    background: white;
    border-radius: 14px;
    padding: 2rem;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

#modal-close {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s, background 0.15s;
}

#modal-close:hover {
    color: #111827;
    background: #f3f4f6;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #374151;
}

.form-group input {
    padding: 0.65rem 0.85rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #111827;
    transition: border-color 0.15s;
    outline: none;
}

.form-group input:focus {
    border-color: #6154af;
}

.form-group input.invalid {
    border-color: #ef4444;
}

.field-error {
    font-size: 0.8rem;
    color: #ef4444;
    display: none;
}

.field-error.visible {
    display: block;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.modal-actions button {
    flex: 1;
    padding: 0.85rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.1s;
}

#modal-cancel {
    background: #f3f4f6;
    color: #374151;
}

#modal-cancel:hover {
    background: #e5e7eb;
}

#modal-pay {
    background: #6154af;
    color: white;
}

#modal-pay:hover {
    background: #4a3e8a;
    transform: scale(1.01);
}

@media (max-width: 600px) {
    main {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    header {
        padding: 0.75rem 1rem;
    }

    #shop-logo {
        height: 48px;
        width: 48px;
    }

    .ticket-title {
        font-size: 1.35rem;
    }

    #seatplan-section {
        padding: 1rem;
    }

    #seatplan svg {
        max-width: 100%;
    }
}

/* Mobile: centered horizontally at the bottom of the header image. */
@media (max-width: 600px) and (orientation: portrait) {
    #basket-summary {
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        white-space: nowrap;
    }

    #basket-summary:hover {
        transform: translateX(-50%) scale(1.04);
    }
}
