/* ── MEC Calendar Frontend CSS ─────────────────────────────────────────────── */
/* Mobile-first: Calendar nimmt max. 25% der Viewport-Höhe ein               */

.mec-calendar-wrap {
    --mec-c-bg:      #0F172A;
    --mec-c-card:    #1E293B;
    --mec-c-border:  rgba(255,255,255,0.08);
    --mec-c-text:    #F8FAFC;
    --mec-c-sub:     rgba(255,255,255,0.5);
    --mec-c-accent:  #2563EB;

    background: var(--mec-c-bg);
    border-radius: 16px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    max-height: 25vh;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    position: relative;
}

/* Header */
.mec-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px 8px;
    border-bottom: 1px solid var(--mec-c-border);
    flex-shrink: 0;
    background: rgba(0,0,0,0.2);
}
.mec-cal-header-left {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--mec-c-sub);
}
.mec-cal-header-left svg { opacity: 0.7; }
.mec-cal-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mec-c-text);
}
.mec-cal-month {
    font-size: 11px;
    color: var(--mec-c-sub);
    font-weight: 500;
}

/* Days Scroll */
.mec-days-scroll {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 8px 10px;
}
.mec-days-scroll::-webkit-scrollbar { display: none; }

.mec-days-track {
    display: flex;
    gap: 6px;
    height: 100%;
    align-items: flex-start;
}

/* Day Column */
.mec-day-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
    width: 72px;
}
.mec-today .mec-day-label { opacity: 1; }

.mec-day-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 4px;
    opacity: 0.6;
}
.mec-dn {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--mec-c-sub);
    font-weight: 600;
}
.mec-dd {
    font-size: 13px;
    font-weight: 700;
    color: var(--mec-c-text);
    line-height: 1.3;
}
.mec-dd-today {
    background: var(--mec-c-accent);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}
.mec-today .mec-dd-today { box-shadow: 0 0 0 3px rgba(37,99,235,0.3); }

/* Day Events */
.mec-day-events { display: flex; flex-direction: column; gap: 4px; }

/* Empty Slot */
.mec-empty-slot {
    height: 80px;
    border: 1px dashed var(--mec-c-border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mec-empty-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--mec-c-border);
}

/* Event Card */
.mec-event-card {
    width: 72px;
    height: 90px;
    border-radius: 10px;
    padding: 8px;
    background: var(--mec-color, #2563EB);
    background-image: linear-gradient(135deg, var(--mec-color, #2563EB) 0%, color-mix(in srgb, var(--mec-color, #2563EB) 80%, black) 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    outline: none;
}
.mec-event-card:hover,
.mec-event-card:focus {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.mec-event-card:active { transform: scale(0.97); }

.mec-ec-day {
    position: absolute;
    top: 6px;
    right: 7px;
    font-size: 12px;
    font-weight: 800;
    color: rgba(255,255,255,0.85);
    line-height: 1;
}
.mec-ec-topic {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    margin-top: 18px;
    flex: 1;
    word-break: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
}
.mec-ec-footer {
    margin-top: auto;
    padding-top: 5px;
    border-top: 1px solid rgba(255,255,255,0.2);
}
.mec-ec-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    border: 2px solid rgba(255,255,255,0.5);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
}
.mec-ec-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Modal ─────────────────────────────────────────────────────────────────── */
/* Nuclear z-index: Modal wird per JS an <html> gehängt */
html > .mec-modal-overlay {
    position: fixed !important;
    top: 0 !important; left: 0 !important;
    width: 100vw !important; height: 100vh !important;
    margin: 0 !important; padding: 0 !important;
    z-index: 2147483647 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 18, 0.88);
    backdrop-filter: blur(20px) saturate(1.8) brightness(0.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.8) brightness(0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.28s ease;
    box-sizing: border-box;
    padding: 16px;
    isolation: isolate;
}
html > .mec-modal-overlay.mec-open {
    opacity: 1;
    pointer-events: all;
}

/* Modal Card */
.mec-modal {
    position: relative;
    width: 100%;
    max-width: 420px;
    /* Kein max-height → passt sich automatisch dem Inhalt an */
    height: auto;
    overflow: hidden;
    border-radius: 24px;
    /* Gleiche Schrift wie der Kalender */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    /* Deep premium dark glass */
    background:
        linear-gradient(160deg,
            rgba(15,23,42,0.98) 0%,
            rgba(10,15,30,0.99) 100%
        );
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow:
        0 32px 80px rgba(0,0,0,0.85),
        0 0 0 1px rgba(255,255,255,0.05) inset,
        0 1px 0 rgba(255,255,255,0.1) inset;
    transform: scale(0.88) translateY(20px);
    transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
    opacity: 0;
}
html > .mec-modal-overlay.mec-open .mec-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Colored top glow bar */
.mec-modal-accent {
    height: 3px;
    width: 100%;
    border-radius: 24px 24px 0 0;
    display: block;
    flex-shrink: 0;
}

/* Close Button */
.mec-modal-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.5);
    transition: all 0.18s;
    z-index: 5;
}
.mec-modal-close:hover {
    background: rgba(255,255,255,0.16);
    color: #fff;
    transform: scale(1.1);
}

/* Inner padding */
.mec-modal-content {
    padding: 18px 20px 28px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── Hero Section: farbiger Gradient-Banner ── */
.mec-modal-hero {
    margin: 0 -20px;
    margin-top: -18px;
    padding: 20px 20px 18px;
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
}
.mec-modal-hero::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, rgba(10,15,30,0.99));
}

