/**
 * Frontend-Styles für Veranstaltungsbuchung.
 *
 * @package Veranstaltungsbuchung
 * @since   1.0.0
 */

/* === Shortcode Scroll-Anker === */
#vb-events {
    scroll-margin-top: 80px;
}

/* === Category Filter === */
.vb-category-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.vb-category-filter__item {
    display: inline-block;
    padding: 6px 16px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 0.9em;
    transition: background 0.2s, border-color 0.2s;
}

.vb-category-filter__item:hover {
    background: #f0f0f0;
    border-color: #bbb;
    color: #333;
}

.vb-category-filter__item--active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.vb-category-filter__item--active:hover {
    background: #005a87;
    border-color: #005a87;
    color: #fff;
}

/* === Events Grid === */
.vb-events-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: 24px;
    margin: 24px 0;
}

.vb-event-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: box-shadow 0.2s;
}

.vb-event-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.vb-event-card__image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.vb-event-card__body {
    padding: 16px;
}

.vb-event-card__title {
    margin: 0 0 8px 0;
    font-size: 1.2em;
    line-height: 1.3;
}

.vb-event-card__date,
.vb-event-card__location {
    margin: 4px 0;
    font-size: 0.9em;
    color: #555;
}

.vb-event-card__availability {
    margin: 12px 0;
}

.vb-event-card__button {
    display: inline-block;
    padding: 8px 20px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9em;
    transition: background 0.2s;
}

.vb-event-card__button:hover {
    background: #005a87;
    color: #fff;
}

/* === Badges === */
.vb-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 3px;
    font-size: 0.85em;
    font-weight: 600;
}

.vb-badge--open {
    background-color: #d4edda;
    color: #155724;
}

.vb-badge--full {
    background-color: #fff3cd;
    color: #856404;
}

/* === Detail === */
.vb-detail {
    max-width: 800px;
    margin: 0 auto;
}

.vb-detail__back {
    margin-bottom: 16px;
}

.vb-detail__back a {
    text-decoration: none;
    color: #0073aa;
}

.vb-detail__image img {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 16px;
}

.vb-detail__title {
    margin: 0 0 12px 0;
}

.vb-detail__meta {
    margin-bottom: 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
}

.vb-detail__meta p {
    margin: 6px 0;
}

.vb-detail__description {
    margin-bottom: 32px;
}

/* === Registration Form === */
.vb-registration-section {
    border-top: 2px solid #eee;
    padding-top: 24px;
    margin-top: 24px;
}

.vb-form__field {
    margin-bottom: 16px;
}

.vb-form__field label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 0.95em;
}

.vb-form__field select,
.vb-form__field input[type="text"],
.vb-form__field input[type="email"],
.vb-form__field input[type="tel"],
.vb-form__field input[type="number"],
.vb-form__field input[type="date"],
.vb-form__field textarea {
    width: 100%;
    max-width: 500px;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    box-sizing: border-box;
}

.vb-form__field textarea {
    resize: vertical;
}

.vb-form__checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-weight: normal !important;
    cursor: pointer;
}

.vb-form__checkbox-label input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}

.vb-form__radio-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.vb-form__radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal;
    cursor: pointer;
}

.vb-form__field--captcha {
    margin: 20px 0;
}

.vb-form__notice {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 0.95em;
}

