/* =====================================================
   MFM Calendar — Frontend Styles
   ===================================================== */

.mfmcal-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #1e293b;
    max-width: 1100px;
    margin: 0 auto;
}

/* ── Toolbar ── */
.mfmcal-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0; gap: 12px; flex-wrap: wrap;
}
.mfmcal-nav { display: flex; align-items: center; gap: 8px; }
.mfmcal-nav-btn {
    background: #f1f5f9; border: none; border-radius: 8px;
    width: 36px; height: 36px; font-size: 20px; cursor: pointer;
    color: #475569; transition: background 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.mfmcal-nav-btn:hover { background: #e2e8f0; color: #1e293b; }
.mfmcal-title { font-size: 20px; font-weight: 700; color: #0f172a; margin: 0; min-width: 200px; text-align: center; }
.mfmcal-today-btn {
    background: #0f172a; color: #fff; border: none; border-radius: 8px;
    padding: 7px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background 0.15s; margin-left: 4px;
}
.mfmcal-today-btn:hover { background: #1e293b; }

.mfmcal-views { display: flex; gap: 4px; background: #f1f5f9; padding: 4px; border-radius: 10px; }
.mfmcal-view-btn {
    padding: 6px 16px; border: none; border-radius: 7px; font-size: 13px; font-weight: 600;
    cursor: pointer; background: transparent; color: #64748b; transition: all 0.15s;
}
.mfmcal-view-btn:hover { background: #e2e8f0; color: #1e293b; }
.mfmcal-view-active { background: #fff !important; color: #0f172a !important; box-shadow: 0 1px 4px rgba(0,0,0,0.1); }

/* ── Grid wrap ── */
.mfmcal-grid-wrap { border-radius: 12px; overflow: hidden; border: 1px solid #e2e8f0; background: #fff; }
.mfmcal-loading { text-align: center; padding: 60px; color: #94a3b8; font-size: 15px; }

/* ── Month view ── */
.mfmcal-month-grid { display: grid; grid-template-columns: repeat(7,1fr); }
.mfmcal-dow-header {
    text-align: center; padding: 10px 4px; font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em; color: #64748b;
    background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
.mfmcal-day {
    min-height: 100px; padding: 6px; border-right: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9; position: relative;
}
.mfmcal-day:nth-child(7n) { border-right: none; }
.mfmcal-day-other { background: #fafafa; }
.mfmcal-day-today { background: #eff6ff; }
.mfmcal-day-num {
    font-size: 13px; font-weight: 600; color: #475569;
    width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; margin-bottom: 4px;
}
.mfmcal-day-today .mfmcal-day-num { background: #3b82f6; color: #fff; }
.mfmcal-day-other .mfmcal-day-num { color: #cbd5e1; }

/* ── Event pill ── */
.mfmcal-event-pill {
    display: block; border-radius: 4px; padding: 2px 7px; margin-bottom: 2px;
    font-size: 11px; font-weight: 600; color: #fff; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: opacity 0.15s; line-height: 1.5;
}
.mfmcal-event-pill:hover { opacity: 0.85; }

/* ── Week view ── */
.mfmcal-week-grid { display: grid; grid-template-columns: 60px repeat(7,1fr); }
.mfmcal-week-time-col { border-right: 1px solid #e2e8f0; }
.mfmcal-week-header {
    text-align: center; padding: 10px 4px; font-size: 12px; font-weight: 700;
    color: #64748b; background: #f8fafc; border-bottom: 2px solid #e2e8f0;
    border-right: 1px solid #f1f5f9;
}
.mfmcal-week-header.mfmcal-today-col { color: #3b82f6; background: #eff6ff; }
.mfmcal-week-hour-label {
    height: 50px; display: flex; align-items: flex-start; justify-content: flex-end;
    padding: 4px 8px 0; font-size: 10px; color: #94a3b8; font-weight: 600;
    border-bottom: 1px solid #f1f5f9;
}
.mfmcal-week-cell {
    height: 50px; border-right: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9;
    position: relative;
}
.mfmcal-week-cell.mfmcal-today-col { background: #fafeff; }
.mfmcal-week-event {
    position: absolute; left: 2px; right: 2px; border-radius: 5px;
    padding: 2px 5px; font-size: 10px; font-weight: 600; color: #fff;
    cursor: pointer; overflow: hidden; z-index: 1;
    transition: opacity 0.15s;
}
.mfmcal-week-event:hover { opacity: 0.85; }

/* ── Year view ── */
.mfmcal-year-grid {
    display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; padding: 20px;
}
@media (max-width: 768px) { .mfmcal-year-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 480px) { .mfmcal-year-grid { grid-template-columns: 1fr; } }

.mfmcal-mini-month { }
.mfmcal-mini-month-title {
    text-align: center; font-size: 13px; font-weight: 700; color: #1e293b;
    padding-bottom: 8px; margin-bottom: 6px; border-bottom: 1px solid #f1f5f9;
}
.mfmcal-mini-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 1px; }
.mfmcal-mini-dow { text-align: center; font-size: 9px; color: #94a3b8; font-weight: 700; padding: 2px 0; }
.mfmcal-mini-day {
    text-align: center; font-size: 11px; color: #475569; padding: 3px 2px;
    border-radius: 4px; cursor: default; position: relative;
}
.mfmcal-mini-day.mfmcal-has-event { font-weight: 700; cursor: pointer; }
.mfmcal-mini-day.mfmcal-today { background: #3b82f6; color: #fff; border-radius: 50%; }
.mfmcal-mini-day.mfmcal-other-month { color: #e2e8f0; }
.mfmcal-mini-dot {
    position: absolute; bottom: 1px; left: 50%; transform: translateX(-50%);
    width: 4px; height: 4px; border-radius: 50%;
}

/* ── Modal ── */
.mfmcal-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 99995; display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.mfmcal-modal {
    background: #fff; border-radius: 16px; max-width: 520px; width: 100%;
    max-height: 90vh; overflow-y: auto; position: relative;
    box-shadow: 0 24px 80px rgba(0,0,0,0.2);
}
.mfmcal-modal-close {
    position: absolute; top: 14px; right: 14px; background: rgba(255,255,255,0.9);
    border: none; border-radius: 50%; width: 30px; height: 30px;
    font-size: 14px; cursor: pointer; z-index: 2;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15); transition: background 0.15s;
}
.mfmcal-modal-close:hover { background: #f1f5f9; }
.mfmcal-modal-color-bar { height: 8px; border-radius: 16px 16px 0 0; }
.mfmcal-modal-body { padding: 24px; }
.mfmcal-modal-title { font-size: 22px; font-weight: 800; color: #0f172a; margin: 0 0 16px; }

.mfmcal-modal-meta { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.mfmcal-meta-row { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #475569; flex-wrap: wrap; }
.mfmcal-meta-icon { font-size: 18px; flex-shrink: 0; }
.mfmcal-maps-btn {
    background: #eff6ff; color: #3b82f6; text-decoration: none;
    padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600;
    transition: background 0.15s; margin-left: 4px;
}
.mfmcal-maps-btn:hover { background: #dbeafe; }

.mfmcal-modal-desc { font-size: 14px; color: #475569; line-height: 1.6; margin-bottom: 24px; white-space: pre-wrap; }

/* ── RSVP section ── */
.mfmcal-rsvp-section { background: #f8fafc; border-radius: 12px; padding: 20px; }
.mfmcal-rsvp-section h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; color: #0f172a; }
.mfmcal-rsvp-form { display: flex; flex-direction: column; gap: 10px; }
.mfmcal-rsvp-form input {
    padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 8px;
    font-size: 14px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
    background: #fff;
}
.mfmcal-rsvp-form input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.12); }
.mfmcal-rsvp-btn {
    background: #3b82f6; color: #fff; border: none; border-radius: 10px;
    padding: 12px; font-size: 14px; font-weight: 700; cursor: pointer;
    transition: background 0.15s;
}
.mfmcal-rsvp-btn:hover { background: #2563eb; }
.mfmcal-rsvp-success {
    background: #dcfce7; color: #166534; border-radius: 8px;
    padding: 12px 16px; font-size: 14px; font-weight: 600;
}
.mfmcal-rsvp-error {
    background: #fef2f2; color: #dc2626; border-radius: 8px;
    padding: 10px 16px; font-size: 13px;
}


/* ── Mobile Optimierung ── */
@media (max-width: 980px) {
    .mfmcal-wrap {
        max-width: 100%;
        padding: 0 12px;
        box-sizing: border-box;
    }

    .mfmcal-toolbar {
        gap: 10px;
        align-items: stretch;
    }

    .mfmcal-nav,
    .mfmcal-views {
        width: 100%;
    }

    .mfmcal-nav {
        display: grid;
        grid-template-columns: 42px 1fr 42px;
        grid-template-areas:
            "prev title next"
            "today today today";
        gap: 8px;
        align-items: center;
    }

    #mfmcal-prev { grid-area: prev; }
    #mfmcal-next { grid-area: next; }
    #mfmcal-title { grid-area: title; }
    #mfmcal-today { grid-area: today; }

    .mfmcal-nav-btn,
    .mfmcal-today-btn {
        width: 100%;
        min-height: 42px;
        margin-left: 0;
    }

    .mfmcal-title {
        min-width: 0;
        font-size: 18px;
        line-height: 1.25;
        padding: 0 4px;
    }

    .mfmcal-views {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 4px;
        padding: 4px;
    }

    .mfmcal-view-btn {
        width: 100%;
        min-height: 40px;
        padding: 8px 10px;
    }

    .mfmcal-grid-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .mfmcal-month-grid {
        min-width: 760px;
    }

    .mfmcal-week-grid {
        min-width: 980px;
    }

    .mfmcal-day {
        min-height: 110px;
    }

    .mfmcal-year-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 14px;
        padding: 14px;
    }

    .mfmcal-modal-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .mfmcal-modal {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
    }

    .mfmcal-modal-body {
        padding: 18px;
    }

    .mfmcal-modal-title {
        font-size: 20px;
        padding-right: 28px;
    }

    .mfmcal-rsvp-section {
        padding: 16px;
    }

    .mfmcal-rsvp-btn {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .mfmcal-wrap {
        padding: 0 10px;
    }

    .mfmcal-toolbar {
        padding: 10px 0;
    }

    .mfmcal-title {
        font-size: 16px;
    }

    .mfmcal-nav-btn,
    .mfmcal-today-btn,
    .mfmcal-view-btn {
        min-height: 40px;
        font-size: 13px;
    }

    .mfmcal-month-grid {
        min-width: 700px;
    }

    .mfmcal-week-grid {
        min-width: 920px;
        grid-template-columns: 54px repeat(7, 1fr);
    }

    .mfmcal-dow-header,
    .mfmcal-week-header {
        font-size: 10px;
        padding: 8px 3px;
    }

    .mfmcal-day {
        min-height: 96px;
        padding: 5px;
    }

    .mfmcal-day-num {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .mfmcal-event-pill,
    .mfmcal-week-event {
        font-size: 10px;
    }

    .mfmcal-year-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
    }

    .mfmcal-mini-month-title {
        font-size: 12px;
    }

    .mfmcal-modal-body {
        padding: 16px;
    }

    .mfmcal-meta-row {
        font-size: 13px;
    }

    .mfmcal-maps-btn {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }

    .mfmcal-rsvp-form input,
    .mfmcal-rsvp-btn {
        font-size: 16px;
    }
}
