/* =====================================================
   Trinity Calendar — Styles v2
   Default accent: #6d3b8a (purple) — override via
   Settings → Trinity Calendar → Accent color
   ===================================================== */

:root {
    --tc-accent:       #6d3b8a;
    --tc-text:         #2c2c2c;
    --tc-text-muted:   #6b7280;
    --tc-bg:           #ffffff;
    --tc-border-color: #e5e7eb;
    --tc-card-border:  1px solid transparent;
    --tc-radius:       8px;
    --tc-font:         inherit;
}

/* ── Outer wrapper ─────────────────────────────────── */
.trinity-calendar {
    font-family: var(--tc-font);
    color: var(--tc-text);
    line-height: 1.5;
    max-width: 680px;
    margin: 0 auto;
}

/* ── Force SVG dimensions — prevents themes collapsing them to 0 ── */
.trinity-calendar svg,
.tc-month-wrap svg,
.tc-modal svg {
    width: 1em;
    height: 1em;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

.tc-month-nav svg {
    width: 18px !important;
    height: 18px !important;
}

.tc-modal-close svg {
    width: 20px !important;
    height: 20px !important;
}

.tc-heading {
    font-size: 1.3em;
    font-weight: 700;
    margin: 0 0 1em;
    color: var(--tc-accent);
    letter-spacing: -0.01em;
}

.tc-empty {
    color: var(--tc-text-muted);
    font-style: italic;
    padding: 1em 0;
}

/* ── Month separator ───────────────────────────────── */
.tc-cards {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tc-month-separator {
    display: flex;
    align-items: center;
    gap: 0.75em;
    margin: 1.5em 0 0.75em;
    font-size: 0.78em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tc-text-muted);
}

.tc-month-separator:first-child {
    margin-top: 0;
}

.tc-month-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--tc-border-color);
}

/* ── Event card ────────────────────────────────────── */
.tc-card {
    display: flex;
    align-items: flex-start;
    gap: 1em;
    padding: 0.85em 1em;
    background: var(--tc-bg);
    border: var(--tc-card-border);
    border-left: 4px solid var(--tc-accent);
    border-radius: var(--tc-radius);
    margin-bottom: 0.6em;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.tc-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

/* ── Date badge ────────────────────────────────────── */
.tc-date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    width: 48px;
    height: 52px;
    background: color-mix(in srgb, var(--tc-accent) 10%, white);
    border-radius: 6px;
    flex-shrink: 0;
    line-height: 1;
}

.tc-day-name {
    font-size: 0.68em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--tc-accent);
}

.tc-day-num {
    font-size: 1.6em;
    font-weight: 800;
    color: var(--tc-accent);
    line-height: 1.1;
}

/* ── Card body ─────────────────────────────────────── */
.tc-card-body {
    flex: 1;
    min-width: 0;
}

.tc-card-title {
    display: block;
    font-weight: 600;
    font-size: 1em;
    color: var(--tc-text);
    margin-bottom: 0.3em;
    white-space: normal;
    word-break: break-word;
}
/* ── Meta list (time, location, desc) ──────────────── */
.tc-meta {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2em 1.1em;
}

