/**
 * Kalender-Frontend Styles
 *
 * Datei: /www/css/calendar-frontend.css
 * Erstellt: 2026-01-09
 *
 * Styles für das öffentliche Kalender-Widget
 */

/* ============================================
   VARIABLEN & BASIS
   ============================================ */

.ff-cal-widget {
    --ff-cal-color: #003366;
}

/* ============================================
   MONATSBLATT
   ============================================ */

.ff-cal-month {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    overflow: hidden;
    background: white;
    max-width: 100%;
}

.ff-cal-header {
    background: var(--ff-cal-color, #003366);
    color: white;
    padding: 0.6rem 0.75rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
}

.ff-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #dee2e6;
}

.ff-cal-weekday {
    background: #f8f9fa;
    padding: 0.4rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #666;
}

.ff-cal-day {
    background: white;
    padding: 0.4rem;
    text-align: center;
    min-height: 2.4rem;
    position: relative;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

.ff-cal-day-num {
    display: block;
    line-height: 1.2;
}

.ff-cal-other-month {
    background: #fafafa;
}

.ff-cal-today {
    background: #fff3cd;
    font-weight: bold;
}

.ff-cal-today .ff-cal-day-num {
    color: #856404;
}

.ff-cal-has-event {
    cursor: pointer;
    transition: background 0.15s, outline 0.15s;
}

.ff-cal-has-event:hover,
.ff-cal-has-event:focus {
    background: #f0f4f8;
}

/* Tastatur-Fokus sichtbar machen */
.ff-cal-has-event:focus {
    outline: 2px solid var(--ff-cal-color, #003366);
    outline-offset: -2px;
    z-index: 1;
}

.ff-cal-has-event:focus:not(:focus-visible) {
    outline: none;
}

.ff-cal-has-event:focus-visible {
    outline: 2px solid var(--ff-cal-color, #003366);
    outline-offset: -2px;
}

.ff-cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ff-cal-color, #003366);
    margin-top: 2px;
}

.ff-cal-dots {
    display: flex;
    gap: 2px;
    margin-top: 2px;
}

.ff-cal-dots .ff-cal-dot {
    margin-top: 0;
}

/* ============================================
   TERMINLISTE
   ============================================ */

.ff-cal-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ff-cal-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.6rem 0.5rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.15s;
    margin: 0 -0.5rem;
    border-radius: 0.25rem;
}

.ff-cal-item:hover,
.ff-cal-item:focus {
    background: #f8f9fa;
}

/* Tastatur-Fokus für Terminliste */
.ff-cal-item:focus {
    outline: 2px solid var(--ff-cal-color, #003366);
    outline-offset: -2px;
}

.ff-cal-item:focus:not(:focus-visible) {
    outline: none;
}

.ff-cal-item:focus-visible {
    outline: 2px solid var(--ff-cal-color, #003366);
    outline-offset: -2px;
}

.ff-cal-item:last-child {
    border-bottom: none;
}

.ff-cal-date {
    font-weight: 600;
    white-space: nowrap;
    min-width: 75px;
}

.ff-cal-time {
    color: #666;
    white-space: nowrap;
    min-width: 45px;
}

.ff-cal-title {
    flex: 1;
}

.ff-cal-location {
    width: 100%;
    font-size: 0.85rem;
    color: #666;
    padding-left: 75px;
}

/* ============================================
   TOOLTIP
   ============================================ */

.ff-cal-tooltip {
    position: fixed;
    z-index: 1060;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    max-width: 300px;
    font-size: 0.875rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
}

.ff-cal-tooltip.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ff-cal-tooltip-header {
    background: var(--ff-cal-color, #003366);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.4rem 0.4rem 0 0;
    font-size: 0.8rem;
}

.ff-cal-tooltip-body {
    padding: 0.75rem;
}

.ff-cal-tooltip-event {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.ff-cal-tooltip-event + .ff-cal-tooltip-event {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid #eee;
}

.ff-cal-tooltip-time {
    color: #666;
    font-size: 0.8rem;
}

.ff-cal-tooltip-title {
    font-weight: 600;
}

.ff-cal-tooltip-location {
    color: #666;
    font-size: 0.8rem;
}

/* Tooltip-Pfeil */
.ff-cal-tooltip::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: white;
    border: 1px solid #dee2e6;
    border-right: none;
    border-bottom: none;
}

.ff-cal-tooltip.above::after {
    bottom: -6px;
    left: 50%;
    margin-left: -5px;
    transform: rotate(-135deg);
}

.ff-cal-tooltip.below::after {
    top: -6px;
    left: 50%;
    margin-left: -5px;
    transform: rotate(45deg);
    background: var(--ff-cal-color, #003366);
    border-color: var(--ff-cal-color, #003366);
}

/* ============================================
   ICS-DOWNLOAD
   ============================================ */

.ff-cal-subscribe {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

/* ============================================
   LEERER ZUSTAND
   ============================================ */

.ff-cal-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: #666;
}

.ff-cal-empty i {
    font-size: 2rem;
    opacity: 0.5;
    display: block;
    margin-bottom: 0.5rem;
}

/* ============================================
   FALLBACK (wenn keine Termine)
   ============================================ */

.ff-cal-fallback {
    /* Container für Fallback-Inhalt, enthält typischerweise Bootstrap-Cards */
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 576px) {
    .ff-cal-months.row {
        flex-direction: column;
    }

    .ff-cal-months .col-md-6 {
        width: 100%;
    }

    .ff-cal-day {
        padding: 0.3rem;
        min-height: 2rem;
        font-size: 0.8rem;
    }

    .ff-cal-weekday {
        font-size: 0.7rem;
        padding: 0.3rem;
    }

    .ff-cal-dot {
        width: 4px;
        height: 4px;
    }

    .ff-cal-item {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
    }

    .ff-cal-location {
        padding-left: 0;
    }

    .ff-cal-tooltip {
        left: 10px !important;
        right: 10px !important;
        max-width: none;
        width: auto;
    }

    .ff-cal-subscribe {
        flex-direction: column;
        align-items: flex-start !important;
    }
}