.vb-form__notice--waiting {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.vb-form__notice--closed {
    background-color: #e2e3e5;
    color: #6c757d;
    border: 1px solid #d6d8db;
}

/* Attachment-Link */
.vb-detail__attachment {
    margin: 12px 0;
}

.vb-detail__attachment a {
    color: #0073aa;
    text-decoration: underline;
}

.vb-required {
    color: #d00;
}

.vb-button {
    display: inline-block;
    padding: 10px 28px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.2s;
}

.vb-button:hover {
    background: #005a87;
}

.vb-button:disabled {
    background: #999;
    cursor: not-allowed;
}

/* === Messages === */
.vb-form-messages:empty {
    display: none;
}

.vb-form-messages {
    padding: 14px 18px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 0.95em;
}

.vb-form-messages--success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.vb-form-messages--error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.vb-no-events {
    padding: 24px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* === Cancel Page === */
.vb-cancel-page {
    display: flex;
    justify-content: center;
    padding: 40px 16px;
}

.vb-cancel-card {
    max-width: 560px;
    width: 100%;
    padding: 32px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.vb-cancel-card h2 {
    margin: 0 0 16px 0;
}

.vb-cancel-card--success h2 {
    color: #155724;
}

.vb-cancel-card--error h2 {
    color: #721c24;
}

.vb-cancel-details {
    margin: 16px 0 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
}

.vb-cancel-details dt {
    font-weight: 600;
    margin-top: 8px;
}

.vb-cancel-details dt:first-child {
    margin-top: 0;
}

.vb-cancel-details dd {
    margin: 2px 0 0 0;
}

.vb-button--danger {
    background: #dc3545;
}

.vb-button--danger:hover {
    background: #c82333;
}

/* === Responsive Tablet (768px) === */
@media (max-width: 768px) {
    .vb-form__field select,
    .vb-form__field input[type="text"],
    .vb-form__field input[type="email"],
    .vb-form__field input[type="tel"],
    .vb-form__field input[type="number"],
    .vb-form__field input[type="date"],
    .vb-form__field textarea {
        max-width: 100%;
    }

    .vb-detail__meta {
        padding: 12px;
    }
}

/* === Responsive === */
@media (max-width: 600px) {
    .vb-events-grid {
        grid-template-columns: 1fr;
    }

    .vb-form__field select,
    .vb-form__field input[type="text"],
    .vb-form__field input[type="email"],
    .vb-form__field input[type="tel"],
    .vb-form__field input[type="number"],
    .vb-form__field input[type="date"],
    .vb-form__field textarea {
        max-width: 100%;
    }

    /* Kategorie-Filter kompakter */
    .vb-category-filter__item {
        padding: 5px 12px;
        font-size: 0.85em;
    }

    /* Cancel-Card: weniger Padding */
    .vb-cancel-card {
        padding: 20px 16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .vb-cancel-page {
        padding: 24px 0;
        align-items: flex-start;
    }
}

/* === Events List === */
.vb-events-list {
    display: flex;
    flex-direction: column;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin: 24px 0;
}

.vb-event-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #eee;
    background: #fff;
    transition: background 0.15s;
}

.vb-event-list-item:last-child {
    border-bottom: none;
}

.vb-event-list-item:hover {
    background: #f8f9fa;
}

.vb-event-list-item__thumb {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 4px;
    overflow: hidden;
}

.vb-event-list-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vb-event-list-item__date {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 64px;
    text-align: center;
    flex-shrink: 0;
}

.vb-event-list-item__day {
    font-weight: 700;
    font-size: 0.95em;
    line-height: 1.2;
}

.vb-event-list-item__time {
    font-size: 0.8em;
    color: #666;
}

.vb-event-list-item__info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.vb-event-list-item__title {
    font-size: 1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vb-event-list-item__location,
.vb-event-list-item__excerpt {
    font-size: 0.85em;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vb-event-list-item__status {
    flex-shrink: 0;
}

.vb-event-list-item__action {
    flex-shrink: 0; /* erweitert unten im Modal-Block */
}

/* === Card description === */
.vb-event-card__description {
    margin: 4px 0 8px;
    font-size: 0.88em;
    color: #555;
    line-height: 1.4;
}

/* === Badge: Anmeldebeginn (pending) === */
.vb-badge--pending {
    background-color: #cce5ff;
    color: #004085;
}

/* === Notice: Anmeldebeginn === */
.vb-form__notice--pending {
    background-color: #cce5ff;
    color: #004085;
    border: 1px solid #b8daff;
}

/* === Responsive List === */
@media (max-width: 600px) {
    .vb-event-list-item {
        flex-wrap: wrap;
    }

    .vb-event-list-item__info {
        flex-basis: 100%;
        order: -1;
    }

    .vb-event-list-item__thumb {
        display: none;
    }

    .vb-event-list-item__status,
    .vb-event-list-item__action {
        flex-basis: 100%;
        order: 1;
    }

    .vb-event-list-item__action .vb-button--register,
    .vb-event-list-item__action .vb-button--combined {
        width: 100%;
    }
}

/* ============================================================
   DIVI EDITION — Design-System-Anpassungen
   CSS Custom Properties mit Fallbacks auf Plugin-Defaults.
   Divi v4 nutzt --et_global_colors_*, v5 nutzt --et-global-color-*.
   Beide werden unterstützt.
   ============================================================ */

/* === Schrift-Vererbung von Divi === */
.vb-event-card__title,
.vb-event-card__date,
.vb-event-card__location,
.vb-event-card__description,
.vb-event-card__availability,
.vb-event-list-item__title,
.vb-event-list-item__location,
.vb-event-list-item__excerpt,
.vb-event-list-item__time,
.vb-detail__title,
.vb-detail__meta,
.vb-registration-section h3,
.vb-form__field label,
.vb-no-events,
.vb-category-filter__item {
    font-family: inherit;
}

/* === Button: Divi Primärfarbe === */
.vb-event-card__button,
.vb-button {
    background-color: var(--et-global-color-primary, var(--et_global_colors_body, #0073aa));
    border-color: var(--et-global-color-primary, var(--et_global_colors_body, #0073aa));
    font-family: inherit;
    letter-spacing: inherit;
}

.vb-event-card__button:hover,
.vb-button:hover {
    background-color: var(--et-global-color-secondary, #005a87);
    border-color: var(--et-global-color-secondary, #005a87);
    color: #fff;
}

/* === Links: Divi Primärfarbe === */
.vb-detail__back a,
.vb-detail__attachment a {
    color: var(--et-global-color-primary, var(--et_global_colors_body, #0073aa));
}

/* === Kategorie-Filter: Divi Primärfarbe === */
.vb-category-filter__item--active {
    background: var(--et-global-color-primary, #0073aa);
    border-color: var(--et-global-color-primary, #0073aa);
}

.vb-category-filter__item--active:hover {
    background: var(--et-global-color-secondary, #005a87);
    border-color: var(--et-global-color-secondary, #005a87);
}

/* === Modal === */
.vb-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.vb-modal-overlay[aria-hidden="true"] {
    display: none;
}

.vb-modal {
    background: #fff;
    border-radius: 8px;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

.vb-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

.vb-modal__title {
    margin: 0;
    font-size: 1.15em;
    line-height: 1.3;
}

.vb-modal__close {
    background: none;
    border: none;
    font-size: 1.5em;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    color: #666;
    border-radius: 4px;
    flex-shrink: 0;
}

.vb-modal__close:hover {
    background: #f0f0f0;
    color: #333;
}

.vb-modal__body {
    padding: 20px;
    overflow-y: auto;
}

.vb-modal-event-header {
    margin-bottom: 16px;
}

.vb-modal-event-date,
.vb-modal-event-location {
    margin: 4px 0;
    font-size: 0.95em;
    color: #444;
}

.vb-modal-event-description {
    margin-top: 12px;
    font-size: 0.9em;
    color: #555;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
}

.vb-modal-divider {
    border: none;
    border-top: 2px solid #eee;
    margin: 16px 0;
}

.vb-modal-spinner {
    text-align: center;
    padding: 32px;
    color: #666;
    font-size: 0.95em;
}

/* === Button-Varianten für Übersicht === */
.vb-button--secondary {
    display: inline-block;
    padding: 8px 20px;
    background: #fff;
    color: #0073aa;
    border: 1px solid #0073aa;
    border-radius: 4px;
    font-size: 0.9em;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}

.vb-button--secondary:hover {
    background: #0073aa;
    color: #fff;
}

.vb-button--register {
    display: inline-block;
    padding: 8px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background 0.2s;
}

.vb-button--register:hover {
    background: #005a87;
}

.vb-button--register:disabled {
    background: #ccc;
    color: #888;
    cursor: not-allowed;
}

/* === Touch-Target-Mindestgröße (WCAG 2.5.5) === */
.vb-button,
.vb-button--secondary,
.vb-button--register {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* === Modal: Header mit Detail-Link === */
.vb-modal__header-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.vb-modal__detail-link {
    font-size: 0.8em;
    color: #0073aa;
    text-decoration: none;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vb-modal__detail-link:hover {
    text-decoration: underline;
}

/* === Unified Button === */
.vb-button--combined {
    width: 100%;
}

.vb-event-card__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 12px;
}

.vb-event-list-item__action {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    flex-shrink: 0;
}

/* === Responsive Modal === */
@media (max-width: 600px) {
    .vb-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .vb-modal {
        border-radius: 12px 12px 0 0;
        max-height: 95vh;
        width: 100%;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .vb-modal__header {
        padding: 12px 16px;
    }

    .vb-modal__body {
        padding: 16px;
    }
}
