/* Custom Event Calendar Styles - Korrigiert: Weiße Datumsfelder */

/* Container und Grundlayout */
.custom-event-calendar-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.custom-event-calendar {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* FullCalendar Spacing-Fixes - Entfernt weißen Abstand zwischen Header und Daten */
.fc-scrollgrid {
    border-spacing: 0 !important;
    border-collapse: collapse !important;
}

.fc-col-header {
    border-bottom: 1px solid #ddd !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.fc-col-header-row {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.fc-col-header-cell {
    padding: 8px 4px !important;
    border-bottom: 1px solid #ddd !important;
    margin-bottom: 0 !important;
    background-color: #f8f9fa !important;
}

.fc-daygrid-body {
    margin-top: 0 !important;
    padding-top: 0 !important;
    border-top: none !important;
}

.fc-daygrid-day-frame {
    padding: 0 !important;
    margin: 0 !important;
}

.fc-scrollgrid-sync-inner {
    padding: 0 !important;
    margin: 0 !important;
}

.fc-scrollgrid-section {
    border-spacing: 0 !important;
}

.fc-scrollgrid-section-header,
.fc-scrollgrid-section-body {
    margin: 0 !important;
    padding: 0 !important;
}

.fc-scrollgrid table {
    border-spacing: 0 !important;
    border-collapse: collapse !important;
}

.fc-scrollgrid thead {
    margin-bottom: 0 !important;
}

.fc-scrollgrid tbody {
    margin-top: 0 !important;
    border-top: none !important;
}

/* FullCalendar Höhen-Kontrolle */
.fc {
    max-width: 100%;
    overflow: hidden;
}

.fc-view-harness {
    overflow: hidden !important;
    max-height: none !important;
}

.fc-scroller {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    max-height: calc(100vh - 200px);
}

/* KRITISCH: Weiße Datumsfelder mit stärksten Selektoren */
.fc-theme-standard .fc-scrollgrid,
.fc .fc-scrollgrid,
.fc-scrollgrid {
    background-color: #ffffff !important;
}

.fc-theme-standard .fc-daygrid-day,
.fc .fc-daygrid-day,
.fc-daygrid-day,
.fc-daygrid-day.fc-day,
.fc-day {
    background-color: #ffffff !important;
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
    min-height: 80px !important;
}

/* Spezifische Überschreibung für alle möglichen States */
.fc-daygrid-day.fc-day-past,
.fc-daygrid-day.fc-day-future,
.fc-daygrid-day.fc-day-other,
.fc-day-past,
.fc-day-future,
.fc-day-other {
    background-color: #ffffff !important;
    background: #ffffff !important;
}

/* Andere Monate dezent */
.fc-day-other {
    opacity: 0.4 !important;
}

/* Heute-Hervorhebung (sehr dezent) */
.fc-day-today,
.fc-daygrid-day.fc-day-today {
    background-color: #f0f8ff !important;
    background: #f0f8ff !important;
    border: 2px solid #007cba !important;
}

/* Datumsanzeige */
.fc-daygrid-day-number {
    padding: 4px 6px !important;
    font-weight: 500 !important;
    color: #333 !important;
}

.fc-day-today .fc-daygrid-day-number {
    color: #007cba !important;
    font-weight: 600 !important;
}

/* NEUTRALE BUTTONS - nicht blau! */
.fc-button,
.fc-button-group .fc-button {
    background-color: #ffffff !important;
    border: 1px solid #ccc !important;
    color: #333 !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
    border-radius: 4px !important;
    transition: all 0.2s ease !important;
}

.fc-button:hover,
.fc-button-group .fc-button:hover {
    background-color: #f8f9fa !important;
    border-color: #999 !important;
    color: #333 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.fc-button:focus,
.fc-button-group .fc-button:focus {
    outline: 2px solid #007cba !important;
    outline-offset: 2px !important;
}

/* Aktiver Button */
.fc-button-active,
.fc-button.fc-button-active {
    background-color: #007cba !important;
    border-color: #005a87 !important;
    color: white !important;
}

.fc-button-active:hover {
    background-color: #005a87 !important;
    border-color: #004566 !important;
}

/* Toolbar Styling */
.fc-toolbar {
    padding: 10px 0;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 5px;
    background-color: transparent;
}

.fc-toolbar-chunk {
    display: flex;
    align-items: center;
    gap: 5px;
}

.fc-toolbar-title {
    font-size: 1.5em !important;
    font-weight: 600 !important;
    color: #333 !important;
    margin: 0 !important;
}

/* Event-Styling */
.fc-event {
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 12px;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none !important;
    margin: 1px 2px !important;
}

.fc-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.fc-event-title {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading-Anzeige */
.cec-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 30px;
    background: rgba(255,255,255,0.95);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    z-index: 1000;
    text-align: center;
    min-width: 200px;
}

.cec-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.cec-loading-text {
    color: #666;
    font-size: 14px;
}

/* Fehler-Anzeige */
.cec-error {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    background: #fee;
    border: 1px solid #fcc;
    color: #c33;
    padding: 15px;
    border-radius: 4px;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Event Modal */
.cec-event-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    overflow-y: auto;
}

.cec-event-modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cec-event-modal-close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    background: none;
    border: none;
    padding: 5px;
    line-height: 1;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cec-event-modal-close:hover {
    color: #333;
    background: #f0f0f0;
}

.cec-event-detail h3 {
    margin-top: 0;
    color: #333;
    padding-right: 40px;
    line-height: 1.3;
}

.cec-event-meta {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #007cba;
}

.cec-event-meta p {
    margin: 8px 0;
    line-height: 1.5;
}

.cec-event-meta strong {
    color: #555;
}

.cec-event-content {
    margin: 15px 0;
    line-height: 1.6;
}

.cec-event-content h4 {
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
}

.cec-details-button {
    background: #007cba !important;
    color: white !important;
    padding: 12px 20px;
    text-decoration: none;
    border-radius: 6px;
    display: inline-block;
    margin-top: 15px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.cec-details-button:hover {
    background: #005a87 !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,124,186,0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    .fc-toolbar {
        flex-direction: column;
        gap: 10px;
        padding: 10px 5px;
    }
    
    .fc-toolbar-chunk {
        justify-content: center;
        width: 100%;
    }
    
    .fc-button-group .fc-button {
        font-size: 12px !important;
        padding: 6px 10px !important;
    }
    
    .fc-toolbar-title {
        font-size: 1.2em !important;
        text-align: center;
    }
    
    .fc-daygrid-day {
        min-height: 60px !important;
    }
    
    .cec-event-modal-content {
        margin: 1% auto;
        width: 95%;
        max-height: 95vh;
        padding: 15px;
    }
    
    .cec-event-detail h3 {
        font-size: 1.3em;
        padding-right: 35px;
    }
    
    .cec-event-meta {
        padding: 12px;
    }
    
    .custom-event-calendar-container {
        margin: 0 -10px;
    }
    
    .fc-scroller {
        max-height: calc(100vh - 300px);
    }
}

@media (max-width: 480px) {
    .fc-button-group .fc-button {
        font-size: 11px !important;
        padding: 5px 8px !important;
    }
    
    .fc-event {
        font-size: 11px;
        padding: 1px 3px;
    }
    
    .fc-daygrid-day {
        min-height: 50px !important;
    }
    
    .cec-event-modal-content {
        padding: 12px;
    }
    
    .cec-event-detail h3 {
        font-size: 1.1em;
    }
    
    .fc-scroller {
        max-height: calc(100vh - 250px);
    }
}

/* Accessibility Verbesserungen */
.fc-button:focus,
.cec-event-modal-close:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.fc-event:focus {
    outline: 2px solid #007cba;
    outline-offset: 1px;
}

/* Print Styles */
@media print {
    .cec-loading,
    .cec-error,
    .cec-event-modal {
        display: none !important;
    }
    
    .fc-toolbar {
        display: none !important;
    }
    
    .custom-event-calendar {
        overflow: visible !important;
    }
    
    .fc-scroller {
        overflow: visible !important;
        max-height: none !important;
    }
    
    .fc-daygrid-day {
        background-color: #ffffff !important;
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
    }
}
