/* Nextcloud Events Calendar - Styles */

/* Hinweis auf den begrenzten Anzeigebereich */
.nc-events-date-range-notice {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 1em;
    padding: 0.5em 0.75em;
    background: #f8f8f8;
    border-left: 3px solid #bbb;
    border-radius: 3px;
}

.nc-events-grid,
.nc-events-list {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* FullCalendar Grid */
#nc-fullcalendar {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    overflow: hidden;
}

.fc {
    font-size: 14px;
}

@media (prefers-color-scheme: light) {
    .fc-daygrid-event:hover {
        color: black !important;
    }
}

@media (prefers-color-scheme: dark) {
    .fc-daygrid-event:hover {
        color: white !important;
    }
}

.fc-daygrid-event {
    border-radius: 6px;
    padding: 2px 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none !important;
    background: var(--nc-event-bg, linear-gradient(135deg, #667eea 0%, #764ba2 100%));
    box-sizing: border-box;
    max-width: 100%;
    color: #f8fafc !important;
    text-shadow: 0 1px 1px rgba(0,0,0,0.85);
}

.fc-daygrid-event .fc-event-main,
.fc-daygrid-event .fc-event-main-frame,
.fc-daygrid-event .fc-event-title {
    max-width: 100%;
    color: inherit;
}

.fc-daygrid-event .fc-event-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nc-fc-event-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
}

.nc-fc-event-prefix {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    opacity: 0.95;
    flex: 0 0 auto;
}

.nc-fc-event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex: 0 0 8px;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(0,0,0,0.2);
}


@media(prefers-color-scheme: dark) {
    .nc-fc-event-title {
        color: white !important;   
    }
}

.nc-fc-event-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fc-daygrid-event:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

/* Wenn FullCalendar beim Aktivzustand auf hellen Hintergrund wechselt, Text dunkel halten. */
.fc-daygrid-event:focus,
.fc-daygrid-event:focus-visible,
.fc-daygrid-event:active,
.fc-daygrid-event.fc-event-selected {
    color: #0f172a !important;
    text-shadow: none;
}

/* Event Liste */
.nc-events-list {
    display: grid;
    gap: 16px;
}

.nc-event-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nc-event-item:hover {
    background: #fff;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.nc-event-item h3 {
    margin: 0 0 8px 0;
    font-size: 1.2em;
    color: #1e293b;
}

.nc-event-item h3 a {
    text-decoration: none;
    color: inherit;
}

.nc-event-color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid rgba(0,0,0,0.15);
}

.nc-event-item p {
    margin: 0 0 4px 0;
    color: #64748b;
    font-size: 0.95em;
}

/* AJAX Overlay (Sideload DIV) */
.nc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.nc-event-details {
    background: white;
    color: #1e293b;
    max-width: 600px;
    max-height: 80vh;
    width: 90%;
    height: 80%;
    border-radius: 16px;
    padding: 32px;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
    animation: ncSlideIn 0.3s ease-out;
}

.nc-event-details-close {
    position: absolute;
    top: 8px;
    right: 8px;
    border: 0;
    background: transparent;
    color: #475569;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
}

.nc-event-details-close:hover {
    color: #0f172a;
}

.nc-event-details-close:focus-visible {
    outline: 2px solid #0a66c2;
    outline-offset: 2px;
}

@keyframes ncSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.nc-event-details-inner {
    background: #fff;
    max-width: 100%;
}

.nc-event-details h2 {
    color: #1e293b;
    margin-bottom: 20px;
    font-size: 1.6em;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 12px;
}

.nc-event-details p {
    font-size: 1.1em;
    margin-bottom: 16px;
    line-height: 1.5;
}

.nc-event-meta-table-wrap {
    overflow-x: auto;
    margin-bottom: 16px;
}

.nc-event-meta-table {
    width: 100%;
    min-width: 420px;
    border-collapse: collapse;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.nc-event-meta-table th,
.nc-event-meta-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
    line-height: 1.5;
}

.nc-event-meta-table tr:last-child th,
.nc-event-meta-table tr:last-child td {
    border-bottom: 0;
}

.nc-event-meta-table th {
    width: 110px;
    text-align: left;
    color: #334155;
    background: #f8fafc;
    font-weight: 600;
}

.nc-event-meta-table td {
    color: #1e293b;
}

.nc-event-meta-compact {
    display: none;
}

.nc-event-meta-compact strong {
    color: #334155;
    display: inline-block;
    width: 80px;
}

.nc-event-description {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 16px;
    margin-top: 20px;
    line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
    .nc-events-grid,
    .nc-events-list {
        padding: 12px;
    }
    
    .nc-event-details {
        width: 95%;
        height: 90%;
        padding: 24px;
    }
    
    .fc {
        font-size: 12px;
    }
}

@media (max-width: 560px) {
    .nc-event-meta-table-wrap {
        display: none;
    }

    .nc-event-meta-compact {
        display: block;
    }
}

/* Mobile Alternative: auf Touch-Geraeten bis zu 2 Zeilen Eventtitel anzeigen. */
@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .fc-daygrid-event .fc-event-title {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        line-height: 1.2;
        max-height: 2.4em;
    }
}

/* Loading */
.nc-events-loading {
    text-align: center;
    padding: 40px;
    color: #64748b;
}

/* Tagespanel fuer +N Eintraege */
.nc-day-events-panel {
    background: #fff;
    width: min(680px, 96vw);
    max-height: 78vh;
    border-radius: 14px;
    box-shadow: 0 20px 55px rgba(0,0,0,0.32);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nc-day-events-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
}

