/* Shared Grid / List / Calendar events viewer */

.ev-viewer {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    padding: 1rem 1.25rem 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.06);
}

.ev-viewer-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.ev-viewer-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.ev-view-toggle {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.ev-view-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    min-height: 2.25rem;
}

.ev-view-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.ev-view-btn.active {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.ev-view-btn:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.ev-panel[hidden] {
    display: none !important;
}

.ev-status-msg {
    text-align: center;
    padding: 2rem 1rem;
    color: #64748b;
}

.ev-status-msg.error {
    color: #ef4444;
    background: #fef2f2;
    border-radius: 8px;
    border: 1px solid #fecaca;
}

.ev-retry-btn {
    margin-top: 0.75rem;
}

/* Calendar layout */
.ev-cal-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.ev-cal-month-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1e293b;
    min-width: 10rem;
    text-align: center;
}

.ev-cal-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.ev-cal-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 900px) {
    .ev-cal-body.has-agenda {
        grid-template-columns: minmax(0, 1.6fr) minmax(220px, 1fr);
    }
}

.ev-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    background: #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.ev-day-header {
    background: #059669;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    padding: 0.45rem 0.15rem;
}

.ev-day {
    background: #fff;
    min-height: 64px;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    border: none;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.ev-day:hover {
    background: #f8fafc;
}

.ev-day:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
    z-index: 1;
}

.ev-day.other-month {
    background: #f8fafc;
    color: #94a3b8;
}

.ev-day.today {
    box-shadow: inset 0 0 0 2px #2563eb;
}

.ev-day-number {
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
}

.ev-day.other-month .ev-day-number {
    color: #94a3b8;
}

.ev-chip {
    font-size: 0.65rem;
    line-height: 1.25;
    padding: 0.15rem 0.3rem;
    border-radius: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-left: 3px solid transparent;
}

.ev-chip-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ev-chip-status {
    display: block;
    font-weight: 600;
    text-transform: capitalize;
}

.ev-chip.status-published {
    background: #d1fae5;
    color: #065f46;
    border-left-color: #059669;
}

.ev-chip.status-draft {
    background: #fff;
    color: #065f46;
    border: 1px dashed #059669;
    border-left: 3px dashed #059669;
}

.ev-chip.status-closed {
    background: #f1f5f9;
    color: #64748b;
    border-left-color: #cbd5e1;
}

.ev-chip.status-completed {
    background: #f8fafc;
    color: #94a3b8;
    border-left-color: #e2e8f0;
}

.ev-day-more {
    font-size: 0.65rem;
    color: #64748b;
    font-weight: 500;
}

@media (max-width: 899px) {
    .ev-day {
        min-height: 52px;
        padding: 0.25rem;
    }

    .ev-chip .ev-chip-title {
        display: none;
    }

    .ev-cal-agenda {
        display: none !important;
    }
}

.ev-cal-agenda {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem;
    max-height: 28rem;
    overflow-y: auto;
    background: #f8fafc;
}

.ev-cal-agenda h4 {
    margin: 0 0 0.75rem;
    font-size: 0.9rem;
    color: #1e293b;
}

.ev-agenda-item {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    padding: 0.5rem 0.6rem;
    margin-bottom: 0.4rem;
    border-radius: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    text-decoration: none;
    color: inherit;
}

.ev-agenda-item:hover {
    border-color: #2563eb;
}

.ev-agenda-body {
    min-width: 0;
    flex: 1;
}

.ev-agenda-item .ev-agenda-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1e293b;
    line-height: 1.35;
}

.ev-agenda-item .ev-agenda-meta {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.15rem;
}

.ev-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #64748b;
}

.ev-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.ev-legend-swatch {
    width: 0.85rem;
    height: 0.85rem;
    border-radius: 3px;
}

.ev-legend-swatch.published {
    background: #d1fae5;
    border-left: 3px solid #059669;
}

.ev-legend-swatch.draft {
    background: #fff;
    border: 1px dashed #059669;
}

.ev-legend-swatch.closed {
    background: #f1f5f9;
}

.ev-legend-swatch.completed {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

/* Day popup */
.ev-thumb {
    flex-shrink: 0;
    width: 72px;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    overflow: hidden;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ev-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ev-thumb-placeholder {
    color: #94a3b8;
    font-size: 0.85rem;
}

.ev-day-popup {
    position: fixed;
    z-index: 1200;
    background: #fff;
    color: #1e293b;
    padding: 1rem;
    border-radius: 12px;
    max-width: min(360px, calc(100vw - 24px));
    max-height: min(70vh, 420px);
    overflow-y: auto;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
}

.ev-day-popup-card {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.85rem;
    padding: 0.5rem;
    margin-left: -0.5rem;
    margin-right: -0.5rem;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
}

.ev-day-popup-card:hover {
    background: #f8fafc;
}

.ev-day-popup-card:last-child {
    margin-bottom: 0;
}

.ev-day-popup-card .ev-thumb {
    width: 96px;
}

.ev-day-popup-body {
    min-width: 0;
    flex: 1;
}

.ev-day-popup-card h4 {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    color: #1e293b;
}

.ev-day-popup-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.ev-status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
    margin-left: 0.35rem;
    vertical-align: middle;
}

.ev-status-badge.published {
    background: #22c55e;
    color: #fff;
}

.ev-status-badge.draft {
    background: #f59e0b;
    color: #fff;
}

.ev-status-badge.closed {
    background: #fef3c7;
    color: #92400e;
}

.ev-status-badge.completed {
    background: #f1f5f9;
    color: #475569;
}

/* List / grid cards inside viewer */
.ev-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ev-list-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    background: #f8fafc;
}

.ev-list-item .ev-thumb {
    width: 96px;
}

.ev-list-body {
    min-width: 0;
    flex: 1;
}

.ev-list-item a {
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
}

.ev-list-item a:hover {
    text-decoration: underline;
}

.ev-list-meta {
    font-size: 0.8125rem;
    color: #64748b;
}

.ev-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.ev-card {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem;
    background: #fff;
}

.ev-card-image {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #e2e8f0;
    margin-bottom: 0.75rem;
}

.ev-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ev-card-image-placeholder {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 1.5rem;
}

.ev-card h3 {
    margin: 0 0 0.5rem;
    font-size: 1.05rem;
}

.ev-card h3 a {
    color: #1e293b;
    text-decoration: none;
}

.ev-card h3 a:hover {
    color: #2563eb;
}

.ev-card-meta {
    font-size: 0.85rem;
    color: #64748b;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ev-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.ev-subscribe {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.ev-subscribe-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}
