/* Action Arena Booking Widget Styles */
:root {
    --primary: #2D5452;
    --primary-dark: #1f3a38;
    --secondary: #86C7C7;
    --accent: #AACEC2;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4f5b5a;
    --gray-700: #4f5b5a;
    --gray-800: #2D5452;
    --gray-900: #1f3a38;
    --radius: 12px;
    --shadow: 0 4px 24px rgba(45,84,82,0.12);
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: transparent;
    color: var(--gray-800);
    line-height: 1.5;
}

.booking-widget {
    max-width: 520px;
    margin: 0 auto;
    padding: 16px;
    width: 100%;
}

.widget-header {
    text-align: center;
    margin-bottom: 24px;
}

.widget-header h2 {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.widget-header .location-name {
    font-size: 14px;
    color: var(--gray-500);
    margin-top: 4px;
}

.steps {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
}

.step {
    flex: 1;
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    transition: var(--transition);
}

.step.active { background: linear-gradient(135deg, var(--primary), var(--secondary)); }
.step.completed { background: var(--success); }

.calendar-container {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.calendar-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
}

.calendar-nav {
    display: flex;
    gap: 8px;
}

.calendar-nav button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--gray-200);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--gray-600);
    transition: var(--transition);
}

.calendar-nav button:hover { background: var(--gray-100); border-color: var(--gray-300); }

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 8px 12px;
    background: var(--gray-50);
    width: 100%;
    box-sizing: border-box;
}

.calendar-weekdays span {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
}

.calendar-days {
    display: grid;
    /* minmax(0, 1fr) statt 1fr verhindert, dass Zell-Inhalte die Spur aufblaehen */
    /* und so die 7. Spalte bei engen Viewports aus dem Container laufen lassen. */
    grid-template-columns: repeat(7, minmax(0, 1fr));
    padding: 8px 12px 12px;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
}

.calendar-day {
    aspect-ratio: 1;
    /* Zelle darf schmaler werden als ihr min-content, damit 7 Spalten immer passen. */
    min-width: 0;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    background: transparent;
    color: var(--gray-700);
}

.calendar-day:hover:not(.disabled):not(.empty) { background: var(--gray-100); }
.calendar-day.today { border: 2px solid var(--primary); }
.calendar-day.selected { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; }
.calendar-day.disabled { color: var(--gray-300); cursor: not-allowed; }
.calendar-day.empty { cursor: default; }
.calendar-day.closed { color: var(--gray-300); cursor: not-allowed; text-decoration: line-through; }
.calendar-day.loading { color: var(--gray-300); cursor: default; }

/* Section (Steps) */
.booking-section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.booking-section.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 16px;
}

/* Ticket Cards */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ticket-card {
    background: #fff;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
}

.ticket-card:hover { border-color: var(--primary); box-shadow: 0 2px 12px rgba(45, 84, 82, 0.15); }
.ticket-card.selected { background: #a7fffab0; }
.ticket-card:active { transform: scale(0.98); }

.ticket-card .ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.ticket-card .ticket-name { font-weight: 600; font-size: 15px; color: var(--gray-800); display: inline-flex; align-items: center; gap: 6px; }
.ticket-card .ticket-icon { font-size: 18px; line-height: 1; }
.ticket-card .ticket-price { font-weight: 700; font-size: 18px; color: var(--primary); }
.ticket-card .ticket-time { font-size: 13px; color: var(--gray-500); }
.ticket-card .ticket-desc { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

.ticket-card.happy-hour { border-color: #fbbf24; }
.ticket-card.happy-hour .ticket-price { color: #d97706; }
.ticket-card.happy-hour.selected { border-color: #d97706; background: rgba(251,191,36,0.05); }

/* Quantity */
.quantity-section {
    background: #fff;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    padding: 20px;
    margin-top: 16px;
}

.quantity-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.quantity-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--gray-200);
    background: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--gray-600);
}

.quantity-btn:hover { border-color: var(--primary); color: var(--primary); }
.quantity-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.quantity-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
    min-width: 48px;
    text-align: center;
}

.quantity-label {
    text-align: center;
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 8px;
}

/* Price summary */
.price-summary {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 16px;
    margin-top: 16px;
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: var(--gray-600);
}

.price-row.total {
    border-top: 2px solid var(--gray-200);
    margin-top: 8px;
    padding-top: 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
    background: #fff;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 84, 82, 0.15);
}

.form-group input.error { border-color: var(--danger); }
.form-group .error-text { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* Buttons */
.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
}

.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(45, 84, 82, 0.3); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    margin-top: 8px;
}