.nc-day-events-panel-header h3 {
    margin: 0;
    font-size: 16px;
    color: #1e293b;
    text-transform: capitalize;
}

.nc-day-events-close {
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #475569;
}

.nc-day-events-panel-body {
    overflow-y: auto;
    padding: 12px;
    display: grid;
    gap: 8px;
}

.nc-day-events-panel-item {
    border: 1px solid #d8e3ef;
    background: #f8fbff;
    border-radius: 10px;
    text-align: left;
    padding: 10px 12px;
    cursor: pointer;
}

.nc-day-events-panel-item:hover {
    background: #edf5ff;
}

.nc-day-events-panel-time {
    font-size: 12px;
    color: #5b7088;
    margin-bottom: 4px;
}

.nc-day-events-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.nc-day-events-panel-location {
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}

.nc-day-events-empty {
    margin: 4px;
    color: #64748b;
}

@media (max-width: 768px), (hover: none) and (pointer: coarse) {
    .nc-day-events-panel {
        width: 96vw;
        max-height: 85vh;
    }
}

/* Dark Mode: Grid-Ansicht konsistent einfärben */
@media (prefers-color-scheme: dark) {
    #nc-fullcalendar {
        background: #0f172a;
        box-shadow: 0 6px 24px rgba(0,0,0,0.45);
    }

    .nc-events-date-range-notice {
        color: #cbd5e1;
        background: #1e293b;
        border-left-color: #475569;
    }

    .fc {
        color: #e2e8f0;
    }

    .fc .fc-toolbar-title,
    .fc .fc-col-header-cell-cushion,
    .fc .fc-daygrid-day-number,
    .fc .fc-list-day-text,
    .fc .fc-list-day-side-text,
    .fc .fc-daygrid-more-link {
        color: #e2e8f0;
    }

    .fc .fc-scrollgrid,
    .fc-theme-standard td,
    .fc-theme-standard th {
        border-color: #334155;
    }

    .fc .fc-daygrid-day,
    .fc .fc-day-other,
    .fc .fc-daygrid-day-frame {
        background: #0f172a;
    }

    .fc .fc-day-today {
        background: rgba(59, 130, 246, 0.18) !important;
    }

    .fc .fc-button {
        background: #1e293b;
        border-color: #334155;
        color: #e2e8f0;
    }

    .fc .fc-button:hover,
    .fc .fc-button:focus,
    .fc .fc-button:active,
    .fc .fc-button.fc-button-active {
        background: #334155;
        border-color: #475569;
        color: #f8fafc;
    }

    .fc-daygrid-event:focus,
    .fc-daygrid-event:focus-visible,
    .fc-daygrid-event:active,
    .fc-daygrid-event.fc-event-selected {
        color: #f8fafc !important;
        text-shadow: 0 1px 1px rgba(0,0,0,0.85);
    }

    .fc-daygrid-event:focus .fc-event-main,
    .fc-daygrid-event:focus-visible .fc-event-main,
    .fc-daygrid-event:active .fc-event-main,
    .fc-daygrid-event.fc-event-selected .fc-event-main,
    .fc-daygrid-event:focus .fc-event-main-frame,
    .fc-daygrid-event:focus-visible .fc-event-main-frame,
    .fc-daygrid-event:active .fc-event-main-frame,
    .fc-daygrid-event.fc-event-selected .fc-event-main-frame,
    .fc-daygrid-event:focus .fc-event-title,
    .fc-daygrid-event:focus-visible .fc-event-title,
    .fc-daygrid-event:active .fc-event-title,
    .fc-daygrid-event.fc-event-selected .fc-event-title,
    .fc-daygrid-event:focus .fc-event-time,
    .fc-daygrid-event:focus-visible .fc-event-time,
    .fc-daygrid-event:active .fc-event-time,
    .fc-daygrid-event.fc-event-selected .fc-event-time,
    .fc-daygrid-event:focus .nc-fc-event-title,
    .fc-daygrid-event:focus-visible .nc-fc-event-title,
    .fc-daygrid-event:active .nc-fc-event-title,
    .fc-daygrid-event.fc-event-selected .nc-fc-event-title,
    .fc-daygrid-event:focus .nc-fc-event-prefix,
    .fc-daygrid-event:focus-visible .nc-fc-event-prefix,
    .fc-daygrid-event:active .nc-fc-event-prefix,
    .fc-daygrid-event.fc-event-selected .nc-fc-event-prefix {
        color: #f8fafc !important;
        text-shadow: 0 1px 1px rgba(0,0,0,0.85);
    }

    #nc-fullcalendar .fc .fc-daygrid-event:focus *,
    #nc-fullcalendar .fc .fc-daygrid-event:focus-visible *,
    #nc-fullcalendar .fc .fc-daygrid-event:active *,
    #nc-fullcalendar .fc .fc-daygrid-event.fc-event-selected * {
        color: #f8fafc !important;
    }

    .nc-day-events-panel {
        background: #0f172a;
        color: #e2e8f0;
    }

    .nc-day-events-panel-header {
        border-bottom-color: #334155;
    }

    .nc-day-events-panel-header h3,
    .nc-day-events-close,
    .nc-day-events-panel-time,
    .nc-day-events-panel-title,
    .nc-day-events-panel-location,
    .nc-day-events-empty {
        color: #e2e8f0;
    }

    .nc-day-events-panel-item {
        border-color: #334155;
        background: #1e293b;
    }

    .nc-day-events-panel-item:hover {
        background: #243447;
    }
}
