/**
 * TobiDu Ticket System - Frontend Styles
 * Version: 1.0.0 (P2.7 - 2-Monatskalender)
 */

/* --- Wrapper --- */
.tobidu-booking-wrapper {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 20px !important;
    font-family: inherit;
    box-sizing: border-box;
}

.tobidu-heading {
    font-size: 1.5rem;
    margin-bottom: 24px;
}

/* --- Sichtbarkeit --- */
.is-hidden {
    display: none !important;
}

/* --- Felder --- */
.tobidu-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
}

.tobidu-field label,
.tobidu-cal-label {
    font-size: 0.9rem;
    font-weight: 600;
}

.tobidu-required {
    color: #b91c1c;
}

.tobidu-optional {
    font-size: 0.8rem;
    font-weight: 400;
    color: #888;
}

/* --- Eingaben --- */
.tobidu-persons-select,
.tobidu-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 1rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
}

.tobidu-input:focus,
.tobidu-persons-select:focus {
    outline: none;
    border-color: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

/* =========================================================================
   Kalender (2-Monatsansicht)
   ========================================================================= */

.tobidu-cal-months {
    display: flex;
    gap: 28px;
    margin-bottom: 8px;
}

@media (min-width: 769px) {
    .tobidu-cal-months {
        gap: 60px;
    }
}

/* --- Kalender Navigation --- */
.tobidu-cal-navhead {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.tobidu-cal-navhead .tobidu-cal-mhead {
    margin-bottom: 0;
}

.tobidu-cal-nav-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 4px 10px;
    font-size: 0.75rem;
    cursor: pointer;
    color: #777;
    font-family: inherit;
    line-height: 1;
}

.tobidu-cal-nav-btn:hover {
    background: rgba(245, 158, 11, 0.12);
    border-color: #f59e0b;
    color: #92400e;
}

.tobidu-cal-month {
    flex: 1 1 0;
    min-width: 0;
}

.tobidu-cal-mhead {
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 10px;
    color: #1a1a1a;
}

.tobidu-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    column-gap: 3px;
    row-gap: 3px;
}

@media (min-width: 769px) {
    .tobidu-cal-grid {
        column-gap: 10px;
        row-gap: 10px;
    }
}

.tobidu-cal-wday {
    font-size: 0.7rem;
    font-weight: 600;
    text-align: center;
    color: #999;
    padding: 4px 0 6px;
    user-select: none;
}

.tobidu-cal-empty {
    /* Platzhalter-Zelle */
}

.tobidu-cal-day {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 0;
    aspect-ratio: 1;
    max-height: 52px;
    font-size: 0.85rem;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #ccc;
    padding: 0;
    cursor: default;
    box-sizing: border-box;
    line-height: 1;
    font-family: inherit;
}

/* vergangene Tage */
.tobidu-cal-day.tobidu-cal-past {
    color: #d1d5db;
}

/* Tage ohne Slots */
.tobidu-cal-day.tobidu-cal-disabled {
    color: #d1d5db;
}

/* Heute – deutlich hervorgehoben */
.tobidu-cal-day.tobidu-cal-today {
    background: rgba(245, 158, 11, 0.18);
    border: 2px solid #f59e0b;
    color: #92400e;
    font-weight: 700;
}

/* buchbare Tage */
.tobidu-cal-day.tobidu-cal-active {
    background: #22c55e;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
}

.tobidu-cal-day.tobidu-cal-active:hover,
.tobidu-cal-day.tobidu-cal-active:focus {
    background: #16a34a;
    outline: none;
}

/* heute + buchbar: grüner Hintergrund mit gelbem Rahmen */
.tobidu-cal-day.tobidu-cal-today.tobidu-cal-active {
    border: 2px solid #f59e0b;
    background: #22c55e;
}

/* Sonderöffnungszeiten – Extra-Slot-Tage (amber statt grün) */
.tobidu-cal-day.tobidu-cal-active.tobidu-cal-day-extra {
    background: #fbbf24;
    color: #78350f;
}
.tobidu-cal-day.tobidu-cal-active.tobidu-cal-day-extra:hover,
.tobidu-cal-day.tobidu-cal-active.tobidu-cal-day-extra:focus {
    background: #f59e0b;
    color: #fff;
    outline: none;
}
/* Heute + Extra: amber Border bleibt, Hintergrund amber */
.tobidu-cal-day.tobidu-cal-today.tobidu-cal-active.tobidu-cal-day-extra {
    background: #fbbf24;
    border: 2px solid #d97706;
    color: #78350f;
}

/* ausgewählter Tag */
.tobidu-cal-day.tobidu-cal-selected {
    background: #f59e0b !important;
    color: #fff !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    border-color: transparent !important;
}

/* Mobile: nur 1 Monat */
@media (max-width: 768px) {
    .tobidu-booking-wrapper {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }

    .tobidu-cal-months {
        flex-direction: column;
        gap: 24px;
        padding-right: 5px;
    }

    .tobidu-cal-day {
        max-height: none;
        font-size: 0.8rem;
    }

    .tobidu-cal-legend {
        gap: 6px !important;
        flex-wrap: nowrap !important;
    }

    .tobidu-cal-legend-item {
        font-size: 0.6rem !important;
        gap: 3px !important;
        white-space: nowrap !important;
    }

    .tobidu-cal-legend-dot {
        width: 8px !important;
        height: 8px !important;
    }
}

/* --- Timeslot-Bereich --- */
.tobidu-timeslots {
    padding: 14px;
    margin-bottom: 20px;
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #888;
    min-height: 56px;
}

