/* ── TWG Teatri Broneerimine – Frontend ── */
/* Design matches Tartu Waldorf Teater: purple/teal gradient, dark accents */

:root {
    --twt-primary: #6b2fa0;
    --twt-primary-light: #8b4fc0;
    --twt-gradient: linear-gradient(135deg, #1a8a7d 0%, #6b2fa0 50%, #9b3fb0 100%);
    --twt-dark: #2d2d3d;
    --twt-darker: #1e1e2e;
    --twt-text: #333;
    --twt-text-light: #fff;
    --twt-available: #4caf50;
    --twt-available-hover: #388e3c;
    --twt-booked: #616161;
    --twt-selected: #ff9800;
    --twt-selected-hover: #f57c00;
    --twt-blocked: #9e9e9e;
    --twt-stage: #e53935;
    --twt-radius: 4px;
}

/* Wrap */
.twt-wrap {
    max-width: 960px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--twt-text);
}

/* ── Show header ── */
.twt-show-header {
    background: var(--twt-gradient);
    color: var(--twt-text-light);
    padding: 28px 32px;
    border-radius: 8px 8px 0 0;
    text-align: center;
}
.twt-show-title {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 700;
    color: var(--twt-text-light);
}
.twt-show-datetime {
    margin: 0;
    font-size: 16px;
    opacity: .9;
}
.twt-show-notes {
    margin: 10px 0 0;
    font-size: 14px;
    opacity: .85;
    font-style: italic;
}

/* ── Booking closed banner ── */
.twt-booking-closed {
    background: #e53935;
    color: #fff;
    text-align: center;
    padding: 12px;
    font-weight: 700;
    font-size: 15px;
}
.twt-booking-closed p { margin: 0; }

/* ── Legend ── */
.twt-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 16px 0;
    background: #f5f5f5;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    flex-wrap: wrap;
}
.twt-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}
.twt-legend-box {
    width: 20px;
    height: 20px;
    border-radius: var(--twt-radius);
    display: inline-block;
}
.twt-legend-box.available { background: var(--twt-available); }
.twt-legend-box.booked    { background: var(--twt-booked); }
.twt-legend-box.selected  { background: var(--twt-selected); }
.twt-legend-box.blocked   { background: var(--twt-blocked); opacity: .5; }

/* ── Seat map ── */
.twt-seatmap {
    background: var(--twt-darker);
    padding: 20px 12px 30px 12px;
    border-left: 1px solid #333;
    border-right: 1px solid #333;
    overflow: visible;
    position: relative;
    margin-right: 82px;
}

/* Stage */
.twt-stage {
    background: var(--twt-stage);
    color: #fff;
    text-align: center;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 4px;
    padding: 14px 0;
    margin: 0 auto 24px;
    max-width: 75%;
    border-radius: var(--twt-radius);
}

/* Entrance label */
.twt-entrance-label {
    position: absolute;
    top: 0;
    bottom: 0;
    right: -82px;
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    color: #fff;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 2px;
    white-space: nowrap;
    background: var(--twt-stage);
    border-radius: 0 var(--twt-radius) var(--twt-radius) 0;
    z-index: 5;
}

/* Row */
.twt-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    gap: 6px;
}
.twt-row-label-left,
.twt-row-label-right {
    color: #aaa;
    font-size: 11px;
    font-weight: 600;
    min-width: 48px;
    white-space: nowrap;
}
.twt-row-label-left  { text-align: right; }
.twt-row-label-right { text-align: left; }

/* Seats container */
.twt-seats {
    display: flex;
    justify-content: center;
    gap: 3px;
    flex-wrap: nowrap;
}

