/* ── Community Events Calendar page ── */

.cal-page {
    max-width: 1225px;
    margin: 30px auto 60px;
    padding: 0 24px;
}

.cal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.cal-new-btn {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    background: #0d1526;
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.cal-new-btn:hover {
    background: #1e2f52;
    color: #fff;
}

/* Shell */
.cal-shell {
    background: #fff;
    border: 1px solid #c4c3c3;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Toolbar */
.cal-toolbar {
    background: linear-gradient(135deg, #0d1526 0%, #1e2f52 100%);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.cal-nav {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cal-nav-btn,
.cal-today-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.cal-nav-btn {
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 3px;
}

.cal-today-btn {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 9px 16px;
}

.cal-nav-btn:hover,
.cal-today-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}

.cal-heading {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
    text-align: center;
    flex: 1;
    min-width: 160px;
}

.cal-views {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    overflow: hidden;
}

.cal-view-btn {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    padding: 9px 16px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.cal-view-btn:hover {
    color: #fff;
}

.cal-view-btn.is-active {
    background: #fff;
    color: #0d1526;
}

/* Type filter chips */
.cal-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 20px 0;
}

.cal-filters:empty {
    display: none;
}

.cal-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    padding: 5px 13px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.cal-chip:hover {
    background: #e5e7eb;
}

.cal-chip.is-active {
    background: #0d1526;
    border-color: #0d1526;
    color: #fff;
}

.cal-chip-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--cal-accent, #1d4ed8);
    flex-shrink: 0;
}

/* Event type colors */
.cal-c0 { --cal-accent: #1d4ed8; --cal-tint: #dbeafe; }
.cal-c1 { --cal-accent: #047857; --cal-tint: #d1fae5; }
.cal-c2 { --cal-accent: #b45309; --cal-tint: #fef3c7; }
.cal-c3 { --cal-accent: #6d28d9; --cal-tint: #ede9fe; }
.cal-c4 { --cal-accent: #be123c; --cal-tint: #ffe4e6; }
.cal-c5 { --cal-accent: #0f766e; --cal-tint: #ccfbf1; }
.cal-c6 { --cal-accent: #4338ca; --cal-tint: #e0e7ff; }
.cal-c7 { --cal-accent: #334155; --cal-tint: #e2e8f0; }

/* Calendar body */
.cal-root {
    padding: 16px 20px 20px;
}

.cal-empty {
    text-align: center;
    color: #6b7280;
    font-size: 0.92rem;
    padding: 40px 20px;
}

/* ── Month view ── */
.cal-month-head {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin-bottom: 6px;
}

.cal-dow {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7280;
    text-align: center;
    padding: 6px 4px;
}

.cal-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-top: 1px solid #e5e7eb;
    border-left: 1px solid #e5e7eb;
}

.cal-day {
    min-height: 108px;
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: #fff;
    overflow: hidden;
}

.cal-day.is-outside {
    background: #f9fafb;
}

.cal-day.is-outside .cal-day-num {
    color: #9199a6;
}

.cal-day-num {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    background: none;
    border: none;
    padding: 2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    align-self: flex-start;
}

/* Event-less day numbers are disabled to stay out of the tab order; keep them
   looking like plain dates rather than greyed-out controls. */
.cal-day-num:disabled {
    color: #374151;
    opacity: 1;
}

.cal-day.is-outside .cal-day-num:disabled {
    color: #9199a6;
}

.cal-day.has-events .cal-day-num {
    cursor: pointer;
}

.cal-day.has-events .cal-day-num:hover {
    background: #eef2ff;
}

.cal-day.is-today .cal-day-num {
    background: #1e40af;
    color: #fff;
}

.cal-event-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    text-align: left;
    background: var(--cal-tint, #dbeafe);
    border: none;
    border-left: 3px solid var(--cal-accent, #1d4ed8);
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 0.74rem;
    color: #1f2937;
    cursor: pointer;
    transition: filter 0.15s ease;
    overflow: hidden;
}

.cal-event-chip:hover {
    filter: brightness(0.95);
}

.cal-chip-time {
    font-weight: 700;
    color: var(--cal-accent, #1d4ed8);
    flex-shrink: 0;
}

.cal-chip-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.cal-more-btn {
    background: none;
    border: none;
    color: #1e40af;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: left;
    padding: 1px 6px;
    cursor: pointer;
}

.cal-more-btn:hover {
    text-decoration: underline;
}

/* ── Week view ── */
.cal-week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;
    border-top: 1px solid #e5e7eb;
    border-left: 1px solid #e5e7eb;
}

.cal-week-col {
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    min-height: 260px;
    display: flex;
    flex-direction: column;
}

.cal-week-col.is-today {
    background: #f8faff;
}

.cal-week-day-head {
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: center;
}

.cal-week-dow {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7280;
}

.cal-week-date {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1rem;
    font-weight: 700;
    color: #1f2d3d;
    margin-top: 4px;
}

.cal-week-col.is-today .cal-week-date {
    background: #1e40af;
    color: #fff;
}

.cal-week-events {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 8px;
}

.cal-week-card {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--cal-tint, #dbeafe);
    border: none;
    border-left: 3px solid var(--cal-accent, #1d4ed8);
    border-radius: 6px;
    padding: 8px 9px;
    cursor: pointer;
    transition: filter 0.15s ease;
}

.cal-week-card:hover {
    filter: brightness(0.95);
}

.cal-week-card-time {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--cal-accent, #1d4ed8);
}

.cal-week-card-title {
    display: block;
    font-size: 0.83rem;
    font-weight: 600;
    color: #1f2937;
    margin-top: 2px;
    line-height: 1.3;
}

.cal-week-card-loc {
    display: block;
    font-size: 0.72rem;
    color: #6b7280;
    margin-top: 2px;
}

.cal-week-none {
    font-size: 0.78rem;
    color: #6b7280;
    text-align: center;
    padding: 14px 4px;
}

/* ── Year view ── */
.cal-year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.cal-mini {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    background: #fff;
}

.cal-mini-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.cal-mini-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: #1f2d3d;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.cal-mini-title:hover {
    color: #1e40af;
    text-decoration: underline;
}

.cal-mini-count {
    font-size: 0.7rem;
    font-weight: 700;
    color: #1e40af;
    background: #dbeafe;
    border-radius: 999px;
    padding: 2px 8px;
}

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

.cal-mini-dow {
    font-size: 0.68rem;
    font-weight: 700;
    color: #6b7280;
    text-align: center;
    padding: 2px 0;
}

.cal-mini-day {
    font-size: 0.68rem;
    color: #4b5563;
    text-align: center;
    padding: 3px 0;
    border-radius: 5px;
    background: none;
    border: none;
    cursor: default;
    line-height: 1.4;
}

.cal-mini-day.is-blank {
    visibility: hidden;
}

.cal-mini-day.has-events {
    background: #dbeafe;
    color: #1e40af;
    font-weight: 700;
    cursor: pointer;
}

.cal-mini-day.has-events:hover {
    background: #bfdbfe;
}

.cal-mini-day.is-today {
    outline: 2px solid #1e40af;
    outline-offset: -2px;
    font-weight: 700;
}

/* ── Upcoming strip ── */
.cal-upcoming {
    margin-top: 26px;
}

.cal-upcoming-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1f2d3d;
    margin: 0 0 12px;
}

.cal-upcoming-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 14px;
}

.cal-up-card {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: #fff;
    border: 1px solid #c4c3c3;
    border-radius: 8px;
    padding: 14px;
    text-decoration: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.cal-up-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.cal-up-date {
    flex-shrink: 0;
    text-align: center;
    background: var(--cal-tint, #dbeafe);
    border-radius: 8px;
    padding: 6px 10px;
    min-width: 46px;
}

.cal-up-month {
    display: block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--cal-accent, #1d4ed8);
}

.cal-up-daynum {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
    color: #1f2d3d;
    line-height: 1.1;
}

.cal-up-info {
    min-width: 0;
}

.cal-up-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1f2d3d;
    line-height: 1.3;
}

.cal-up-meta {
    display: block;
    font-size: 0.76rem;
    color: #6b7280;
    margin-top: 3px;
}

.cal-upcoming-empty {
    color: #6b7280;
    font-size: 0.9rem;
}

/* ── Modal ── */
.cal-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.cal-modal[hidden] {
    display: none;
}

.cal-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 35, 0.55);
}

.cal-modal-card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    max-width: 460px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
}

.cal-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
}

.cal-modal-close:hover {
    color: #111827;
}

.cal-modal-badge {
    display: inline-block;
    background: var(--cal-tint, #dbeafe);
    color: var(--cal-accent, #1e40af);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
}

.cal-modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: #111827;
    margin: 0 0 14px;
    line-height: 1.3;
    padding-right: 20px;
}

.cal-modal-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 12px;
}

.cal-modal-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
}

.cal-modal-value {
    font-size: 0.92rem;
    font-weight: 600;
    color: #111827;
}

.cal-modal-value a {
    color: #1e40af;
    text-decoration: none;
}

.cal-modal-value a:hover {
    text-decoration: underline;
}

.cal-modal-daylist {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cal-modal-cta {
    display: inline-block;
    margin-top: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: #0d1526;
    color: #fff;
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.cal-modal-cta:hover {
    background: #1e2f52;
    color: #fff;
}

/* ── Responsive ── */
@media (max-width: 860px) {
    .cal-toolbar {
        justify-content: center;
    }

    .cal-heading {
        order: -1;
        flex-basis: 100%;
    }

    /* Week view stacks vertically */
    .cal-week-grid {
        grid-template-columns: 1fr;
        border-left: none;
        border-top: none;
    }

    .cal-week-col {
        min-height: 0;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        flex-direction: row;
        align-items: flex-start;
    }

    .cal-week-day-head {
        border-bottom: none;
        flex-shrink: 0;
        width: 74px;
    }

    .cal-week-events {
        flex: 1;
        padding: 10px 8px 10px 0;
    }

    .cal-week-none {
        text-align: left;
        padding: 16px 0;
    }
}

@media (max-width: 640px) {
    .cal-page {
        padding: 0 12px;
        margin-top: 16px;
    }

    .cal-root {
        padding: 10px 8px 12px;
    }

    .cal-day {
        min-height: 74px;
        padding: 3px;
    }

    /* Month chips collapse to dots on small screens */
    .cal-event-chip {
        padding: 2px 4px;
    }

    .cal-chip-time {
        display: none;
    }

    .cal-more-btn {
        font-size: 0.64rem;
        padding: 1px 2px;
    }

    .cal-day-num {
        width: 22px;
        height: 22px;
        font-size: 0.72rem;
    }
}

/* ── Dark mode ──
   theme.css darkens body.CommunityLight, so anything sitting directly on the page
   background needs its own treatment. Cards/panels intentionally stay white. */
[data-theme="dark"] .cal-upcoming-title {
    color: #ffffff;
}

[data-theme="dark"] .cal-new-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

[data-theme="dark"] .cal-new-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .cal-upcoming-empty {
    color: rgba(255, 255, 255, 0.75);
}
