/* N9 Calendar — Frontend v1.5.0 */

/* ── Wrapper — no border, no accent bar ─────────────────────────────── */
.n9oc-wrap {
    position: relative;
    width: var(--n9oc-width, 100%);
    max-width: var(--n9oc-max-width, none);
    background: var(--n9oc-container-bg, transparent);
}
.n9oc-align-center { margin-left: auto; margin-right: auto; }
.n9oc-align-right  { margin-left: auto; }

/* Chrome — user can opt into border via settings; default is none */
.n9oc-chrome {
    overflow: hidden;
    background: var(--n9oc-bg, #fff);
    border-radius: var(--n9oc-border-radius, 8px);
    /* Only render border when width > 0 — shorthand avoids ghost hairlines */
    border: var(--n9oc-border-width, 0px) solid var(--n9oc-border-color, transparent);
}
.n9oc-shadow .n9oc-chrome {
    box-shadow: 0 4px 24px var(--n9oc-shadow-color, rgba(0,0,0,.10));
}

/* Agenda pane never gets a border — it manages its own internal layout */
.n9oc-agenda-pane {
    border: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* ── Optional header (user-enabled) ─────────────────────────────────── */
.n9oc-header {
    display: flex; align-items: center; gap: 10px;
    background: var(--n9oc-header-bg, var(--n9oc-brand, #0078d4));
    color: var(--n9oc-header-color, #fff);
    font-size: var(--n9oc-header-font-size, 16px);
    padding: var(--n9oc-header-padding, 12px) 16px;
    font-weight: 600;
}

/* ── Loader ──────────────────────────────────────────────────────────── */
.n9oc-frame-wrap { position: relative; width: 100%; }
.n9oc-loader {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    background: var(--n9oc-loader-bg, #f5f5f5); z-index: 2; transition: opacity .3s;
}
.n9oc-loaded .n9oc-loader { opacity: 0; pointer-events: none; }
.n9oc-spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(0,0,0,.08);
    border-top-color: var(--n9oc-loader-color, var(--n9oc-brand, #0078d4));
    border-radius: 50%; animation: n9oc-spin .8s linear infinite;
}
@keyframes n9oc-spin { to { transform: rotate(360deg); } }
.n9oc-loader-text { font-size: 13px; color: #6b7280; margin: 0; }

/* ── iframe ──────────────────────────────────────────────────────────── */
.n9oc-frame {
    display: block; width: 100%;
    height: var(--n9oc-height, 600px);
    min-height: var(--n9oc-min-height, 0px);
    background: var(--n9oc-bg, #fff); border: none;
}
.n9oc-wrap[style*="--n9oc-aspect-ratio"] .n9oc-frame-wrap { aspect-ratio: var(--n9oc-aspect-ratio); }
.n9oc-wrap[style*="--n9oc-aspect-ratio"] .n9oc-frame { height: 100%; }
.n9oc-responsive { width: 100%; max-width: var(--n9oc-max-width, 100%); }
@media (max-width: 768px) { .n9oc-hide-tablet { display: none !important; } }
@media (max-width: 480px) {
    .n9oc-hide-mobile { display: none !important; }
    .n9oc-frame { height: var(--n9oc-mobile-height, 400px) !important; }
}

/* ════════════════════════════════════════════════════════════════════
   AGENDA
════════════════════════════════════════════════════════════════════ */
.n9oc-agenda-pane {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    color: #333;
    background: var(--n9oc-bg, #fff);
    border: none !important;
    box-shadow: none !important;
}
/* Kill any outer border on the wrap when agenda is showing */
.n9oc-wrap:has(.n9oc-agenda-pane:not([style*="display:none"])):not([style*="display:none"]) {
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}
/* Belt-and-suspenders: the wrap div itself should never show a border */
.n9oc-wrap { border: none !important; }

/* ── Search bar — padded, prominent, above toolbar ───────────────────── */
.n9oc-search-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: #fff;
    border-bottom: 2px solid #e8e8e8;
}
.n9oc-search-input {
    flex: 1;
    height: 44px;
    padding: 0 16px;
    font-size: 14px;
    color: #222;
    background: #f7f8fa;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    outline: none;
    min-width: 0;
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.n9oc-search-input::placeholder { color: #9ca3af; }
.n9oc-search-input:focus {
    background: #fff;
    border-color: var(--n9oc-brand, #0078d4);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--n9oc-brand, #0078d4) 14%, transparent);
}
.n9oc-search-btn {
    flex-shrink: 0;
    height: 44px;
    padding: 0 22px;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--n9oc-brand, #0078d4);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: .01em;
    transition: opacity .15s;
}
.n9oc-search-btn:hover { opacity: .88; }

/* Suggestion dropdown */
.n9oc-suggestions {
    position: relative;
    flex: 1;
    min-width: 0;
}
.n9oc-suggestions .n9oc-search-input { width: 100%; }
.n9oc-suggestion-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 100;
    max-height: 280px;
    overflow-y: auto;
    display: none;
}
.n9oc-suggestion-list.visible { display: block; }
.n9oc-suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: #222;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background .1s;
}
.n9oc-suggestion-item:last-child { border-bottom: none; }
.n9oc-suggestion-item:hover,
.n9oc-suggestion-item.is-active { background: color-mix(in srgb, var(--n9oc-brand, #0078d4) 8%, #fff); }
.n9oc-suggestion-item__date {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    flex-shrink: 0;
}
.n9oc-suggestion-item__title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.n9oc-suggestion-item__title em {
    font-style: normal;
    font-weight: 700;
    color: var(--n9oc-brand, #0078d4);
}
.n9oc-suggestion-no-results {
    padding: 14px;
    font-size: 13px;
    color: #888;
    text-align: center;
}

/* Result strip */
.n9oc-result-bar {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 7px 20px;
    background: #f0f6ff;
    border-bottom: 1px solid #dbe9fa;
    font-size: 12px;
    color: #444;
}
.n9oc-result-bar.visible { display: flex; }
.n9oc-result-count { font-weight: 600; color: var(--n9oc-brand, #0078d4); }
.n9oc-result-pill {
    background: var(--n9oc-brand, #0078d4);
    color: #fff;
    border-radius: 10px;
    padding: 1px 9px;
    font-size: 11px; font-weight: 600;
}

/* ── Toolbar ─────────────────────────────────────────────────────────── */
.n9oc-agenda-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 10px 20px;
    background: var(--n9oc-brand, #0078d4); color: #fff;
    flex-wrap: wrap;
}
.n9oc-agenda-nav { display: flex; align-items: center; gap: 8px; }
.n9oc-agenda-nav-btn {
    background: rgba(255,255,255,.15); border: 1.5px solid rgba(255,255,255,.3);
    color: #fff; border-radius: 4px; width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    font-size: 17px; cursor: pointer; padding: 0; transition: background .15s;
}
.n9oc-agenda-nav-btn:hover { background: rgba(255,255,255,.28); }
.n9oc-agenda-range {
    font-size: 13px; font-weight: 600;
    flex: 1; text-align: center; white-space: nowrap;
}
.n9oc-agenda-view-tabs { display: flex; gap: 4px; flex-shrink: 0; }
.n9oc-agenda-tab {
    background: transparent; border: 1.5px solid rgba(255,255,255,.35);
    color: rgba(255,255,255,.8); border-radius: 4px;
    padding: 4px 12px; font-size: 12px; font-weight: 500;
    cursor: pointer; transition: background .15s, color .15s; white-space: nowrap;
}
.n9oc-agenda-tab:hover { border-color: rgba(255,255,255,.65); color: #fff; }
.n9oc-agenda-tab.is-active {
    background: rgba(255,255,255,.2); color: #fff;
    border-color: rgba(255,255,255,.65); font-weight: 700;
}

/* ── Month heading ───────────────────────────────────────────────────── */
.n9oc-month-heading {
    padding: 28px 24px 12px;
    font-size: 18px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
    color: var(--n9oc-brand, #0078d4);
    border-bottom: 2px solid var(--n9oc-brand, #0078d4);
    margin: 0;
}

/* ── Event row ───────────────────────────────────────────────────────── */
.n9oc-event-row {
    display: grid; grid-template-columns: 80px 1px 1fr;
    border-bottom: 1px solid #eaeaea;
    cursor: pointer; transition: background .12s;
}
.n9oc-event-row:hover { background: #f7f9fc; }
.n9oc-event-row:last-child { border-bottom: none; }
.n9oc-event-date {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    padding: 20px 0 20px 24px; flex-shrink: 0;
}
.n9oc-event-date__dow {
    font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: #999; line-height: 1; margin-bottom: 4px;
}
.n9oc-event-date__num { font-size: 30px; font-weight: 300; color: #111; line-height: 1; }
.n9oc-event-date__num.is-today {
    background: var(--n9oc-brand, #0078d4); color: #fff; border-radius: 50%;
    width: 42px; height: 42px; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 20px; margin: 0 auto;
}
.n9oc-event-divider { width: 1px; background: #e0e0e0; margin: 16px 0; }
.n9oc-event-content { padding: 20px 24px; min-width: 0; }
.n9oc-event-content__title {
    font-size: 15px; font-weight: 600; color: var(--n9oc-brand, #0078d4);
    margin: 0 0 5px; line-height: 1.35; display: block;
}
.n9oc-event-row:hover .n9oc-event-content__title { text-decoration: underline; }
.n9oc-event-content__meta {
    font-size: 13px; color: #555;
    display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center;
}
.n9oc-event-content__meta-sep { color: #ccc; }
.n9oc-event-content__meta-loc { color: #888; }
.n9oc-event-content__desc {
    font-size: 13px; color: #666; margin: 5px 0 0; line-height: 1.55;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
/* Inline links inside event content and popover */
.n9oc-inline-link {
    color: var(--n9oc-brand, #0078d4);
    text-decoration: underline;
    text-underline-offset: 2px;
    word-break: break-all;
}
.n9oc-inline-link:hover { opacity: .8; }

/* ── State screens ───────────────────────────────────────────────────── */
.n9oc-agenda-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 48px 24px; gap: 12px; text-align: center;
}
.n9oc-agenda-state__icon { font-size: 44px; line-height: 1; }
.n9oc-agenda-state__msg  { font-size: 15px; font-weight: 600; margin: 0; color: #374151; }
.n9oc-agenda-state__sub  { font-size: 13px; margin: 0; color: #9ca3af; max-width: 360px; }

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .n9oc-search-bar      { padding: 12px 14px; gap: 8px; }
    .n9oc-agenda-toolbar  { padding: 8px 14px; }
    .n9oc-agenda-range    { font-size: 12px; }
    .n9oc-event-row       { grid-template-columns: 60px 1px 1fr; }
    .n9oc-event-date      { padding: 16px 0 16px 14px; }
    .n9oc-event-date__num { font-size: 22px; }
    .n9oc-event-content   { padding: 16px 14px; }
    .n9oc-event-content__title { font-size: 14px; }
    .n9oc-month-heading   { padding: 20px 14px 10px; font-size: 15px; }
}

/* ── Popover ─────────────────────────────────────────────────────────── */
.n9oc-popover-backdrop {
    position: fixed; inset: 0; z-index: 9998;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center; padding: 20px;
    animation: n9oc-fi .15s ease;
}
@keyframes n9oc-fi { from { opacity: 0; } to { opacity: 1; } }
.n9oc-popover {
    background: #fff; border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,.22);
    max-width: 480px; width: 100%; overflow: hidden;
    animation: n9oc-pop .18s cubic-bezier(.34,1.56,.64,1);
}
@keyframes n9oc-pop { from { transform: scale(.92) translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.n9oc-popover__hd {
    background: var(--n9oc-brand, #0078d4); color: #fff;
    padding: 20px 22px 18px;
    display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
}
.n9oc-popover__title { font-size: 16px; font-weight: 700; margin: 0; flex: 1; line-height: 1.3; }
.n9oc-popover__close {
    background: rgba(255,255,255,.15); border: none; color: #fff;
    font-size: 18px; cursor: pointer; padding: 4px 8px; line-height: 1;
    border-radius: 4px; transition: background .12s;
}
.n9oc-popover__close:hover { background: rgba(255,255,255,.3); }
.n9oc-popover__bd { padding: 18px 22px; }
.n9oc-popover-row { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: #374151; margin-bottom: 14px; }
.n9oc-popover-row:last-child { margin-bottom: 0; }
.n9oc-popover-row__icon { font-size: 16px; line-height: 1.4; flex-shrink: 0; }
.n9oc-popover-row__text { flex: 1; line-height: 1.5; }
.n9oc-popover-row__text strong { display: block; margin-bottom: 2px; color: #111; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }

/* ── Subscribe footer ────────────────────────────────────────────────── */
.n9oc-subscribe-footer { border-top: 1px solid #e8e8e8; background: #f9f9f9; }
.n9oc-subscribe-hd {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 24px; cursor: pointer; user-select: none;
}
.n9oc-subscribe-hd:hover .n9oc-subscribe-title { color: var(--n9oc-brand, #0078d4); }
.n9oc-subscribe-title { font-size: 13px; font-weight: 600; color: #444; transition: color .12s; }
.n9oc-subscribe-toggle {
    display: flex; align-items: center;
    color: #bbb; transition: color .15s, transform .2s; flex-shrink: 0;
}
.n9oc-subscribe-hd:hover .n9oc-subscribe-toggle { color: var(--n9oc-brand, #0078d4); }
.n9oc-subscribe-toggle.is-open { transform: rotate(180deg); }
.n9oc-subscribe-links { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 24px 16px; }
.n9oc-subscribe-link {
    display: inline-flex; align-items: center;
    padding: 6px 16px; font-size: 13px; font-weight: 500;
    color: var(--n9oc-brand, #0078d4);
    border: 1.5px solid var(--n9oc-brand, #0078d4);
    border-radius: 4px; text-decoration: none; background: #fff;
    /* Hover: light tint — text stays brand colour, never dark-on-dark */
    transition: background .12s;
    white-space: nowrap;
}
.n9oc-subscribe-link:hover {
    background: color-mix(in srgb, var(--n9oc-brand, #0078d4) 8%, #fff);
}
@media (max-width: 560px) {
    .n9oc-subscribe-hd    { padding: 12px 14px; }
    .n9oc-subscribe-links { padding: 0 14px 14px; gap: 6px; }
    .n9oc-subscribe-link  { width: 100%; justify-content: center; }
}

/* ── No-URL notice ───────────────────────────────────────────────────── */
.n9oc-no-url {
    background: #fff3cd; border: 1px solid #ffc107;
    border-radius: 6px; padding: 12px 16px;
    font-size: 13px; color: #856404;
}
