/**
 * assets/css/public.css – CSS för publik onlinebokning
 * ID: PUBLIC_CSS
 *
 * Design: Folkets Hus Degerfors – djupröd + guld, varm kol-header.
 * Tillgänglig: fokusmarkeringar, kontrastförhållanden, mönster på platser.
 */

/* === FÄRGVARIABLER === */
:root {
    --fh-red:       #C8102E;
    --fh-red-dark:  #A50D24;
    --fh-velvet:    #9B1C28;
    --fh-velvet-mid:#C8102E;
    --fh-accent:    #FFFFFF;
    --fh-accent-soft:#F5EDE0;
    --fh-coal:      #1C1C1C;
    --fh-bg:        #F8F5F0;
    --fh-warm-bg:   #EDE8E3;
    --fh-text:      #222222;
}

/* === TYPOGRAFI & GRUNDLÄGGANDE === */
/* Mörkare muted-text för godkänd AA-kontrast */
.text-muted { color: #5a6473 !important; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--fh-bg);
    color: var(--fh-text);
}

/* === HERO HEADER === */
.hero-header {
    background: var(--fh-velvet);
    color: white;
    padding: 2.5rem 0;
    margin-bottom: 2rem;
    border-bottom: 4px solid var(--fh-accent);
}

.hero-header h1 {
    color: #fff;
    font-weight: 800;
}

.hero-header .lead {
    color: #fff;
    font-weight: 500;
}

/* === EVENEMANGSKORT === */
.event-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s;
}

.event-card:hover {
    box-shadow: 0 4px 20px rgba(155,29,32,0.15);
}

.event-card .card-title {
    color: var(--fh-text);
    font-weight: 700;
}

.show-item {
    border: 1px solid #e9ecef;
    transition: background 0.15s;
}

.show-item:hover {
    background: var(--fh-warm-bg) !important;
}

/* === INSTRUKTIONER SALONGSVYN === */
.seatmap-instructions {
    background: var(--fh-warm-bg) !important;
    border-color: #ddd0c8 !important;
    padding: 0.65rem 1rem;
    border-radius: 8px;
}
.seatmap-instructions kbd {
    background: #2b2b2b;
    color: #fff;
    border: 1px solid #444;
    border-radius: 3px;
    padding: 0.1em 0.45em;
    font-size: 0.85em;
    box-shadow: 0 1px 1px rgba(0,0,0,0.2);
}

/* === BOKNINGSSIDA: SALONGSVYN === */
.booking-seatmap {
    position: relative;
    overflow: hidden;
    padding: 0;
    border: 1px solid #ddd0c8;
    border-radius: 12px;
    background: #f0ebe6;
    /* Tillåt normal scroll/pan – pinch-zoom hanteras av JS */
    touch-action: pan-x pan-y;
}

.seatmap-viewport {
    overflow: auto;
    max-height: 70vh;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
}
.seatmap-viewport:active {
    cursor: grabbing;
}

#seatmap-container {
    overflow: hidden;
}

.seatmap-scaler {
    transform-origin: 0 0;
    transition: transform 0.2s ease;
    display: inline-block;
    min-width: fit-content;
}

/* Zoomkontroller */
.seatmap-zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(255,255,255,0.92);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.seatmap-zoom-controls button {
    width: 44px;
    height: 44px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    transition: background 0.15s;
    line-height: 1;
    padding: 0;
}
.seatmap-zoom-controls button:hover {
    background: #f0f0f0;
}
.seatmap-zoom-controls .zoom-level {
    font-size: 0.65rem;
    text-align: center;
    color: #666;
    padding: 2px 0;
    user-select: none;
}

.seatmap-grid {
    display: inline-grid;
    gap: 5px;
    padding: 1rem;
    background: #f0ebe6;
    border-radius: 12px;
}

/* Platsceller */
.seat-cell {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.15s ease;
    position: relative;
    user-select: none;
}

/* Fokus: tydlig markering för tangentbordsnavigering (WCAG 2.4.7) */
.seat-cell:focus-visible {
    outline: 3px solid var(--fh-red);
    outline-offset: 2px;
    z-index: 10;
}
.seatmap-zoom-controls button:focus-visible {
    outline: 3px solid var(--fh-red);
    outline-offset: 2px;
}

/* Skip-länk (WCAG 2.4.1) */
.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 100;
    padding: 0.5rem 1rem;
    background: var(--fh-red);
    color: white;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    font-weight: 600;
}
.skip-link:focus {
    left: 0;
}

