/* ============================================================
   MSC Event-Kalender – Frontend Styles
   Version 1.0.0 | Riemann Media
   ============================================================ */

:root {
    --msc-red:         #CC0000;
    --msc-red-dark:    #a80000;
    --msc-red-pale:    #fef2f2;
    --msc-black:       #111111;
    --msc-dark:        #1a1a1a;
    --msc-gray:        #6b7280;
    --msc-gray-light:  #f3f4f6;
    --msc-border:      #e5e7eb;
    --msc-white:       #ffffff;
    --msc-radius:      8px;
    --msc-shadow:      0 4px 28px rgba(0, 0, 0, .10);
    --msc-shadow-lg:   0 24px 60px rgba(0, 0, 0, .28);

    /* Kategorie-Farben */
    --msc-c-motocross:    #92400e;
    --msc-c-motocross-bg: #fef3c7;
    --msc-c-mtb:          #065f46;
    --msc-c-mtb-bg:       #d1fae5;
    --msc-c-gokart:       #4c1d95;
    --msc-c-gokart-bg:    #ede9fe;
    --msc-c-default:      #075985;
    --msc-c-default-bg:   #e0f2fe;
}

/* ─── Wrapper ─────────────────────────────────────────────────────────────── */

.msc-event-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
}

.msc-no-events {
    padding: 40px 24px;
    text-align: center;
    background: var(--msc-gray-light);
    border-radius: var(--msc-radius);
    color: var(--msc-gray);
    font-size: 15px;
}

/* ─── Table ───────────────────────────────────────────────────────────────── */

.msc-event-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--msc-white);
    border-radius: var(--msc-radius);
    overflow: hidden;
    box-shadow: var(--msc-shadow);
    min-width: 580px;
    font-size: 14px;
}

/* Header */
.msc-event-table thead tr {
    background: var(--msc-dark);
}

.msc-event-table thead th {
    padding: 13px 18px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: rgba(255, 255, 255, .65);
    white-space: nowrap;
}

.msc-event-table thead th:first-child {
    border-left: 4px solid var(--msc-red);
    padding-left: 16px;
}

/* Body rows */
.msc-event-table tbody tr {
    border-bottom: 1px solid var(--msc-border);
    transition: background 0.12s ease;
}

.msc-event-table tbody tr:last-child {
    border-bottom: none;
}

.msc-event-table tbody tr:hover {
    background: var(--msc-red-pale);
}

.msc-event-table td {
    padding: 14px 18px;
    vertical-align: middle;
}

.msc-event-table td:first-child {
    border-left: 4px solid transparent;
    transition: border-color 0.12s;
}

.msc-event-table tbody tr:hover td:first-child {
    border-left-color: var(--msc-red);
}

/* ─── Date Badge ──────────────────────────────────────────────────────────── */

.msc-col-date { width: 72px; }

.msc-date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--msc-red);
    color: var(--msc-white);
    border-radius: 7px;
    padding: 6px 8px 7px;
    min-width: 50px;
    line-height: 1;
    user-select: none;
}

.msc-date-day {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.5px;
}

.msc-date-month {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: 1px;
    opacity: .9;
}

.msc-date-year {
    font-size: 10px;
    font-weight: 400;
    opacity: .7;
    margin-top: 2px;
}

/* Mehrtägiges Badge */
.msc-date-badge--multi {
    padding: 5px 8px 6px;
}

.msc-date-range {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.3px;
    white-space: nowrap;
    line-height: 1;
}

.msc-date-sep {
    font-size: 13px;
    font-weight: 400;
    margin: 0 1px;
    opacity: .8;
}

/* ─── Title column ────────────────────────────────────────────────────────── */

.msc-col-title strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--msc-black);
    line-height: 1.35;
}

.msc-time {
    display: inline-block;
    font-size: 12px;
    color: var(--msc-gray);
    margin-top: 3px;
}

/* ─── Location column ─────────────────────────────────────────────────────── */

.msc-location {
    font-size: 13px;
    color: var(--msc-gray);
}

/* ─── Category Badge ──────────────────────────────────────────────────────── */

.msc-category-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: var(--msc-c-default-bg);
    color: var(--msc-c-default);
    white-space: nowrap;
}

.msc-cat-motocross    { background: var(--msc-c-motocross-bg); color: var(--msc-c-motocross); }
.msc-cat-mountainbike { background: var(--msc-c-mtb-bg);       color: var(--msc-c-mtb);       }
.msc-cat-go-kart      { background: var(--msc-c-gokart-bg);    color: var(--msc-c-gokart);    }

/* ─── Action button ───────────────────────────────────────────────────────── */

.msc-col-action { width: 100px; text-align: right; }

.msc-details-btn {
    background: var(--msc-red);
    color: var(--msc-white);
    border: none;
    padding: 7px 15px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .03em;
    transition: background .13s ease, transform .1s ease, box-shadow .13s;
    white-space: nowrap;
}

.msc-details-btn:hover {
    background: var(--msc-red-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(204, 0, 0, .3);
}

.msc-details-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ─── Popup Overlay ───────────────────────────────────────────────────────── */

.msc-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .72);
    z-index: 999990;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    /* hidden by default via [hidden] attribute */
}

