/* WS BSL Calendar – public styles v1.1.0 */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700&display=swap');

/* ---- Base ---- */
.bsl-calendar {
    font-family: 'Nunito', sans-serif;
    max-width: 760px;
    margin: 0 auto 2em;
    color: #2c2c2a;
    box-sizing: border-box;
}
.bsl-calendar *, .bsl-calendar *::before, .bsl-calendar *::after {
    box-sizing: border-box;
}

/* ---- School heading ---- */
.bsl-cal-header { margin-bottom: 10px; }
.bsl-school-name {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: #2c2c2a;
}

/* ---- iCal bar ---- */
.bsl-ical-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: #f0f6ff;
    border: 1px solid #b5d4f4;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
}
.bsl-ical-label {
    font-size: 12px;
    color: #185fa5;
    font-weight: 700;
    white-space: nowrap;
}
.bsl-ical-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.bsl-ical-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    text-decoration: none;
    transition: opacity .15s;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}
.bsl-ical-btn:hover { opacity: .82; }
.bsl-ical-ics     { background: #1D9E75; color: #fff; }
.bsl-ical-google  { background: #4F86C6; color: #fff; }
.bsl-ical-outlook { background: #185fa5; color: #fff; }

/* ---- Term strip ---- */
.bsl-strip-label {
    font-size: 11px;
    color: #888780;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 5px;
}
.bsl-strip-wrap {
    position: relative;
    display: flex;
    gap: 3px;
    height: 36px;
    align-items: stretch;
    margin-bottom: 4px;
    overflow: visible;
}
.bsl-strip-term {
    position: relative;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: filter .15s, transform .1s;
    min-width: 0;
    overflow: hidden;
}
.bsl-strip-term:hover { filter: brightness(.9); transform: scaleY(1.06); }
.bsl-strip-term.bsl-active { outline: 2px solid #2c2c2a; outline-offset: 2px; }
.bsl-strip-term-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(0,0,0,.5);
    white-space: nowrap;
    pointer-events: none;
}
.bsl-strip-hols {
    border-radius: 3px;
    background: #f1efe8;
    border: 1px solid #d3d1c7;
    min-width: 4px;
}
.bsl-strip-today {
    position: absolute;
    top: -4px; bottom: -4px;
    width: 2px;
    background: #E24B4A;
    border-radius: 1px;
    pointer-events: none;
    z-index: 5;
}
.bsl-strip-today-pip {
    position: absolute;
    top: -4px; left: 50%;
    transform: translateX(-50%);
    width: 7px; height: 7px;
    background: #E24B4A;
    border-radius: 50%;
}
.bsl-strip-today-label {
    position: absolute;
    bottom: -18px; left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 700;
    color: #A32D2D;
    white-space: nowrap;
}
.bsl-strip-detail {
    min-height: 24px;
    margin-top: 22px;
    font-size: 12px;
    color: #888780;
    padding: 5px 10px;
    border-radius: 6px;
    background: #f6f7f7;
    border: 1px solid #e5e5e5;
}

/* ---- Legend ---- */
.bsl-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin: 12px 0 14px;
}
.bsl-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
}
.bsl-legend-dot {
    width: 9px; height: 9px;
    border-radius: 2px;
    display: inline-block;
    flex-shrink: 0;
}
.bsl-type-event        .bsl-legend-dot { background: #4F86C6; }
.bsl-type-training_day .bsl-legend-dot { background: #EF9F27; }
.bsl-type-holiday      .bsl-legend-dot { background: #EF9F27; }
.bsl-type-bank_holiday .bsl-legend-dot { background: #888780; }
.bsl-type-trip         .bsl-legend-dot { background: #7F77DD; }
.bsl-type-closure      .bsl-legend-dot { background: #E24B4A; }

/* ---- Nav ---- */
.bsl-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
.bsl-nav-btn {
    background: #f1efe8;
    border: 1px solid #d3d1c7;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 16px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    line-height: 1;
    flex-shrink: 0;
    transition: background .1s;
}
.bsl-nav-btn:hover { background: #e3e1d8; }
.bsl-nav-month {
    font-size: 18px;
    font-weight: 700;
    flex: 1;
}

/* ---- Day-of-week headers ---- */
.bsl-dow-headers {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 3px;
}
.bsl-dow {
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #888780;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 3px 0;
}

/* ---- Calendar grid ---- */
.bsl-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}
.bsl-day {
    min-height: 70px;
    border-radius: 8px;
    padding: 6px 6px 4px;
    background: #f9f8f5;
    border: 1px solid #ebe9e3;
    position: relative;
    cursor: default;
    transition: border-color .1s, background .1s;
    overflow: hidden;
}
.bsl-day.bsl-other-month { opacity: .28; pointer-events: none; }
.bsl-day.bsl-today { background: #fff8e6; border-color: #EF9F27; }
.bsl-day.bsl-in-term { background: #fff; }
.bsl-day.bsl-saturday { background: var(--bsl-sat, #fff9c4) !important; }
.bsl-day.bsl-sunday   { background: var(--bsl-sun, #ffe0b2) !important; }
.bsl-day.bsl-has-events { cursor: pointer; }
.bsl-day.bsl-has-events:hover { border-color: #4F86C6; }
.bsl-day.bsl-in-term { border-left-width: 3px; }

.bsl-day-num {
    font-size: 12px;
    font-weight: 700;
    color: #444441;
    line-height: 1;
    margin-bottom: 3px;
    display: block;
}
.bsl-day.bsl-today .bsl-day-num {
    background: #EF9F27;
    color: #fff;
    width: 20px; height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.bsl-day-events { display: flex; flex-direction: column; gap: 2px; }
.bsl-event-pip {
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    border-radius: 3px;
    padding: 1px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 100%;
    line-height: 1.3;
}
.bsl-event-more { font-size: 9px; color: #888780; font-weight: 600; }

/* ---- Event detail panel ---- */
.bsl-event-detail {
    margin-top: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 14px 18px;
}
.bsl-event-detail h3 { margin: 0 0 8px; font-size: 14px; }
.bsl-event-detail ul { margin: 0; padding: 0; list-style: none; }
.bsl-event-detail ul li {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    padding: 4px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}
.bsl-event-detail ul li:last-child { border-bottom: none; }
.bsl-event-detail-dot {
    width: 9px; height: 9px;
    border-radius: 2px;
    flex-shrink: 0;
    margin-top: 3px;
}

/* ---- Bank holidays ---- */
.bsl-bank-hols {
    margin-top: 24px;
    padding: 14px 18px;
    background: #f9f8f5;
    border: 1px solid #ebe9e3;
    border-radius: 10px;
}
.bsl-bank-hols-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 10px;
}
.bsl-bank-hols-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 5px 16px;
}
.bsl-bh-item { display: flex; gap: 8px; font-size: 12px; }
.bsl-bh-date { color: #888780; min-width: 74px; flex-shrink: 0; }
.bsl-bh-name { font-weight: 700; }

/* ---- PDF bar ---- */
.bsl-pdf-bar { margin-top: 14px; text-align: right; }
.bsl-pdf-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #444441;
    background: #f1efe8;
    border: 1px solid #d3d1c7;
    border-radius: 20px;
    padding: 6px 14px;
    text-decoration: none;
    transition: background .1s;
}
.bsl-pdf-btn:hover { background: #e3e1d8; }

/* ====================================================================
   MOBILE — max-width 600px
   ==================================================================== */
@media (max-width: 600px) {

    .bsl-school-name { font-size: 17px; }

    /* Compact iCal bar — stacks label above buttons */
    .bsl-ical-bar { flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 12px; }
    .bsl-ical-btn { font-size: 11px; padding: 4px 10px; }

    /* Thinner strip */
    .bsl-strip-wrap { height: 28px; }
    .bsl-strip-term-label { font-size: 8px; }

    /* Smaller nav */
    .bsl-nav-month { font-size: 15px; }
    .bsl-nav-btn { padding: 5px 11px; font-size: 14px; }

    /* Day headers — single letter on small screens */
    .bsl-dow { font-size: 10px; letter-spacing: 0; }

    /* Grid — tighter, shorter cells */
    .bsl-grid { gap: 2px; }
    .bsl-dow-headers { gap: 2px; }

    .bsl-day {
        min-height: 46px;
        padding: 4px 3px 2px;
        border-radius: 5px;
    }
    .bsl-day-num {
        font-size: 10px;
        margin-bottom: 2px;
    }
    .bsl-day.bsl-today .bsl-day-num {
        width: 16px; height: 16px;
        font-size: 9px;
    }

    /* On very small screens, hide event pips to avoid overflow */
    .bsl-event-pip {
        font-size: 8px;
        padding: 1px 2px;
        border-radius: 2px;
    }
    .bsl-event-more { font-size: 8px; }

    /* Legend wraps tightly */
    .bsl-legend { gap: 4px 8px; }
    .bsl-legend-item { font-size: 10px; }

    /* Bank holidays single column */
    .bsl-bank-hols-grid { grid-template-columns: 1fr; }
    .bsl-bh-item { font-size: 12px; }

    .bsl-pdf-bar { text-align: left; }
}

/* Extra small — hide event pip text, just show colour dot */
@media (max-width: 380px) {
    .bsl-event-pip {
        width: 6px; height: 6px;
        border-radius: 50%;
        padding: 0;
        font-size: 0;
        display: inline-block;
    }
    .bsl-day-events { flex-direction: row; gap: 2px; flex-wrap: wrap; }
    .bsl-event-more { display: none; }
    .bsl-dow { font-size: 9px; }
}