/* Ledig: grön bakgrund (WCAG 1.4.3 – text #1b5e20 på #a5d6a7 ≈ 4.6:1) */
.seat-available {
    background: #a5d6a7;
    border-color: #2e7d32;
    color: #1b5e20;
}
.seat-available:hover {
    background: #2e7d32;
    color: white;
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Vald: röd med bock */
.seat-selected {
    background: var(--fh-red);
    border-color: var(--fh-red-dark);
    color: white;
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(200,16,46,0.4);
}
.seat-selected::after {
    content: '✓';
    position: absolute;
    font-size: 0.9rem;
    font-weight: 900;
}

/* Reserverad: randig (WCAG 1.4.3 – text #5d4037 på #ffe082 ≈ 5.2:1, kant #c43e00 ≈ 3.5:1) */
.seat-reserved {
    background: repeating-linear-gradient(
        45deg,
        #ffe082,
        #ffe082 3px,
        #ffb300 3px,
        #ffb300 6px
    );
    border-color: #c43e00;
    color: #5d4037;
    cursor: not-allowed;
}

/* Såld: korsad */
.seat-sold {
    background: #ef9a9a;
    border-color: #c62828;
    color: #b71c1c;
    cursor: not-allowed;
}
.seat-sold::before {
    content: '×';
    font-size: 1.2rem;
    font-weight: 900;
    line-height: 1;
}

/* Blockerad: prickad kant */
.seat-blocked {
    background: #bdbdbd;
    border: 2px dashed #616161;
    color: #424242;
    cursor: not-allowed;
}

/* Rullstolsplats – visas som blockerad online (se api/seats.php kassa_only-logik) */
/* Klassen används om man explicit vill styla rullstolsplatser i framtida utbyggnad */
/* Rullstolsplats (WCAG 1.4.11 – kant #0056b3 på #a8d4ff ≈ 3.2:1) */
.seat-wheelchair {
    background: #a8d4ff;
    border-color: #0056b3;
    color: #003d80;
    cursor: not-allowed;
}

/* Tom (gång) */
.seat-empty {
    background: transparent;
    border: none;
    cursor: default;
}

/* Scen */
.stage-bar {
    background: var(--fh-velvet);
    color: var(--fh-accent);
    text-align: center;
    padding: 0.6rem 2rem;
    border-radius: 0 0 12px 12px;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Legend */
.seat-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding: 0.5rem 0;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}
.legend-swatch {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid;
    flex-shrink: 0;
}

/* === BOKNINGSSAMMANFATTNING === */
.booking-summary {
    background: #fff;
    border: 2px solid var(--fh-red);
    border-radius: 12px;
    padding: 1.5rem;
    position: sticky;
    top: 1rem;
}

.booking-summary h4 {
    color: var(--fh-velvet);
    font-weight: 700;
    border-bottom: 2px solid var(--fh-accent);
    padding-bottom: 0.5rem;
}

/* === RESERVATIONSTIMER === */
.reservation-timer {
    background: #e8f5e9;
    border: 2px solid #2e7d32;
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
}
.reservation-timer.warning {
    background: #fff3cd;
    border-color: #f57f17;
    animation: pulse 1s infinite;
}
.reservation-timer.expired {
    background: #ffebee;
    border-color: #c62828;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* === BOOTSTRAP KNAPP-OVERRIDE === */
.btn-primary {
    background-color: var(--fh-velvet-mid);
    border-color: var(--fh-velvet-mid);
    color: #fff;
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active,
.btn-primary.active,
.btn-primary:first-child:active {
    background-color: var(--fh-velvet);
    border-color: var(--fh-velvet);
    color: #fff;
}
.btn-primary:focus-visible,
.btn-check:focus + .btn-primary {
    background-color: var(--fh-velvet);
    border-color: var(--fh-velvet);
    box-shadow: 0 0 0 0.25rem rgba(92,15,24,0.4);
}
.btn-outline-primary {
    color: var(--fh-velvet-mid);
    border-color: var(--fh-velvet-mid);
}
.btn-outline-primary:hover {
    background-color: var(--fh-velvet-mid);
    border-color: var(--fh-velvet-mid);
    color: #fff;
}

/* === BETALNINGSKNAPP === */
.btn-pay {
    background: var(--fh-velvet-mid);
    border-color: var(--fh-velvet-mid);
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.75rem 2rem;
    border-radius: 8px;
    transition: all 0.2s;
}
.btn-pay:hover {
    background: var(--fh-velvet);
    border-color: var(--fh-velvet);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(61,10,16,0.4);
}

/* === BILJETT-SIDA (ticket.php) === */
.ticket-display {
    max-width: 500px;
    margin: 2rem auto;
    background: white;
    border: 3px solid var(--fh-coal);
    border-radius: 16px;
    overflow: hidden;
}

.ticket-header {
    background: var(--fh-velvet);
    color: white;
    padding: 1.5rem;
    text-align: center;
    border-bottom: 3px solid var(--fh-accent);
}

.ticket-body {
    padding: 1.5rem;
}

.ticket-qr {
    text-align: center;
    padding: 1rem;
    border-top: 2px dashed #dee2e6;
}

.ticket-receipt {
    padding: 0 1.5rem 1rem;
    border-top: 1px solid #dee2e6;
}

.ticket-footer {
    background: var(--fh-warm-bg);
    border-top: 1px solid #dee2e6;
    padding: 0.6rem 1.5rem;
    font-size: 0.7rem;
    color: #666;
}

.ticket-qr canvas,
.ticket-qr img {
    max-width: 200px;
    margin: 0 auto;
}

/* === PRINT === */
@media print {
    .hero-header, footer, .no-print { display: none !important; }
    .booking-summary { position: static !important; }
    .ticket-display { border: 2px solid #000 !important; max-width: 100% !important; }
}

/* === RESPONSIVT === */
@media (max-width: 768px) {
    .seat-cell {
        width: 30px;
        height: 30px;
        font-size: 0.6rem;
        border-radius: 5px;
    }
    .seatmap-grid {
        gap: 3px;
    }
    .hero-header {
        padding: 1.5rem 0;
    }
    .hero-header h1 {
        font-size: 1.8rem;
    }
}

/* === ALERT-INFO – FH-anpassad ===
   Bootstraps standardblå alert-info krockar med den varma kräm/sammetröda
   paletten. Övertoner här ger en mjuk beige bakgrund med sammetröd accent-kant
   som smälter in i sidans bakgrund. */
.alert-info {
    background-color: var(--fh-accent-soft);
    border-color: #E3D6C3;
    border-left: 4px solid var(--fh-velvet);
    color: var(--fh-text);
}
.alert-info a { color: var(--fh-velvet); }
.alert-info .bi,
.alert-info i.bi-info-circle,
.alert-info i.bi-info-circle-fill {
    color: var(--fh-velvet);
}
