/**
 * StUPD Sprechstunden - Frontend Styles
 * Designed to match the UPD theme styling
 * Accessibility: WCAG 2.2 AA / BITV 2.0 compliant
 */

/* Variables - inherit from theme where possible */
:root {
    --stupd-dark-green: var(--c-dunkelgruen-100, #003a40);
    --stupd-light-green: var(--c-hellgruen-100, #9bc43a);
    --stupd-light-green-10: var(--c-dunkelgruen-10, rgba(0, 58, 64, 0.1));
    --stupd-bg-light: #f8f9fa;
    --stupd-border-radius: 5px;
    --stupd-focus-color: var(--c-dunkelgruen-100, #003a40);
}

/* Screen reader only content - visually hidden but accessible */
.screen-reader-text,
.stupd-sr-status {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus styles - ensure visible focus indicators (WCAG 2.4.7) */
.stupd-sprechstunden-wrapper :focus {
    outline: 2px solid var(--stupd-focus-color);
    outline-offset: 2px;
}

.stupd-sprechstunden-wrapper :focus:not(:focus-visible) {
    outline: none;
}

.stupd-sprechstunden-wrapper :focus-visible {
    outline: 2px solid var(--stupd-focus-color);
    outline-offset: 2px;
}

/* Wrapper */
.stupd-sprechstunden-wrapper {
    width: 100%;
}

/* Filter Tabs */
.stupd-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 2rem;
}

.stupd-filter-btn {
    background: transparent;
    border: none;
    padding: 10px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
    color: var(--stupd-dark-green);
    transition: all 0.2s ease;
}

.stupd-filter-btn:hover {
    background: var(--stupd-light-green-10);
}

.stupd-filter-btn.active {
    background: var(--stupd-dark-green);
    color: #fff;
}

/* Month Header */
.stupd-month-header {
    margin: 1.5rem 0 1rem;
    font-weight: 700;
}

.stupd-month-header:first-child {
    margin-top: 0;
}

/* Event Item - matches mockup structure */
.stupd-event-item {
    display: flex;
    align-items: stretch;
    background: #fff;
    border-radius: var(--stupd-border-radius);
    overflow: hidden;
    margin-bottom: 1rem;
}

/* Date Box */
.stupd-event-date {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    padding: 1.5rem;
    background: var(--stupd-light-green-10);
}

.stupd-date-day {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--stupd-dark-green);
}

/* Event Content */
.stupd-event-content {
    flex: 1;
    padding: 1rem 1.5rem;
}

.stupd-event-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 0.5rem;
}

.stupd-event-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--stupd-dark-green);
}

.stupd-event-location-badge {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    background: var(--stupd-light-green);
    color: var(--stupd-dark-green);
    white-space: nowrap;
}

/* Event details - definition list for semantic structure */
.stupd-event-details {
    margin: 0;
    padding: 0;
}

.stupd-event-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin: 0 0 0.25rem;
    color: var(--stupd-dark-green);
}

.stupd-event-detail dt {
    font-weight: 700;
    margin: 0;
}

.stupd-event-detail dd {
    margin: 0;
}

/* Load More Button */
.stupd-load-more-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.stupd-load-more-btn {
    /* Inherits WordPress button styles */
    cursor: pointer;
}

.stupd-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.stupd-load-more-btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.stupd-load-more-btn.loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: stupd-spin 0.8s linear infinite;
    vertical-align: middle;
}

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

/* Empty State */
.stupd-sprechstunden-empty {
    padding: 3rem;
    text-align: center;
    background: var(--stupd-bg-light);
    border-radius: var(--stupd-border-radius);
    color: #666;
}

/* Fade animation for filtering */
.stupd-events-container {
    transition: opacity 0.2s ease;
}

.stupd-events-container.loading {
    opacity: 0.5;
}

/* Hide filtered items with animation */
.stupd-event-item.hidden {
    display: none;
}

/* Responsive */
@media screen and (max-width: 600px) {
    .stupd-filter-tabs {
        gap: 5px;
    }

    .stupd-filter-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .stupd-event-item {
        flex-direction: column;
    }

    .stupd-event-date {
        min-width: auto;
        padding: 1rem;
        justify-content: flex-start;
    }

    .stupd-date-day {
        font-size: 1.2rem;
    }

    .stupd-event-header {
        flex-direction: column;
    }
}

/* WordPress Block Editor Preview */
.wp-block-stupd-sprechstunden .stupd-filter-btn {
    pointer-events: none;
}

/* Reduced motion preference (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
    .stupd-filter-btn,
    .stupd-events-container,
    .stupd-load-more-btn {
        transition: none;
    }

    .stupd-load-more-btn.loading::before {
        animation: none;
        border-style: dotted;
    }

    @keyframes stupd-spin {
        to { transform: none; }
    }
}

/* High contrast mode support */
@media (forced-colors: active) {
    .stupd-filter-btn.active {
        border: 2px solid currentColor;
    }

    .stupd-event-item {
        border: 1px solid currentColor;
    }

    .stupd-event-location-badge {
        border: 1px solid currentColor;
    }
}
