/* Events Widgets CSS - v2.2.0 - Multi-day Support + Responsive */

/* Elementor Widget Wrapper - WICHTIG für volle Breite! */
.elementor-widget-events_calendar {
    width: 100% !important;
    max-width: none !important;
}

/* Filter Navigation */
.events-month-filter-new {
    position: relative;
    margin-bottom: 30px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.events-month-filter-new button.nav-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    background-color: #fff;
    border: 1px solid var(--e-global-color-a41517f);
    border-radius: 0;
    color: var(--e-global-color-text);
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
}

.events-month-filter-new button.nav-arrow:hover {
    background-color: var(--e-global-color-primary);
    border-color: var(--e-global-color-primary);
}

.events-month-filter-new button.nav-arrow svg {
    flex-shrink: 0;
    stroke: var(--e-global-color-text);
}

.events-month-filter-new button.nav-arrow:disabled,
.events-month-filter-new button.nav-arrow.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.events-month-filter-new .filter-trigger-button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background-color: #fff;
    border: 1px solid var(--e-global-color-a41517f);
    border-radius: 0;
    color: var(--e-global-color-text);
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
    min-width: 0;
}

.filter-trigger-button:hover {
    background-color: var(--e-global-color-primary);
    border-color: var(--e-global-color-primary);
}

.filter-trigger-button svg {
    flex-shrink: 0;
    stroke: var(--e-global-color-text);
}

/* Filter Popup */
.filter-calendar-popup {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 20px;
    z-index: 1000;
    min-width: 320px;
    display: none;
}

.filter-calendar-popup.show {
    display: block;
}

.popup-header {
    margin-bottom: 15px;
}