.msc-popup-overlay[hidden] {
    display: none;
}

.msc-popup-overlay.msc-visible {
    display: flex;
    animation: mscFadeIn .18s ease;
}

@keyframes mscFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

body.msc-no-scroll { overflow: hidden; }

/* ─── Popup Box ───────────────────────────────────────────────────────────── */

.msc-popup-box {
    position: relative;
    background: var(--msc-white);
    border-radius: 14px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--msc-shadow-lg);
    animation: mscSlideUp .22s ease;
}

@keyframes mscSlideUp {
    from { transform: translateY(18px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* Close button */
.msc-popup-close {
    position: absolute;
    top: 12px; right: 12px;
    width: 30px; height: 30px;
    background: rgba(0, 0, 0, .08);
    border: none;
    border-radius: 50%;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--msc-dark);
    z-index: 1;
    transition: background .13s;
    flex-shrink: 0;
}

.msc-popup-close:hover  { background: rgba(0, 0, 0, .16); }
.msc-popup-close:focus  { outline: 2px solid var(--msc-red); outline-offset: 2px; }

/* ─── Popup Images ────────────────────────────────────────────────────────── */

.msc-popup-images {
    display: grid;
    gap: 3px;
    border-radius: 14px 14px 0 0;
    overflow: hidden;
    line-height: 0;
}

.msc-popup-images.one-image  { grid-template-columns: 1fr; }
.msc-popup-images.two-images { grid-template-columns: 1fr 1fr; }

.msc-popup-images img {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
}

.msc-popup-images.two-images img {
    height: 200px;
}

/* ─── Popup Content ───────────────────────────────────────────────────────── */

.msc-popup-content {
    padding: 22px 24px 24px;
}

.msc-popup-header {
    margin-bottom: 18px;
}

.msc-popup-header .msc-category-badge {
    font-size: 10px;
    margin-bottom: 8px;
}

.msc-popup-header h3 {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    color: var(--msc-black) !important;
    line-height: 1.2 !important;
    border: none !important;
}

/* ─── Details Grid ────────────────────────────────────────────────────────── */

.msc-popup-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: var(--msc-gray-light);
    border-radius: var(--msc-radius);
    padding: 14px 16px;
    margin-bottom: 18px;
}

.msc-detail-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
}

.msc-detail-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 1px;
    line-height: 1;
}

.msc-detail-item div {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.msc-detail-item strong {
    font-size: 9px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--msc-gray) !important;
    margin-bottom: 1px;
    display: block;
}

.msc-detail-item span {
    font-size: 13px;
    font-weight: 600;
    color: var(--msc-black);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Zeitraum-Feld (mehrtägig) erstreckt sich über beide Spalten */
.msc-detail-full {
    grid-column: 1 / -1;
}

/* ─── Description ─────────────────────────────────────────────────────────── */

.msc-popup-description {
    margin-bottom: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--msc-border);
}

.msc-popup-description p {
    font-size: 14px !important;
    color: #374151 !important;
    line-height: 1.65 !important;
    margin: 0 !important;
}

/* ─── Actions ─────────────────────────────────────────────────────────────── */

.msc-popup-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 14px;
    border-top: 1px solid var(--msc-border);
}

.msc-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    transition: all .14s ease;
    cursor: pointer;
    border: none;
    white-space: nowrap;
    line-height: 1.3;
}

.msc-btn-primary {
    background: var(--msc-red);
    color: var(--msc-white) !important;
    flex: 1;
    justify-content: center;
}

.msc-btn-primary:hover {
    background: var(--msc-red-dark);
    color: var(--msc-white) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(204, 0, 0, .28);
}

.msc-btn-secondary {
    background: var(--msc-gray-light);
    color: var(--msc-dark) !important;
    border: 1px solid var(--msc-border);
}

.msc-btn-secondary:hover {
    background: var(--msc-border);
    color: var(--msc-dark) !important;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media ( max-width: 640px ) {

    .msc-event-table       { min-width: unset; }
    .msc-event-table thead { display: none; }

    .msc-event-table tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        padding: 12px 14px;
        gap: 0;
    }

    .msc-event-table td { padding: 4px 0; border: none; }

    .msc-col-date     { width: 60px; order: 1; margin-right: 12px; }
    .msc-col-title    { order: 2; flex: 1; }
    .msc-col-category { order: 3; width: 100%; margin-left: 72px; }
    .msc-col-location { order: 4; width: 100%; margin-left: 72px; }
    .msc-col-action   { order: 5; width: 100%; margin-left: 72px; margin-top: 6px; }

    .msc-event-table tbody tr:hover td:first-child { border-left: none; }
    .msc-event-table tbody tr { border-left: 4px solid transparent; }
    .msc-event-table tbody tr:hover { border-left-color: var(--msc-red); }

    .msc-popup-details-grid { grid-template-columns: 1fr; }

    .msc-popup-content    { padding: 16px; }
    .msc-popup-header h3  { font-size: 17px !important; }

    .msc-popup-images img             { height: 180px; }
    .msc-popup-images.two-images img  { height: 140px; }

    .msc-btn { font-size: 12px; padding: 8px 14px; }
}
