/* Venue Calendar – Frontend Calendar Grid */

*, *::before, *::after { box-sizing: border-box; }

.vcal-wrap {
    font-family: inherit;
    width: 100%;
    overflow: hidden;
}

/* ── Header ──────────────────────────────────────────────────────────── */

.vcal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
    padding: 0 0 16px 0;
}

.vcal-title,
.vcal-wrap .vcal-title,
.vcal-header .vcal-title {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 400;
    color: #4a4a4a;
    letter-spacing: .01em;
    font-style: normal !important;
}

.vcal-header-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Dropdown picker — matches the screenshot style */
.vcal-month-picker {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.vcal-month-select {
    appearance: auto;
    -webkit-appearance: auto;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: .88rem;
    color: #444;
    cursor: pointer;
    outline: none;
    font-family: inherit;
    min-width: 130px;
    box-shadow: 0 1px 3px rgba(0,0,0,.07);
    transition: border-color .15s;
}
.vcal-month-select:hover { border-color: #aaa; }
.vcal-month-select:focus { border-color: #888; box-shadow: 0 0 0 2px rgba(0,0,0,.08); }

.vcal-select-arrow { display: none; }

/* Arrow buttons — hidden, kept for JS compatibility */
.vcal-nav-arrows { display: none; }
.vcal-nav        { display: none; }

/* ── Grid ────────────────────────────────────────────────────────────── */

.vcal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr)); /* minmax(0) prevents overflow */
    width: 100%;
    border-left: 1px solid #d8d8d8;
    border-top: 1px solid #d8d8d8;
}

.vcal-dow {
    background: #f0f0f0;
    border-right: 1px solid #d8d8d8;
    border-bottom: 1px solid #d8d8d8;
    padding: 8px 4px;
    text-align: center;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: #666;
}

.vcal-cell {
    border-right: 1px solid #d8d8d8;
    border-bottom: 1px solid #d8d8d8;
    padding: 5px 5px 8px;
    min-height: 100px;
    background: #fff;
    position: relative;
    /* critical: cells cannot push past their grid column */
    min-width: 0;
    overflow: hidden;
}

.vcal-cell.vcal-empty { background: #fafafa; }

.vcal-today { background: #2d3748 !important; }
.vcal-today .vcal-day-num { color: #fff; }

.vcal-day-num {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
    text-align: right;
    line-height: 1;
}

/* ── Events ──────────────────────────────────────────────────────────── */

.vcal-events-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.vcal-event {
    background: color-mix(in srgb, var(--ev-color) 15%, #fff);
    border-left: 3px solid var(--ev-color);
    border-radius: 2px;
    padding: 2px 4px 3px;
    cursor: pointer;
    line-height: 1.3;
    transition: opacity .15s;
    /* hard clip to column width — no overflow */
    overflow: hidden;
    min-width: 0;
}
.vcal-event:hover { opacity: .78; }

.vcal-event-time {
    display: block;
    font-size: .63rem;
    font-weight: 700;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vcal-event-title {
    display: block;
    font-size: .68rem;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Legend ──────────────────────────────────────────────────────────── */

.vcal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin-top: 14px;
    padding: 10px 14px;
    background: #f8f8f8;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.vcal-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    color: #444;
}

.vcal-legend-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Modal ───────────────────────────────────────────────────────────── */

.vcal-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 9998;
}

.vcal-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,.22);
    width: min(500px, 92vw);
    max-height: 82vh;
    overflow-y: auto;
}

.vcal-modal-inner { padding: 28px 30px; position: relative; }

.vcal-modal-close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #aaa;
    line-height: 1;
}
.vcal-modal-close:hover { color: #222; }

.vcal-modal-color-bar {
    width: 32px;
    height: 4px;
    border-radius: 2px;
    margin-bottom: 14px;
}

.vcal-modal-body h3 {
    margin: 0 0 12px;
    font-size: 1.2rem;
    line-height: 1.3;
    padding-right: 24px; /* clear the × button */
}

.vcal-modal-meta {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 12px;
}

.vcal-modal-meta-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: .85rem;
    color: #444;
}

.vcal-modal-meta-icon { flex-shrink: 0; font-size: 1rem; }
.vcal-modal-meta-text { flex: 1; }

.vcal-modal-desc {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
    font-size: .88rem;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
}

.vcal-modal-link {
    display: inline-block;
    margin-top: 14px;
    font-size: .82rem;
    color: #2b6cb0;
    text-decoration: none;
}
.vcal-modal-link:hover { text-decoration: underline; }

.vcal-modal-feed-badge {
    display: inline-block;
    margin-top: 14px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
    color: #fff;
}

/* ── Loading state ───────────────────────────────────────────────────── */

.vcal-loading { opacity: .4; pointer-events: none; transition: opacity .2s; }

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .vcal-cell     { min-height: 70px; padding: 3px 2px 5px; }
    .vcal-event-time  { display: none; }
    .vcal-event-title { font-size: .62rem; }
    .vcal-title    { font-size: 1.1rem; }
    .vcal-dow      { font-size: .6rem; padding: 6px 2px; letter-spacing: 0; }
}