/* Individual seat */
.twt-seat {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--twt-radius);
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    transition: all .15s ease;
    position: relative;
    user-select: none;
}
.twt-seat.available {
    background: var(--twt-available);
}
.twt-seat.available.clickable {
    cursor: pointer;
}
.twt-seat.available.clickable:hover {
    background: var(--twt-available-hover);
    transform: scale(1.12);
    z-index: 2;
}
.twt-seat.booked {
    background: var(--twt-booked);
    cursor: not-allowed;
}
.twt-seat.blocked {
    background: var(--twt-blocked);
    opacity: .35;
    cursor: not-allowed;
}
.twt-seat.selected {
    background: var(--twt-selected) !important;
    transform: scale(1.1);
    z-index: 2;
    box-shadow: 0 0 8px rgba(255, 152, 0, .5);
}
.twt-seat.selected:hover {
    background: var(--twt-selected-hover) !important;
}
.twt-seat-num {
    font-size: 10px;
    line-height: 1;
}

/* ── Stats ── */
.twt-stats-info {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 14px;
    background: #f5f5f5;
    border-left: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
    font-size: 14px;
    color: #555;
}

/* ── Booking form ── */
.twt-booking-form {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: 3px solid var(--twt-primary);
    border-radius: 0 0 8px 8px;
    padding: 24px 32px;
}
.twt-form-title {
    margin: 0 0 12px;
    font-size: 18px;
    color: var(--twt-primary);
}
.twt-selected-summary {
    margin-bottom: 16px;
}
.twt-selected-count {
    font-weight: 600;
    margin-bottom: 6px;
}
.twt-selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.twt-selected-list li {
    background: var(--twt-selected);
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.twt-form-fields {
    margin-bottom: 16px;
}
.twt-form-fields label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
}
.twt-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: var(--twt-radius);
    font-size: 15px;
    transition: border-color .2s;
}
.twt-input:focus {
    border-color: var(--twt-primary);
    outline: none;
}

.twt-form-actions {
    display: flex;
    gap: 10px;
}

/* Buttons */
.twt-btn {
    padding: 10px 24px;
    border: none;
    border-radius: var(--twt-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.twt-btn-primary {
    background: var(--twt-primary);
    color: #fff;
}
.twt-btn-primary:hover {
    background: var(--twt-primary-light);
}
.twt-btn-primary:disabled {
    opacity: .6;
    cursor: not-allowed;
}
.twt-btn-secondary {
    background: #e0e0e0;
    color: #333;
}
.twt-btn-secondary:hover {
    background: #d0d0d0;
}

/* Messages */
.twt-form-message { margin-top: 12px; }
.twt-success {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 12px 16px;
    border-radius: var(--twt-radius);
    font-weight: 500;
}
.twt-error {
    background: #ffebee;
    color: #c62828;
    padding: 12px 16px;
    border-radius: var(--twt-radius);
    font-weight: 500;
}

/* ── Show selector / cards ── */
.twt-show-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.twt-heading {
    font-size: 20px;
    color: var(--twt-primary);
    margin: 0 0 16px;
}
.twt-show-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px 24px;
    transition: box-shadow .2s;
}
.twt-show-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.twt-show-card h4 {
    margin: 0 0 4px;
    font-size: 18px;
    color: var(--twt-dark);
}
.twt-show-date {
    margin: 0;
    color: #666;
    font-size: 14px;
}
.twt-show-avail { margin: 6px 0 0; }
.twt-avail-badge {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.twt-closed-badge {
    background: #ffebee;
    color: #c62828;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}
.twt-select-show {
    background: var(--twt-primary);
    color: #fff;
}
.twt-select-show:hover {
    background: var(--twt-primary-light);
}

/* Loading */
.twt-loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 16px;
}
.twt-no-shows {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .twt-seat {
        width: 26px;
        height: 26px;
    }
    .twt-seat-num {
        font-size: 8px;
    }
    .twt-row-label-left,
    .twt-row-label-right {
        font-size: 9px;
        min-width: 32px;
    }
    .twt-stage {
        font-size: 13px;
        padding: 10px 0;
    }
    .twt-show-header {
        padding: 20px 16px;
    }
    .twt-show-title {
        font-size: 20px;
    }
    .twt-booking-form {
        padding: 20px 16px;
    }
    .twt-entrance-label {
        display: none;
    }
    .twt-show-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
@media (max-width: 480px) {
    .twt-seat {
        width: 22px;
        height: 22px;
    }
    .twt-seats {
        gap: 2px;
    }
    .twt-seatmap {
        padding: 12px 4px 20px;
    }
}
