
/* ==========================================
   KALENDARZ EVENTÓW WORDPRESS
   ========================================== */

/* Główny kontener */
.kew-root {
    background: #0d1220;
    color: #e9edf7;
    padding: 24px;
    border-radius: 14px;
    font-family: Inter, system-ui, Arial, sans-serif;
}

.kew-root,
.kew-root * {
    box-sizing: border-box;
}

.kew-body {
    margin: 0;
    padding: 24px;
}

.kew-main,
.kew-root .kew-main {
    max-width: 1200px;
    margin: auto;
}

/* Nagłówki i tekst */
.kew-root h1 {
    margin: 0 0 6px;
    font-size: clamp(25px, 4vw, 38px);
    color: #ffffff;
}

.kew-root p {
    color: #aab6cb;
}

.kew-root .top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.kew-root .tag {
    background: #1e2a44;
    color: #c8d7ff;
    padding: 9px 13px;
    border-radius: 12px;
}

/* Układ kalendarza */
.kew-root .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 310px;
    gap: 20px;
    margin-top: 22px;
}

.kew-root .months {
    display: grid;
    gap: 20px;
    min-width: 0;
}

/* ==========================================
   NAZWA MIESIĄCA - ZAWSZE BIAŁA
   ========================================== */

.kew-root .month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.kew-root .month-nav h2,
.kew-root .month-nav h2 *,
.kew-root .panel .month-nav h2,
.kew-root .months .month-nav h2 {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
    opacity: 1 !important;
    text-shadow: none !important;
}

.kew-root .month-nav h2 {
    margin: 0 !important;
    text-align: center;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.4;
}

.kew-root .month-nav button {
    width: auto;
    margin: 0;
    padding: 10px 15px;
}

/* Panele */
.kew-root .panel {
    background: #171f31;
    border: 1px solid #2b3750;
    border-radius: 18px;
    padding: 18px;
    min-width: 0;
}

.kew-root .panel h2 {
    margin: 0 0 16px;
    font-size: 21px;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

.kew-root .panel .month-nav h2 {
    margin: 0 !important;
}

/* Siatka kalendarza */
.kew-root .calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 5px;
}

.kew-root .dow {
    text-align: center;
    color: #a9b6cf;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 0;
}

/* Dni kalendarza */
.kew-root .day {
    min-height: 89px;
    background: #202b40;
    border: 1px solid #2d3a53;
    border-radius: 9px;
    padding: 7px 5px;
    overflow-wrap: anywhere;
    color: #e9edf7;
}

.kew-root .day.sat {
    border-color: #61769b;
}

.kew-root .day.today {
    outline: 2px solid #91a6ff;
    outline-offset: -2px;
}

.kew-root .day.past {
    opacity: 0.35;
}

.kew-root .day.occupied {
    background: #422a36;
    border-color: #804458;
}

.kew-root .day.own {
    background: #1e463b;
    border-color: #3d9370;
}

.kew-root .num {
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 5px;
    color: #ffffff;
}

.kew-root .empty {
    min-height: 89px;
}

/* Wydarzenia */
.kew-root .event {
    font-size: 10px;
    line-height: 1.2;
    padding: 4px 3px;
    border-radius: 5px;
    background: #9b4056;
    color: #ffffff;
    margin-top: 3px;
    font-weight: 650;
}

.kew-root .event.mine {
    background: #228b69;
}

/* Panel boczny */
.kew-root .sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-self: start;
}

.kew-root label {
    display: block;
    font-size: 13px;
    font-weight: 650;
    margin: 12px 0 5px;
    color: #e9edf7;
}

/* Pola formularza */
.kew-root input,
.kew-root select {
    width: 100%;
    background: #101829;
    border: 1px solid #465571;
    color: #ffffff;
    padding: 11px;
    border-radius: 9px;
    font: inherit;
    color-scheme: dark;
}

/* Przyciski */
.kew-root button {
    border: 0;
    background: #687eff;
    color: #ffffff;
    border-radius: 9px;
    padding: 12px 15px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    margin-top: 15px;
}

.kew-root button:hover {
    filter: brightness(1.12);
}

.kew-root button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    filter: grayscale(1);
}

.kew-root button.danger {
    background: #683c4a;
    width: auto;
    margin: 0;
    padding: 5px 9px;
}

.kew-root .actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.kew-root .actions button {
    width: auto;
    margin: 0;
    padding: 6px 9px;
}

.kew-root .edit-btn {
    background: #415b91;
}

.kew-root .editing {
    border-color: #91a6ff !important;
}

/* Lista wydarzeń */
.kew-root .item {
    border-bottom: 1px solid #344058;
    padding: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.kew-root .item small {
    display: block;
    color: #aab6cb;
    margin-top: 3px;
}

/* Legenda */
.kew-root .legend {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-top: 15px;
    color: #bdc9dd;
    font-size: 13px;
}

.kew-root .dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 3px;
    margin-right: 6px;
    background: #9b4056;
}

.kew-root .dot.green {
    background: #228b69;
}

.kew-root .muted {
    font-size: 12px;
    color: #aab6cb;
}

.kew-root #message {
    font-size: 12px;
    color: #92e5bd;
    margin-top: 8px;
}

/* Widoczność elementów administracyjnych */
.kew-root .kew-admin-only[hidden] {
    display: none !important;
}