.btn-secondary:hover { background: var(--gray-200); }

.btn-row {
    display: flex;
    gap: 8px;
    margin-top: 20px;
}

.btn-row .btn { flex: 1; }
.btn-row .btn-back { flex: 0 0 auto; width: auto; padding: 14px 20px; }

/* Messages */
.message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
}

.message.info { background: #e0f2fe; color: #0369a1; }
.message.warning { background: #fef3c7; color: #92400e; }
.message.error { background: #fee2e2; color: #dc2626; }
.message.success { background: #d1fae5; color: #065f46; }

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

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

.loading-text { color: var(--gray-500); font-size: 14px; }

/* Closed message */
.closed-message {
    text-align: center;
    padding: 32px 16px;
}

.closed-message .icon { font-size: 48px; margin-bottom: 12px; }
.closed-message h3 { font-size: 18px; color: var(--gray-700); margin-bottom: 8px; }
.closed-message p { font-size: 14px; color: var(--gray-500); }

/* Sold Out */
.ticket-card.sold-out { opacity: 0.5; cursor: not-allowed; border-color: var(--gray-200); }
.ticket-card.sold-out .ticket-price { color: var(--danger); font-size: 14px; }
.ticket-card.sold-out:hover { border-color: var(--gray-200); box-shadow: none; }

.ticket-remaining {
    font-size: 12px;
    color: var(--warning);
    font-weight: 600;
    margin-top: 6px;
}

/* Addons */
.addons-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.addon-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 12px 14px;
}

.addon-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}

.addon-name { font-weight: 600; font-size: 14px; color: var(--gray-800); }
.addon-desc { font-size: 12px; color: var(--gray-400); }
.addon-price { font-size: 13px; color: var(--primary); font-weight: 600; }

.addon-qty {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-800);
}

.quantity-btn.small {
    width: 30px;
    height: 30px;
    font-size: 16px;
    border-radius: 50%;
    border: 1px solid var(--gray-200);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--gray-600);
}

.quantity-btn.small:hover { border-color: var(--primary); color: var(--primary); }
.quantity-btn.small:disabled { opacity: 0.3; cursor: not-allowed; }

/* Discount */
.discount-section {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
}

.discount-section .section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin: 0 0 10px 0;
}

.discount-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
    width: 100%;
}

.discount-row input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 14px;
    height: 44px;
    line-height: 44px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    box-sizing: border-box;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.discount-row input::placeholder {
    text-transform: none;
    letter-spacing: normal;
    color: var(--gray-400, #9ca3af);
}

.discount-row input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(45, 84, 82, 0.15);
}

/* Reset der globalen .btn-Defaults innerhalb der Discount-Row */
.discount-row .btn,
.discount-row .btn-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    flex: 0 0 auto;
    margin: 0;
    height: 44px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    white-space: nowrap;
    background: var(--primary);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.discount-row .btn:hover,
.discount-row .btn-sm:hover {
    background: var(--secondary);
    transform: none;
    box-shadow: none;
}

.discount-row .btn:disabled,
.discount-row .btn-sm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#discount-result {
    min-height: 18px;
}

#discount-result .text-success,
#discount-result .text-error {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* .btn-sm bleibt als generische Klasse fuer andere Stellen */
.btn-sm {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    white-space: nowrap;
}

.text-success { color: var(--success); font-size: 13px; font-weight: 600; }
.text-error { color: var(--danger); font-size: 13px; }