/* --- Kalender-Legende --- */
.tobidu-cal-legend {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 4px 0 16px;
}

.tobidu-cal-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: #666;
}

.tobidu-cal-legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: inline-block;
    flex-shrink: 0;
}

.tobidu-cal-legend-available   { background: #22c55e; }
.tobidu-cal-legend-unavailable { background: #e5e7eb; }
.tobidu-cal-legend-today       { background: rgba(245,158,11,0.18); border: 2px solid #f59e0b; box-sizing: border-box; }
.tobidu-cal-legend-extra       { background: #fbbf24; }

/* --- Weiter-Button Hinweis --- */
.tobidu-btn-hint {
    text-align: center;
    font-size: 0.8rem;
    color: #9ca3af;
    margin: 8px 0 0;
}

#tobidu-btn-weiter:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 1;
}

.tobidu-slots-label {
    margin: 0 0 12px;
    font-size: 0.9rem;
    color: #444;
}

.tobidu-slots-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tobidu-slot-btn {
    width: 100%;
    padding: 12px 16px;
    background: #fff;
    color: #222;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tobidu-slot-btn:hover {
    border-color: #f59e0b;
}

.tobidu-slot-btn.is-selected {
    border-color: #f59e0b;
    background: #fffbeb;
    font-weight: 700;
}

.tobidu-slot-btn.is-full {
    background: #f3f4f6;
    color: #9ca3af;
    border-color: #e5e7eb;
    cursor: not-allowed;
}

.tobidu-slot-badge {
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}
.tobidu-slot-badge-open     { color: #15803d; }
.tobidu-slot-badge-limited  { color: #d97706; }
.tobidu-slot-badge-critical { color: #b91c1c; }
.tobidu-slot-badge-full     { color: #9ca3af; }

/* --- Slot-Info-Wrapper (Timeslot + optionales Sub-Label) --- */
.tobidu-slot-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: left;
}

/* --- Sonderöffnungszeiten --- */
.tobidu-slot-extra-label {
    font-size: 0.68rem;
    color: #92400e;
    font-weight: 500;
    line-height: 1;
}
.tobidu-slot-btn.tobidu-slot-extra {
    border-color: #fbbf24;
    background: #fffbeb;
}
.tobidu-slot-btn.tobidu-slot-extra:hover {
    border-color: #f59e0b;
    background: #fef3c7;
}
.tobidu-slot-btn.tobidu-slot-extra.is-selected {
    border-color: #d97706;
    background: #fef3c7;
}
.tobidu-slot-btn.tobidu-slot-extra.is-full {
    background: #f3f4f6;
    border-color: #e5e7eb;
}

/* --- Zusammenfassung (Schritt 2) --- */
.tobidu-summary {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.tobidu-summary-list {
    margin: 0 0 12px;
    padding: 0;
}

.tobidu-summary-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.95rem;
    border-bottom: 1px solid #fde68a;
}

.tobidu-summary-row:last-child {
    border-bottom: none;
}

.tobidu-summary-row dt {
    font-weight: 600;
    color: #555;
}

.tobidu-summary-row dd {
    margin: 0;
    color: #222;
    font-weight: 700;
}

.tobidu-btn-back {
    background: none;
    border: none;
    color: #888;
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.tobidu-btn-back:hover {
    color: #444;
}

/* --- Primäre Buttons --- */
.tobidu-btn-primary {
    width: 100%;
    padding: 14px;
    background: #f59e0b;
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
}

.tobidu-btn-primary:hover:not(:disabled) {
    background: #d97706;
}

.tobidu-btn-primary:disabled {
    background: #d1d5db;
    cursor: not-allowed;
}

/* --- Zustandsklassen --- */
.tobidu-loading {
    color: #888;
    font-style: italic;
}

.tobidu-error {
    color: #b91c1c;
}

.tobidu-empty {
    color: #666;
}

/* --- Fehler beim Absenden (Schritt 2) --- */
.tobidu-submit-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #b91c1c;
    padding: 12px 16px;
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* --- Bestätigung (Schritt 3) --- */
.tobidu-confirmation {
    text-align: center;
    padding: 8px 0;
}

.tobidu-confirmation-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #15803d;
    margin: 0 0 24px;
}

.tobidu-confirmation-code-label {
    font-size: 0.9rem;
    color: #666;
    margin: 0 0 8px;
}

.tobidu-confirmation-code {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 4px;
    color: #222;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 16px;
    margin: 0 0 24px;
    word-break: break-all;
}

.tobidu-confirmation-note {
    font-size: 0.85rem;
    color: #888;
    margin-top: 16px;
}

/* --- QR-Code (Schritt 3) --- */
.tobidu-qr-code {
    margin: 0 auto 16px;
    max-width: 220px;
    line-height: 0;
}

.tobidu-qr-code svg,
.tobidu-qr-code img {
    width: 100%;
    height: auto;
    display: block;
}

.tobidu-qr-download {
    display: block;
    margin: 0 auto 12px;
    padding: 10px 20px;
    background: #fff;
    color: #d97706;
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid #f59e0b;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    max-width: 220px;
    box-sizing: border-box;
    font-family: inherit;
}

.tobidu-qr-download:hover {
    background: #fffbeb;
}

.tobidu-qr-hint {
    font-size: 0.8rem;
    color: #b45309;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 0 0 16px;
}

/* P3.6 – Hold-Countdown */
.tobidu-hold-countdown {
    font-size: 0.85rem;
    font-weight: 600;
    color: #15803d;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 8px 14px;
    margin: 8px 0 0;
}

.tobidu-hold-countdown-expired {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca;
    font-weight: 400;
}