.tc-meta li {
    display: flex;
    align-items: center;
    gap: 0.3em;
    font-size: 0.82em;
    color: var(--tc-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.tc-meta li svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.tc-location {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tc-desc {
    white-space: normal !important;
    max-width: 100%;
    color: #555 !important;
    font-style: italic;
}

.tc-more-link {
    display: inline-block;
    margin-top: 0.4em;
    font-size: 0.8em;
    color: var(--tc-accent);
    text-decoration: none;
    font-weight: 500;
}
.tc-more-link:hover { text-decoration: underline; }

/* ── Compact layout ────────────────────────────────── */
.tc-compact {
    list-style: none;
    margin: 0;
    padding: 0;
    background: var(--tc-bg);
    border-radius: var(--tc-radius);
    border: var(--tc-card-border);
}

.tc-compact-item {
    display: grid;
    grid-template-columns: 80px 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.75em;
    row-gap: 0;
    padding: 0.6em 0;
    border-bottom: 1px solid var(--tc-border-color);
    align-items: start;
}

.tc-compact-item:last-child { border-bottom: none; }

.tc-compact-date {
    grid-row: 1 / 3;
    font-size: 0.75em;
    font-weight: 700;
    color: var(--tc-accent);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding-top: 2px;
    line-height: 1.2;
}

.tc-compact-title {
    font-size: 0.9em;
    font-weight: 600;
    color: var(--tc-text);
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
}
.tc-compact-time,
.tc-compact-loc {
    font-size: 0.78em;
    color: var(--tc-text-muted);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Subscribe footer link ─────────────────────────── */
.tc-subscribe {
    display: flex;
    justify-content: flex-end;
    margin: 0.5em 0 0;
    font-size: 0.78em;
}

/* ── Full calendar page link ───────────────────────── */
.tc-calendar-link {
    display: flex;
    justify-content: flex-end;
    margin: 0.3em 0 0;
    font-size: 0.78em;
}

.tc-calendar-link a,
.tc-subscribe a {
    color: var(--tc-accent);
    text-decoration: none;
    font-weight: 600;
}

.tc-calendar-link a:hover,
.tc-subscribe a:hover {
    text-decoration: underline;
}

/* Suppress Menu Icons plugin from adding icons to our links */
.trinity-calendar a .menu-icon,
.trinity-calendar a img.menu-icon,
.tc-subscribe a .menu-icon,
.tc-calendar-link a .menu-icon {
    display: none !important;
}

/* ── Reduce bottom margin so widget spacing is tighter ── */
.trinity-calendar {
    margin-bottom: 10px !important;
}

.tc-subscribe a {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    color: var(--tc-text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.tc-subscribe a:hover {
    color: var(--tc-accent);
}

.tc-view-all {
    margin: 0.6em 0 0;
    text-align: center;
    font-size: 0.82em;
    border-top: 1px solid var(--tc-border-color);
    padding-top: 0.7em;
}

.tc-view-all a {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    color: var(--tc-accent);
    text-decoration: none;
    font-weight: 600;
    transition: opacity 0.15s;
}

.tc-view-all a:hover {
    opacity: 0.75;
    text-decoration: underline;
}

/* ── Admin error (only visible to admins) ──────────── */
.tc-admin-error {
    background: #fff0f0;
    border: 1px solid #ffb3b3;
    border-left: 4px solid #c00;
    padding: 0.75em 1em;
    border-radius: 4px;
    font-size: 0.9em;
    color: #c00;
}

/* ── Sidebar widget overrides ──────────────────────── */
.widget .trinity-calendar {
    max-width: 100%;
}

.widget .tc-card {
    padding: 0.65em 0.75em;
}

.widget .tc-date-badge {
    min-width: 40px;
    width: 40px;
    height: 44px;
}

.widget .tc-day-num {
    font-size: 1.35em;
}

.widget .tc-card-title {
    font-size: 0.88em;
}

/* ── Mobile ────────────────────────────────────────── */
@media (max-width: 540px) {
    .tc-card {
        gap: 0.75em;
        padding: 0.75em;
    }

    .tc-location {
        max-width: 160px;
    }

    .tc-subscribe {
        text-align: center;
    }

    .tc-compact-item {
        grid-template-columns: 70px 1fr;
    }
}

/* ── color-mix() fallback for older browsers ────────── */
@supports not (color: color-mix(in srgb, red 10%, white)) {
    .tc-date-badge {
        background: #f3ebfa;
    }
}

/* =====================================================
   Trinity Calendar — Modal styles (v2.3.0)
   ===================================================== */

/* ── Overlay backdrop ──────────────────────────────── */
.tc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: tc-fade-in 0.15s ease;
    pointer-events: auto;
}

/* Use both [hidden] attribute AND .tc-hidden class for maximum compatibility */
.tc-modal-overlay[hidden],
.tc-modal-overlay.tc-hidden {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

@keyframes tc-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Prevent body scroll when modal open ──────────── */
body.tc-modal-open {
    overflow: hidden;
}

/* ── Modal box ─────────────────────────────────────── */
.tc-modal {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 460px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: tc-slide-up 0.2s ease;
}

@keyframes tc-slide-up {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* ── Close button ──────────────────────────────────── */
.tc-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255,255,255,0.25);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    z-index: 2;
    transition: background 0.15s;
}

.tc-modal-close:hover,
.tc-modal-close:focus {
    background: rgba(255,255,255,0.4);
    outline: 2px solid #fff;
}

/* ── Date banner (top colored strip) ──────────────── */
.tc-modal-date-banner {
    background: var(--tc-accent);
    color: #fff;
    padding: 1.25rem 1.5rem 1rem;
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    border-radius: 12px 12px 0 0;
}

.tc-modal-day-name {
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
}

.tc-modal-day-num {
    font-size: 2.6em;
    font-weight: 800;
    line-height: 1;
}

.tc-modal-month {
    font-size: 1em;
    font-weight: 500;
    opacity: 0.85;
}

/* ── Modal body ─────────────────────────────────────── */
.tc-modal-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.tc-modal-title {
    font-size: 1.2em;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 0.85rem;
    line-height: 1.3;
}

/* ── Meta list ─────────────────────────────────────── */
.tc-modal-meta {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tc-modal-meta li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9em;
    color: #444;
    line-height: 1.4;
}

.tc-modal-meta li svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--tc-accent);
}

/* ── Description ────────────────────────────────────── */
.tc-modal-desc {
    font-size: 0.9em;
    color: #555;
    line-height: 1.65;
    margin: 0 0 1.25rem;
    padding: 0.85rem 1rem;
    background: #f8f8f8;
    border-left: 3px solid var(--tc-accent);
    border-radius: 0 4px 4px 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ── Action buttons ─────────────────────────────────── */
.tc-modal-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.tc-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55em 1.1em;
    border-radius: 6px;
    font-size: 0.875em;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.15s, transform 0.1s;
    cursor: pointer;
}

.tc-modal-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.tc-modal-btn-primary {
    background: var(--tc-accent);
    color: #fff;
}

.tc-modal-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

/* ── Card clickability hints ───────────────────────── */
.tc-card {
    cursor: pointer;
}

.tc-card-hint {
    display: block;
    font-size: 0.72em;
    color: var(--tc-accent);
    opacity: 0.7;
    margin-top: 0.35em;
    font-style: italic;
    transition: opacity 0.15s;
}

.tc-card:hover .tc-card-hint,
.tc-card:focus .tc-card-hint {
    opacity: 1;
}

.tc-card:focus {
    outline: 2px solid var(--tc-accent);
    outline-offset: 2px;
}

.tc-compact-item {
    cursor: pointer;
}

.tc-compact-item:hover .tc-compact-title {
    color: var(--tc-accent);
    text-decoration: underline;
}

.tc-compact-item:focus {
    outline: 2px solid var(--tc-accent);
    outline-offset: 2px;
}

/* ── Mobile modal ───────────────────────────────────── */
@media (max-width: 540px) {
    .tc-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .tc-modal {
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
        max-width: 100%;
        animation: tc-slide-up-mobile 0.25s ease;
    }

    @keyframes tc-slide-up-mobile {
        from { transform: translateY(100%); }
        to   { transform: translateY(0); }
    }
}

/* =====================================================
   Trinity Calendar — Month Grid (v2.4.0)
   ===================================================== */

.tc-month-wrap {
    width: 100%;
    font-family: var(--tc-font);
}

.tc-style-month {
    max-width: 100% !important;
    width: 100%;
}

/* ── Header ────────────────────────────────────────── */
.tc-month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75em;
}

.tc-month-label {
    font-size: 1.1em;
    font-weight: 700;
    color: var(--tc-accent);
    letter-spacing: -0.01em;
}

.tc-month-nav {
    background: none;
    border: 1px solid var(--tc-border-color);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--tc-accent);
    transition: background 0.15s, color 0.15s;
}

.tc-month-nav:hover {
    background: var(--tc-accent);
    color: #fff;
    border-color: var(--tc-accent);
}

/* ── 7-column grid ─────────────────────────────────── */
.tc-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-top: 1px solid var(--tc-border-color);
    border-left: 1px solid var(--tc-border-color);
}

