/*
 * Senior Seat Map — styles v2
 * PumpHouse branding: deep red #8b1a1a, Georgia serif headings, high contrast.
 * Sized for elderly tablet users — large touch targets, bold text throughout.
 */

/* ── Utility ─────────────────────────────────────────────────────────────── */
.ssm-hidden { display: none !important; }

/* ── Wrap ────────────────────────────────────────────────────────────────── */
#ssm-wrap {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    max-width: 740px;
    margin: 0 auto;
    color: #1a1a1a;
}
/* Ensure all inputs size correctly within their containers */
#ssm-wrap *,
#ssm-wrap *::before,
#ssm-wrap *::after {
    box-sizing: border-box;
}

/* ── Loading / error ─────────────────────────────────────────────────────── */
.ssm-loading,
#ssm-error {
    padding: 40px;
    text-align: center;
    color: #666;
    font-size: 1.1rem;
}

/* ── Legend ──────────────────────────────────────────────────────────────── */
.ssm-legend {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}
.ssm-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
}
.ssm-legend-item::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 5px;
    flex-shrink: 0;
}
.ssm-legend-item.ssm-available::before { background: #e8f5d8; border: 2px solid #4a8a20; }
.ssm-legend-item.ssm-held::before      { background: #fff3d0; border: 2px solid #c07800; }
.ssm-legend-item.ssm-sold::before      { background: #e8d8d0; border: 2px solid #8b1a1a; }

/* ── Stage indicator ─────────────────────────────────────────────────────── */
.ssm-stage {
    background: #1a1a1a;
    color: #fff;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* ── Map scroll container ─────────────────────────────────────────────────── */
/* Desktop: no constraints — grid lays out at natural width                   */
/* Mobile:  #ssm-wrap is clamped to viewport, scroll activates inside here   */
.ssm-map-scroll {
    padding-bottom: 4px;
}

/* ── Grid ────────────────────────────────────────────────────────────────── */
#ssm-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.ssm-row {
    display: flex;
    align-items: center;
    gap: 4px;
}
.ssm-row--indent {
    padding-left: 46px;
}

.ssm-row-label {
    width: 24px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #888;
    text-align: center;
    flex-shrink: 0;
    font-family: Georgia, serif;
}

/* ── Seat buttons ────────────────────────────────────────────────────────── */
.ssm-seat {
    width: 46px;
    height: 46px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    flex-shrink: 0;
    padding: 2px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
}

.ssm-seat-num {
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
}
.ssm-seat-price {
    font-size: 0.6rem;
    font-weight: 600;
    line-height: 1;
    opacity: 0.85;
}

.ssm-seat--available {
    background: #e8f5d8;
    border-color: #4a8a20;
    color: #2a5a08;
}
.ssm-seat--available:hover {
    background: #c8e8a0;
    transform: scale(1.15);
    box-shadow: 0 3px 10px rgba(60,120,20,0.3);
    position: relative;
    z-index: 1;
}
.ssm-seat--available:focus-visible {
    outline: 3px solid #4a8a20;
    outline-offset: 2px;
}

.ssm-seat--held {
    background: #fff3d0;
    border-color: #c07800;
    color: #7a4800;
    cursor: not-allowed;
    opacity: 0.85;
}

.ssm-seat--sold {
    background: #e8d8d0;
    border-color: #8b1a1a;
    color: #5a1010;
    cursor: pointer;
    opacity: 0.8;
}

.ssm-seat--selected {
    background: #8b1a1a !important;
    border-color: #6a1010 !important;
    color: #fff !important;
    transform: scale(1.15);
    box-shadow: 0 3px 12px rgba(139,26,26,0.45);
    position: relative;
    z-index: 1;
}

/* ── Map note ────────────────────────────────────────────────────────────── */
.ssm-note {
    font-size: 0.88rem;
    color: #777;
    margin-top: 8px;
    line-height: 1.6;
}

/* ── Progress bar ────────────────────────────────────────────────────────── */
.ssm-progress {
    margin-top: 24px;
    margin-bottom: 8px;
}
.ssm-progress-bar {
    height: 12px;
    background: #e8e0d4;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}
.ssm-progress-fill {
    height: 100%;
    background: linear-gradient(to right, #8b1a1a, #c9a84c);
    border-radius: 6px;
    transition: width 0.6s ease;
}
.ssm-progress p {
    font-size: 0.95rem;
    font-weight: 600;
    color: #555;
}

/* ── Basket ──────────────────────────────────────────────────────────────── */
.ssm-basket {
    background: #faf7f2;
    border: 2px solid #c9a84c;
    border-radius: 8px;
    padding: 20px 24px;
    margin-top: 24px;
}
.ssm-basket h4 {
    font-family: Georgia, serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.ssm-basket ul {
    list-style: none;
    margin-bottom: 16px;
}
.ssm-basket li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 600;
    padding: 8px 0;
    border-bottom: 1px solid #e8dfc8;
}
.ssm-basket li span:first-child { flex: 1; color: #1a1a1a; }
.ssm-basket li span:nth-child(2) { color: #8b1a1a; font-size: 1.05rem; }

.ssm-basket-remove {
    background: none;
    border: 2px solid #ccc;
    border-radius: 4px;
    color: #aaa;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 8px;
    line-height: 1;
    transition: all 0.15s;
}
.ssm-basket-remove:hover { border-color: #8b1a1a; color: #8b1a1a; }

.ssm-basket-total {
    font-family: Georgia, serif;
    font-weight: 700;
    font-size: 1.3rem;
    color: #8b1a1a;
    text-align: right;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 2px solid #e8dfc8;
}

/* ── Extra donation field ────────────────────────────────────────────────── */
.ssm-field--extra label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #444;
    display: block;
    margin-bottom: 8px;
}
.ssm-extra-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ssm-extra-prefix {
    font-size: 1.2rem;
    font-weight: 700;
    color: #555;
}
.ssm-extra-wrap input {
    width: 120px;
    padding: 10px 12px;
    border: 2px solid #ccc;
    border-radius: 6px;
    font-size: 1.1rem;
    font-family: inherit;
    color: #1a1a1a;
}
.ssm-extra-wrap input:focus {
    outline: none;
    border-color: #8b1a1a;
    box-shadow: 0 0 0 3px rgba(139,26,26,0.12);
}

/* ── Donor panel ─────────────────────────────────────────────────────────── */
.ssm-panel {
    background: #fff;
    border: 2px solid #8b1a1a;
    border-radius: 8px;
    padding: 28px 28px 32px;
    margin-top: 24px;
    position: relative;
}

.ssm-panel h3 {
    font-family: Georgia, serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: #8b1a1a;
    margin-bottom: 6px;
}
.ssm-panel-note {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* ── Form fields ─────────────────────────────────────────────────────────── */
.ssm-field {
    margin-bottom: 18px;
}
.ssm-field label {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 6px;
}
.ssm-field input[type="text"],
.ssm-field input[type="email"] {
    width: 100%;
    padding: 13px 14px;
    border: 2px solid #ccc;
    border-radius: 6px;
    font-size: 1.1rem;
    font-family: inherit;
    color: #1a1a1a;
    transition: border-color 0.15s;
}
.ssm-field input:focus {
    outline: none;
    border-color: #8b1a1a;
    box-shadow: 0 0 0 3px rgba(139,26,26,0.12);
}
.ssm-field small {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-top: 5px;
}

/* ── Checkbox ────────────────────────────────────────────────────────────── */
.ssm-field--checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    color: #1a1a1a;
}
.ssm-field--checkbox input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin-top: 1px;
    flex-shrink: 0;
    accent-color: #8b1a1a;
    cursor: pointer;
}
.ssm-field--checkbox small {
    font-size: 0.85rem;
    color: #888;
    margin-top: 5px;
    display: block;
    margin-left: 32px;
}

/* ── Panel error ─────────────────────────────────────────────────────────── */
.ssm-panel-error {
    background: #fef2f2;
    border: 2px solid #fca5a5;
    border-radius: 6px;
    padding: 12px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #991b1b;
    margin-bottom: 16px;
}

/* ── Primary button ──────────────────────────────────────────────────────── */
.ssm-btn-primary {
    display: block;
    width: 100%;
    padding: 16px 20px;
    background: #8b1a1a;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.15rem;
    font-weight: 700;
    font-family: Georgia, serif;
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
    letter-spacing: 0.02em;
}
.ssm-btn-primary:hover  { background: #a52020; }
.ssm-btn-primary:active { background: #6e1414; }
.ssm-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ── Close button ────────────────────────────────────────────────────────── */
.ssm-close {
    position: absolute;
    top: 16px;
    right: 18px;
    background: none;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 1.4rem;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 2px 8px;
    transition: all 0.15s;
}
.ssm-close:hover { color: #8b1a1a; border-color: #8b1a1a; }

/* ── Tooltip ─────────────────────────────────────────────────────────────── */
.ssm-tooltip {
    position: fixed;
    background: #1a1a1a;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 5px;
    pointer-events: none;
    z-index: 99999;
    white-space: normal;
    max-width: min(260px, calc(100vw - 16px));
    word-break: break-word;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    /* Force wrap to viewport width so children can't inflate it */
    #ssm-wrap {
        width: 100%;
        overflow-x: hidden;
    }
    /* Explicitly size to parent (= viewport) so the grid overflows and scrolls */
    .ssm-map-scroll {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .ssm-panel  { padding: 20px 16px 24px; }
    .ssm-basket { padding: 16px 16px; }
}