.mec-modal-hero-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

/* Educator */
.mec-modal-edu {
    display: flex;
    align-items: center;
    gap: 10px;
}
.mec-modal-edu-img {
    width: 42px; height: 42px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; font-weight: 800; color: #fff;
    border: 2px solid rgba(255,255,255,0.25);
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    background: rgba(255,255,255,0.1);
}
.mec-modal-edu-img img { width: 100%; height: 100%; object-fit: cover; }
.mec-modal-edu-info strong {
    display: block;
    font-size: 13px; font-weight: 700;
    color: rgba(255,255,255,0.95);
    letter-spacing: -0.01em;
}
.mec-modal-edu-info span {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
}

/* Datum-Badge */
.mec-modal-tag {
    font-size: 10px; font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid transparent;
    white-space: nowrap;
    margin-top: 2px;
}

/* ── Titel ── */
.mec-modal-title {
    font-size: 1.65rem;
    font-weight: 900;
    color: #fff;
    margin: 0 0 16px;
    line-height: 1.15;
    letter-spacing: -0.03em;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    word-break: break-word;
}

/* ── Meta Chips ── */
.mec-modal-meta {
    display: flex; flex-wrap: wrap; gap: 7px;
    margin-bottom: 18px;
}
.mec-modal-meta-item {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600;
    color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 6px 11px;
    border-radius: 8px;
    text-decoration: none;
}
/* Klickbarer Ort-Chip */
a.mec-modal-meta-link {
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
    color: rgba(255,255,255,0.75) !important;
    border-color: rgba(255,255,255,0.2);
}
a.mec-modal-meta-link:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.35);
    color: #fff !important;
    text-decoration: none !important;
}

/* ── Divider ── */
.mec-modal-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 30%, rgba(255,255,255,0.08) 70%, transparent 100%);
    margin: 0 0 16px;
}

/* ── Beschreibung ── */
.mec-modal-desc {
    font-size: 14px; line-height: 1.7;
    color: rgba(255,255,255,0.55);
    margin: 0 0 22px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    word-break: break-word;
    white-space: pre-line;
}

/* ── Buttons ── */
.mec-modal-actions { display: flex; flex-direction: column; gap: 10px; }

.mec-modal-btn {
    display: flex; align-items: center; justify-content: center;
    gap: 9px;
    padding: 15px 22px;
    border-radius: 14px;
    font-size: 14px; font-weight: 700;
    text-decoration: none !important;
    border: none; cursor: pointer;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #fff !important;
    text-align: center;
    letter-spacing: 0.01em;
    position: relative; overflow: hidden;
}
.mec-modal-btn::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.12), transparent);
    border-radius: 14px 14px 0 0;
    pointer-events: none;
}
.mec-modal-btn:hover { color: #fff !important; transform: translateY(-2px); }
.mec-modal-btn:active { transform: scale(0.97); }

.mec-modal-btn-form {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    box-shadow: 0 4px 20px rgba(16,185,129,0.4);
}
.mec-modal-btn-form:hover { box-shadow: 0 8px 30px rgba(16,185,129,0.55); }

/* Event Button – Farbe kommt dynamisch per inline style aus JS */
.mec-modal-btn-event {
    font-size: 15px;
    letter-spacing: 0.02em;
}

/* Mobile bottom sheet auf sehr kleinen Screens */
@media (max-width: 500px) {
    html > .mec-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    .mec-modal {
        border-radius: 24px 24px 0 0;
        max-width: 100%;
        /* Auto-Höhe — kein max-height Limit */
        height: auto;
        overflow: hidden;
        transform: translateY(60px);
    }
    html > .mec-modal-overlay.mec-open .mec-modal {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Tablet+ */
@media (min-width: 768px) {
    .mec-calendar-wrap { max-height: 26vh; }
    .mec-day-col { width: 80px; }
    .mec-event-card { width: 80px; height: 100px; }
}