.price-row.discount { color: var(--success); }

/* Inline Quantity in Summary */
.summary-qty-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.summary-qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid var(--gray-300);
    background: #fff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    color: var(--gray-600);
    padding: 0;
}

.summary-qty-btn:hover { border-color: var(--primary); color: var(--primary); }
.summary-qty-btn:active { transform: scale(0.9); }
.summary-qty-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.summary-qty-value {
    font-weight: 700;
    font-size: 15px;
    min-width: 20px;
    text-align: center;
}

/* ===== Responsive / Mobile ===== */

/* Touch targets minimum 44px */
@media (hover: none) and (pointer: coarse) {
    .calendar-day { min-height: 44px; font-size: 15px; }
    .quantity-btn { width: 48px; height: 48px; font-size: 22px; }
    .quantity-btn.small { width: 36px; height: 36px; font-size: 18px; }
    .ticket-card { padding: 16px; }
    .ticket-card:hover { box-shadow: none; }
    .btn { padding: 16px; font-size: 17px; min-height: 52px; }
    .btn-sm { padding: 12px 18px; font-size: 14px; min-height: 44px; }
    .form-group input { padding: 14px 16px; font-size: 16px; }
    /* Discount: behalte fixe Hoehe, vergroessere nur die Schrift fuer iOS-Autozoom-Schutz */
    .discount-row input { font-size: 16px; }
    .discount-row .btn,
    .discount-row .btn-sm { font-size: 15px; min-height: 0; }
}

@media (max-width: 520px) {
    .booking-widget { padding: 12px; }
    .widget-header { margin-bottom: 16px; }
    .widget-header h2 { font-size: 18px; }
    .widget-header .location-name { font-size: 13px; }
    .steps { margin-bottom: 16px; }

    /* Calendar compact */
    .calendar-header { padding: 12px; }
    .calendar-header h3 { font-size: 14px; }
    .calendar-weekdays { padding: 6px 8px; }
    .calendar-weekdays span { font-size: 11px; }
    .calendar-days { padding: 6px 8px 10px; gap: 2px; }
    .calendar-day { font-size: 13px; border-radius: 6px; }

    /* Tickets */
    .ticket-card { padding: 14px; }
    .ticket-card .ticket-name { font-size: 14px; }
    .ticket-card .ticket-price { font-size: 16px; }
    .ticket-card .ticket-time { font-size: 12px; }

    /* Quantity */
    .quantity-section { padding: 16px; }
    .quantity-value { font-size: 24px; }
    .quantity-control { gap: 16px; }

    /* Price */
    .price-summary { padding: 12px; }
    .price-row { font-size: 13px; }
    .price-row.total { font-size: 16px; }

    /* Form */
    .form-group { margin-bottom: 14px; }
    .section-title { font-size: 15px; }

    /* Buttons */
    .btn-row { gap: 6px; }
    .btn-row .btn-back { padding: 14px 16px; }

    /* Addons */
    .addon-item { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
    .addon-info { min-width: 0; }
    .addon-name { font-size: 13px; }
    .addon-price { font-size: 12px; }

    /* Discount */
    .discount-section { padding: 12px; }
    .discount-row { flex-direction: column; gap: 8px; align-items: stretch; }
    .discount-row input { width: 100%; }
    .discount-row .btn,
    .discount-row .btn-sm { width: 100%; }
}

@media (max-width: 360px) {
    .booking-widget { padding: 8px; }
    .widget-header h2 { font-size: 16px; }
    /* Bei sehr schmalen Displays min-height aufheben, sonst kollidiert es */
    /* mit aspect-ratio und kann die 7. Spalte aus dem Container draengen. */
    .calendar-day { font-size: 12px; min-height: 0; }
    .ticket-card .ticket-header { flex-direction: column; align-items: flex-start; gap: 4px; }
    .price-row { font-size: 12px; }
    .price-row.total { font-size: 14px; }
    .quantity-value { font-size: 22px; }
    .btn { font-size: 15px; padding: 14px; }
}
