/* mod_kafle_calendar v1.2.1 */

.kc-cal {
    --kc-accent: #c5e800;
    --kc-event-bg: #c5e800;
    --kc-event-color: #000;
    --kc-event-size: 12px;
    --kc-dow-bg: var(--kc-accent);
    --kc-dow-color: #000;
    --kc-pop-date-color: var(--kc-accent);
    --kc-grid-line: #4a4f57;          /* ciemnoszara obwodka komorek */
    --kc-cell-bg: rgba(255, 255, 255, .03);
    --kc-cell-radius: 8px;            /* zaokraglenie komorek-butonow */
    --kc-cell-shadow: 0 1px 4px rgba(0, 0, 0, .14);  /* bardzo delikatny podcien */
    position: relative;
}

/* ---------- Slider ---------- */

.kc-slider {
    position: relative;
}

.kc-viewport {
    overflow: hidden;
}

.kc-month {
    display: none;
}

.kc-month.is-active {
    display: block;
    animation: kc-fade .25s ease;
}

@keyframes kc-fade {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: none; }
}

.kc-arrow {
    position: absolute;
    top: 0;
    z-index: 5;
    width: 42px;
    height: 42px;
    border: 2px solid var(--kc-accent);
    border-radius: 50%;
    background: transparent;
    color: var(--kc-accent);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .25s ease, color .25s ease, opacity .25s ease;
}

.kc-prev { left: 0; }
.kc-next { right: 0; }

.kc-arrow:hover,
.kc-arrow:focus-visible {
    background: var(--kc-accent);
    color: #000;
}

.kc-arrow:disabled {
    opacity: .25;
    cursor: default;
    pointer-events: none;
}

/* ---------- Naglowek miesiaca ---------- */

.kc-title {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 54px 14px;
    color: var(--kc-accent);
    font-size: 1.35rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    text-align: center;
}

/* ---------- Dni tygodnia ---------- */

.kc-dow {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 6px;
}

.kc-dow-cell {
    padding: 9px 4px;
    background: var(--kc-dow-bg);
    color: var(--kc-dow-color);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    letter-spacing: .04em;
    border-radius: var(--kc-cell-radius);
    box-shadow: var(--kc-cell-shadow);
    min-width: 0;
}

/* ---------- Siatka dni: komorki jak plaskie butony ---------- */

.kc-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.kc-cell {
    position: relative;
    min-height: 96px;
    min-width: 0;                      /* klucz: pozwala komorce sie kurczyc */
    overflow: hidden;                  /* nic nie wychodzi poza komorke */
    padding: 34px 8px 8px;
    background: var(--kc-cell-bg);
    border: 1px solid var(--kc-grid-line);
    border-radius: var(--kc-cell-radius);
    box-shadow: var(--kc-cell-shadow);
}

.kc-cell.kc-empty {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}

.kc-cell.kc-today {
    border-color: var(--kc-accent);
    box-shadow: inset 0 0 0 1px var(--kc-accent), var(--kc-cell-shadow);
}

/* Duze, wyrazne liczby dni */
.kc-daynum {
    position: absolute;
    top: 5px;
    right: 8px;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1;
    opacity: .85;
}

.kc-cell.kc-today .kc-daynum {
    color: var(--kc-accent);
    opacity: 1;
}

/* ---------- Butony wydarzen ---------- */

.kc-events {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.kc-event {
    display: block;
    padding: 4px 7px;
    background: var(--kc-event-bg);
    color: var(--kc-event-color);
    font-size: var(--kc-event-size);
    font-weight: 600;
    line-height: 1.25;
    border-radius: 4px;
    text-decoration: none;
    white-space: normal;               /* zawijanie wierszy tytulu */
    overflow-wrap: anywhere;           /* lamanie takze dlugich slow/#43#44 */
    word-break: break-word;
    transition: filter .2s ease, transform .2s ease;
}

.kc-event:hover,
.kc-event:focus-visible {
    color: var(--kc-event-color);
    text-decoration: none;
    filter: brightness(1.12);
    transform: translateY(-1px);
}

/* ---------- Popup podgladu (pozycjonowany przez JS, position: fixed) ---------- */

.kc-pop {
    position: fixed;
    z-index: 1050;
    width: 240px;
    padding: 8px;
    background: #14181f;
    border: 1px solid var(--kc-accent);
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
    pointer-events: none;
}

.kc-pop[hidden] {
    display: none;
}

.kc-pop-img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

.kc-pop-img.kc-noimg {
    display: none;
}

.kc-pop-title {
    display: block;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.3;
}

.kc-pop-date {
    display: block;
    margin-top: 4px;
    color: var(--kc-pop-date-color);
    font-size: 0.8rem;
    letter-spacing: .03em;
}

/* ---------- Responsywnosc ---------- */

@media (max-width: 991.98px) {
    .kc-cell {
        min-height: 78px;
        padding-top: 28px;
    }

    .kc-daynum {
        font-size: 1.05rem;
    }

    /* Tablet i telefon: same butony-paski, bez tytulow (tekst sie nie miesci) */
    .kc-events {
        gap: 6px;
    }

    .kc-event {
        font-size: 0;
        line-height: 0;
        height: 16px;
        padding: 0;
        border-radius: 3px;
    }
}

@media (max-width: 575.98px) {
    .kc-title {
        font-size: 1.05rem;
        margin: 0 48px 10px;
    }

    .kc-dow-cell {
        font-size: 0.62rem;
        padding: 5px 2px;
    }

    .kc-grid,
    .kc-dow {
        gap: 4px;
    }

    .kc-cell {
        min-height: 60px;
        padding: 22px 4px 5px;
    }

    .kc-daynum {
        font-size: 0.9rem;
        top: 3px;
        right: 5px;
    }

    .kc-arrow {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kc-month.is-active {
        animation: none;
    }
    .kc-arrow,
    .kc-event {
        transition: none;
    }
}