/* Widok publiczny */
.kew-root .kew-layout-public {
    grid-template-columns: 1fr;
}

.kew-root .kew-layout-public .sidebar {
    display: none;
}

.kew-root .kew-layout-public .months {
    max-width: 100%;
}

/* ==========================================
   WERSJA MOBILNA
   ========================================== */

@media (max-width: 800px) {
    .kew-body {
        padding: 12px;
    }

    .kew-root .layout {
        grid-template-columns: 1fr;
    }

    .kew-root .panel {
        padding: 12px;
    }

    .kew-root .calendar {
        gap: 3px;
    }

    .kew-root .day,
    .kew-root .empty {
        min-height: 70px;
    }

    .kew-root .event {
        font-size: 9px;
    }

    .kew-root .num {
        font-size: 12px;
    }

    .kew-root .sidebar {
        order: -1;
    }

    .kew-root .month-nav h2 {
        font-size: 18px;
    }
}

/* ==========================================
   OSTATECZNE WYMUSZENIE BIAŁEGO MIESIĄCA
   ========================================== */

body .kew-root .month-nav h2,
body .kew-root .panel .month-nav h2,
body .kew-root .months .month-nav h2,
body .kew-root .month-nav h2 * {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Ulepszony nagłówek na telefonach */
@media (max-width: 600px) {
  .kew-root { padding: 14px 12px; border-radius: 12px; }
  .kew-root .top { display: flex; flex-direction: column; align-items: stretch; gap: 12px; padding: 18px 16px; background: linear-gradient(135deg,#1e2b47,#151d30); border: 1px solid #344663; border-radius: 16px; }
  .kew-root .top > div { min-width: 0; }
  .kew-root .top h1 { color: #fff !important; -webkit-text-fill-color: #fff !important; font-size: clamp(23px,6vw,30px); line-height: 1.15; letter-spacing: -.5px; margin: 0 0 10px; overflow-wrap: break-word; }
  .kew-root .top p { font-size: 13px; line-height: 1.55; margin: 0; color: #c2cee2; }
  .kew-root .top .tag { display: inline-flex; align-self: flex-start; max-width: 100%; padding: 8px 11px; font-size: 12px; line-height: 1.4; border: 1px solid #465c87; border-radius: 999px; }
  .kew-root .legend { gap: 9px 16px; font-size: 12px; margin-top: 14px; }
}

/* Czytelne wydarzenia na wąskich ekranach: każde słowo w osobnym wierszu */
@media (max-width: 800px) {
  .kew-root .day { min-width: 0; padding: 5px 2px; overflow: hidden; }
  .kew-root .event { display: block; max-width: 100%; padding: 5px 1px; margin-top: 5px; font-size: clamp(8px, 2.4vw, 12px); font-weight: 650; line-height: 1.3; text-align: center; white-space: normal; overflow-wrap: anywhere; word-break: normal; hyphens: none; }
  .kew-root .event .kew-event-word { display: block; max-width: 100%; overflow-wrap: anywhere; }
}

/* Okno szczegółów wydarzenia */
.kew-root .event[role="button"] { cursor: pointer; }
.kew-root .event[role="button"]:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.kew-root .kew-details-overlay[hidden] { display: none !important; }
.kew-root .kew-details-overlay { position: fixed; inset: 0; z-index: 999999; display: flex; justify-content: center; align-items: center; padding: 18px; background: rgba(4,8,18,.78); }
.kew-root .kew-details-dialog { position: relative; width: min(100%, 420px); padding: 28px 22px 22px; border: 1px solid #50658b; border-radius: 18px; background: #19243a; box-shadow: 0 18px 55px rgba(0,0,0,.55); color: #fff; overflow-wrap: anywhere; }
.kew-root .kew-details-dialog h3 { margin: 0 38px 18px 0; font-size: clamp(20px,5vw,27px); line-height: 1.25; color: #fff !important; -webkit-text-fill-color: #fff !important; }
.kew-root .kew-details-dialog p { margin: 10px 0; color: #e9edf7; font-size: 15px; }
.kew-root button.kew-details-close { position: absolute; right: 12px; top: 10px; width: 38px; height: 38px; padding: 0; margin: 0; border-radius: 10px; font-size: 29px; line-height: 1; background: #344766; color: #fff; }

/* Szczegóły po najechaniu myszką; kliknięcie otwiera pełne okno */
@media (hover: hover) and (pointer: fine) {
  .kew-root .calendar .day { overflow: visible; }
  .kew-root .calendar .event { position: relative; cursor: pointer; }
  .kew-root .calendar .event:hover { z-index: 30; }
  .kew-root .calendar .event:hover::after {
    content: attr(data-kew-hover-title) "\A" attr(data-kew-hover-info);
    white-space: pre-line; position: absolute; z-index: 100;
    left: 50%; bottom: calc(100% + 9px); transform: translateX(-50%);
    width: max-content; max-width: min(280px, 85vw); min-width: 175px;
    padding: 13px 15px; border-radius: 12px; border: 1px solid #50658b;
    background: #19243a; color: #fff; font-size: 13px; font-weight: 500;
    line-height: 1.6; text-align: left; overflow-wrap: anywhere;
    box-shadow: 0 12px 30px rgba(0,0,0,.5); pointer-events: none;
  }
}