/* ── Day-of-week headers ───────────────────────────── */
.tc-month-dow {
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--tc-text-muted);
    text-align: center;
    padding: 0.4em 0;
    background: #fafafa;
    border-right: 1px solid var(--tc-border-color);
    border-bottom: 1px solid var(--tc-border-color);
}

/* ── Day cells ─────────────────────────────────────── */
.tc-month-cell {
    border-right: 1px solid var(--tc-border-color);
    border-bottom: 1px solid var(--tc-border-color);
    padding: 0.3em 0.35em 0.4em;
    min-height: 100px;
    vertical-align: top;
    position: relative;
    background: var(--tc-bg);
    transition: background 0.1s;
}

.tc-month-cell-empty {
    background: #fafafa;
    min-height: 80px;
}

.tc-month-today {
    background: color-mix(in srgb, var(--tc-accent) 6%, white) !important;
}

@supports not (color: color-mix(in srgb, red 6%, white)) {
    .tc-month-today { background: #f5f0ff !important; }
}

/* ── Day number ────────────────────────────────────── */
.tc-month-day-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 0.78em;
    font-weight: 600;
    color: var(--tc-text-muted);
    border-radius: 50%;
    margin-bottom: 2px;
}

.tc-month-today .tc-month-day-num {
    background: var(--tc-accent);
    color: #fff;
    font-weight: 700;
}

/* ── Event pill ────────────────────────────────────── */
.tc-month-event {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--tc-accent);
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.7em;
    font-weight: 500;
    margin-bottom: 2px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.6;
    transition: opacity 0.15s, transform 0.1s;
}

.tc-month-event:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

.tc-month-event:focus {
    outline: 2px solid var(--tc-accent);
    outline-offset: 1px;
}

.tc-month-more {
    display: block;
    font-size: 0.65em;
    color: var(--tc-text-muted);
    padding: 1px 3px;
    font-style: italic;
}

/* ── Mobile: compress the grid ─────────────────────── */
@media (max-width: 540px) {
    .tc-month-cell {
        min-height: 52px;
        padding: 0.2em 0.2em 0.3em;
    }

    .tc-month-day-num {
        width: 20px;
        height: 20px;
        font-size: 0.7em;
    }

    .tc-month-event {
        font-size: 0.6em;
        padding: 1px 3px;
    }

    .tc-month-dow {
        font-size: 0.62em;
    }
}