.year-selector {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 1px solid var(--e-global-color-a41517f);
    border-radius: 0;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    background-color: #fff;
    color: var(--e-global-color-text);
    cursor: pointer;
    transition: all 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.year-selector:hover {
    border-color: var(--e-global-color-primary);
    background-color: #f9f9f9;
}

.year-selector:focus {
    outline: none;
    border-color: var(--e-global-color-primary);
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.months-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.filter-calendar-popup .month-button {
    padding: 12px 8px;
    border: 1px solid var(--e-global-color-a41517f);
    border-radius: 0;
    color: var(--e-global-color-text);
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-calendar-popup .month-button:hover {
    background-color: #f0f0f0;
    border-color: var(--e-global-color-text);
}

.filter-calendar-popup .month-button.active {
    background-color: var(--e-global-color-primary);
    color: var(--e-global-color-text);
    border-color: var(--e-global-color-primary);
}

.filter-calendar-popup .month-button.past-month {
    color: #999;
    opacity: 0.6;
    cursor: pointer;
}

.filter-calendar-popup .month-button.past-month:hover {
    background-color: #f0f0f0;
    border-color: #ddd;
    opacity: 0.8;
}

.filter-calendar-popup .month-button.past-month.active {
    opacity: 1;
    background-color: var(--e-global-color-primary);
    color: var(--e-global-color-text);
    border-color: var(--e-global-color-primary);
}

/* Kalender */
.events-calendar-widget {
    width: 100%;
    max-width: none !important;
}

.events-calendar {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    max-width: none !important;
    box-sizing: border-box;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: #f5f5f5;
    border-bottom: 2px solid #ddd;
    width: 100%;
    box-sizing: border-box;
}

.calendar-header .weekday {
    padding: 15px 10px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    color: #333;
    border-right: 1px solid #e0e0e0;
    box-sizing: border-box;
}

/* Standard: Zeige lange Namen, verstecke kurze */
.calendar-header .weekday-long {
    display: block;
}

.calendar-header .weekday-short {
    display: none;
}

.calendar-header .weekday:last-child {
    border-right: none;
}

.calendar-body {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: auto;
    width: 100%;
    box-sizing: border-box;
}

.calendar-day {
    min-height: 140px;
    padding: 8px;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    position: relative;
    box-sizing: border-box;
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

.calendar-day.other-month {
    background-color: #fafafa;
}

.calendar-day.other-month .day-number {
    color: #999;
}

.calendar-day.today {
    background-color: #fff9e6;
}

.calendar-day.today .day-number {
    background-color: #ffd700;
    color: #333;
    font-weight: bold;
}

.day-number {
    display: inline-block;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 4px;
    margin-bottom: 5px;
    position: relative;
    z-index: 2;
}

.day-events {
    position: relative;
    flex: 1;
    margin-top: 5px;
    min-height: 30px;
}

/* Multi-day event items */
.event-item {
    position: absolute;
    background-color: #e3f2fd;
    padding: 6px 8px;
    border-radius: 3px;
    font-size: 12px;
    line-height: 1.4;
    color: #1976d2;
    border-left: 3px solid #1976d2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    height: 26px;
    box-sizing: border-box;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 1;
}

.event-item:hover {
    background-color: #bbdefb;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Highlighted events (cross-widget hover) */
.event-item.event-highlighted {
    background-color: #bbdefb;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.event-list-item.event-highlighted {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    background-color: #f0f7ff;
}

/* Muted events (außerhalb des aktuellen Monats) - jetzt besser sichtbar */
.event-item.event-muted {
    opacity: 0.65;
    background-color: #e8f4f8;
    color: #5a9fb8;
    border-left-color: #7db3c9;
}

.event-item.event-muted:hover {
    opacity: 0.85;
    background-color: #d0e8f0;
}

/* Events die aus dem Vormonat fortgesetzt werden - kein linker Rand */
.event-item.event-continued-from-prev {
    border-left: none;
    padding-left: 8px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Events die in den Folgemonat fortgesetzt werden - kein rechter Rand nötig, aber Hinweis */
.event-item.event-continues-into-next {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Gemutete Events die fortgesetzt werden - kein linker Rand */
.event-item.event-muted.event-continues-into-next {
    border-left: none;
    padding-left: 8px;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* Placeholder für mehrtägige Events */
.event-placeholder {
    height: 26px;
    opacity: 0;
    pointer-events: none;
    margin-bottom: 4px;
}

/* Liste */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.event-list-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    align-items: center;
    padding: 10px 20px;
    background-color: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: box-shadow 0.3s, transform 0.3s;
}

.event-list-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.event-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.event-title {
    font-family: "Fjalla One", Sans-serif;
    font-size: 21px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    color: var(--e-global-color-text);
}

.event-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 400;
    line-height: 1em;
    letter-spacing: 0.4px;
}

.event-location {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #888;
    font-size: 13px;
}

.event-date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.badge-days {
    font-family: "Fjalla One", Sans-serif;
    font-size: 30px;
    font-weight: 400;
    line-height: 1em;
}

.badge-month {
    font-size: 16px;
}

.no-events {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

/* Loading State */
.events-calendar-widget.loading,
.events-list-widget.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Responsive */
@media (max-width: 768px) {
    /* Wochentage: Zeige nur kurze Version */
    .calendar-header .weekday-long {
        display: none;
    }
    
    .calendar-header .weekday-short {
        display: block;
    }
    
    .calendar-header .weekday {
        padding: 10px 4px;
        font-size: 12px;
    }
    
    .calendar-day {
        min-height: 85px;
        padding: 4px 2px;
    }
    
    .day-number {
        font-size: 11px;
        padding: 2px 4px;
        margin-bottom: 2px;
    }
    
    .event-item {
        font-size: 7px;
        padding: 2px 3px;
        height: 14px;
        border-left-width: 2px;
        box-sizing: border-box;
        line-height: 1.4;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .event-placeholder {
        height: 18px;
    }
    
    .event-list-item {
        grid-template-columns: 1fr;
        padding: 12px 16px;
    }
    
    /* Verstecke das Date-Badge auf Mobile */
    .event-date-badge {
        display: none;
    }
    
    .event-title {
        font-size: 18px;
    }
    
    .event-meta {
        font-size: 14px;
    }
    
    .events-month-filter-new {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .events-month-filter-new button.nav-arrow {
        width: 40px;
        height: 40px;
    }
    
    .filter-trigger-button {
        font-size: 16px;
        padding: 10px 16px;
    }
    
    .filter-calendar-popup {
        left: 0;
        right: 0;
        transform: none;
        min-width: auto;
        margin: 0 10px;
    }
    
    /* Tooltip auf Mobile anpassen */
    .event-tooltip {
        min-width: 200px;
        max-width: 280px;
        font-size: 12px;
        padding: 10px 12px;
    }
    
    .tooltip-title {
        font-size: 14px;
        margin-bottom: 8px;
        padding-bottom: 6px;
    }
    
    .tooltip-row {
        font-size: 11px;
        gap: 8px;
    }
    
    .tooltip-icon {
        width: 12px;
        height: 12px;
    }
}

/* Event Tooltips */
.event-tooltip {
    position: fixed;
    background-color: #2c3e50;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    min-width: 250px;
    max-width: 350px;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease-out;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tooltip-title {
    font-family: "Fjalla One", Sans-serif;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.tooltip-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tooltip-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #ecf0f1;
}

.tooltip-icon {
    flex-shrink: 0;
    stroke: #3498db;
}

.tooltip-row svg {
    margin-top: 1px;
}

.tooltip-arrow {
    position: absolute;
    bottom: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #2c3e50;
    left: 50%;
    transform: translateX(-50%);
}