/* Мероприятия (public/events.php, elements/events/*) */

.ev {
    --ev-bg: var(--background-color, #0d0d11);
    --ev-card: var(--card-bg, #141419);
    --ev-border: var(--border-color, #22222b);
    --ev-soft: var(--hover-bg-color, #1c1c24);
    --ev-text: var(--text-color, #fff);
    --ev-muted: var(--text-muted, #8b8b98);
    --ev-accent: var(--primary-color, #6a5aff);
    --ev-accent-soft: color-mix(in srgb, var(--ev-accent) 14%, transparent);
    --ev-ok: var(--success-color, #28c76f);
    --ev-warn: #f5a524;
    --ev-bad: var(--error-color, #ea5455);
    --cat: var(--ev-accent);

    max-width: var(--page-max);
    margin: 0 auto;
    padding: 26px var(--page-pad) 44px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: var(--ev-text);
}

.ev h1, .ev h2, .ev h3 { font-weight: normal; margin: 0; }
.ev-muted { color: var(--ev-muted); font-size: 13px; margin: 0; }
.ev :is(a, button, input, select, textarea):focus-visible { outline: 2px solid var(--ev-accent); outline-offset: 2px; }
.ev-card { border-radius: 18px; border: 1px solid var(--ev-border); background: var(--ev-card); padding: 18px 20px; }

/* Кнопки */
.ev-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 15px; border-radius: 10px; border: 1px solid var(--ev-border);
    background: var(--ev-soft); color: var(--ev-text); font: inherit; font-size: 14px;
    cursor: pointer; text-decoration: none; white-space: nowrap;
}
.ev-btn:hover { border-color: var(--ev-accent); }
.ev-btn.primary { background: var(--ev-accent); border-color: var(--ev-accent); color: #fff; }
.ev-btn.primary:hover { filter: brightness(1.08); }
.ev-btn.danger { color: var(--ev-bad); }
.ev-btn.danger:hover { border-color: var(--ev-bad); }
.ev-btn.is-going { background: color-mix(in srgb, var(--ev-ok) 15%, transparent); border-color: transparent; color: var(--ev-ok); }
.ev-btn.is-going:hover { background: color-mix(in srgb, var(--ev-bad) 12%, transparent); color: var(--ev-bad); }
.ev-btn.is-going:hover span::after { content: ' · отменить'; }
.ev-icon-btn { width: 34px; height: 34px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; color: var(--ev-muted); text-decoration: none; }
.ev-icon-btn:hover { background: var(--ev-soft); color: var(--ev-text); }
.ev-link { font-size: 13px; color: var(--ev-accent); text-decoration: none; }
.ev-rsvp-form, .ev-inline { margin: 0; display: inline-flex; gap: 8px; }

.ev-flash { padding: 11px 14px; border-radius: 12px; background: color-mix(in srgb, var(--ev-ok) 13%, transparent); color: var(--ev-ok); font-size: 14px; }
.ev-flash.is-bad { background: color-mix(in srgb, var(--ev-bad) 13%, transparent); color: var(--ev-bad); }
.ev-flash.is-warn { background: color-mix(in srgb, var(--ev-warn) 14%, transparent); color: var(--ev-warn); }

/* Шапка и фильтры */
.ev-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ev-head h1 { font-size: 30px; }
.ev-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ev-tabs { display: flex; padding: 3px; border-radius: 11px; border: 1px solid var(--ev-border); background: var(--ev-card); }
.ev-tabs a { padding: 6px 14px; border-radius: 8px; font-size: 14px; color: var(--ev-muted); text-decoration: none; white-space: nowrap; }
.ev-tabs a:hover { color: var(--ev-text); }
.ev-tabs a.is-on { background: var(--ev-accent); color: #fff; }
.ev-cats { display: flex; gap: 6px; flex-wrap: wrap; }
.ev-cats a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 9px; border: 1px solid var(--ev-border); color: var(--ev-muted); font-size: 13px; text-decoration: none; }
.ev-cats a i { color: var(--cat); font-size: 11px; }
.ev-cats a.is-on { border-color: var(--cat); color: var(--ev-text); background: color-mix(in srgb, var(--cat) 12%, transparent); }

/* Метки */
.ev-when { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 12px; background: var(--ev-soft); color: var(--ev-muted); white-space: nowrap; }
.ev-when-live { background: color-mix(in srgb, var(--ev-bad) 15%, transparent); color: var(--ev-bad); }
.ev-when-live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin: auto 6px auto 0; animation: evPulse 1.4s ease-in-out infinite; }
.ev-when-soon, .ev-when-today { background: color-mix(in srgb, var(--ev-warn) 14%, transparent); color: var(--ev-warn); }
.ev-when-future { background: var(--ev-accent-soft); color: var(--ev-accent); }
@keyframes evPulse { 50% { opacity: 0.35; } }
.ev-cat { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ev-muted); }
.ev-cat i { color: var(--cat); }
.ev-pending-tag { font-size: 12px; color: var(--ev-warn); }
.ev-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--ev-muted); }
.ev-meta span { display: inline-flex; align-items: center; gap: 6px; }

/* Ждут одобрения */
.ev-pending { border-color: color-mix(in srgb, var(--ev-warn) 40%, var(--ev-border)); display: flex; flex-direction: column; gap: 10px; }
.ev-pending h2 { font-size: 16px; color: var(--ev-warn); }
.ev-pending-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--ev-soft); flex-wrap: wrap; }
.ev-pending-main { flex: 1; min-width: 200px; color: inherit; text-decoration: none; }
.ev-pending-main b { display: block; font-weight: normal; }
.ev-pending-main small { font-size: 12px; color: var(--ev-muted); }

/* Ближайшее */
.ev-feature { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); overflow: hidden; border-radius: 20px; border: 1px solid color-mix(in srgb, var(--cat) 35%, var(--ev-border)); background: linear-gradient(135deg, color-mix(in srgb, var(--cat) 16%, var(--ev-card)), var(--ev-card) 60%); }
.ev-feature:has(.ev-feature-img) { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.ev-feature-img { width: 100%; height: 100%; max-height: 300px; object-fit: cover; }
.ev-feature-body { padding: 26px 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.ev-feature h2 { font-size: 28px; line-height: 1.25; }
.ev-feature h2 a { color: inherit; text-decoration: none; }
.ev-feature h2 a:hover { color: var(--ev-accent); }
.ev-feature-act { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* Список */
.ev-list { display: flex; flex-direction: column; gap: 8px; }
.ev-day { font-size: 14px; color: var(--ev-muted); margin: 10px 0 2px; }
.ev-day:first-child { margin-top: 0; }
.ev-sub { font-size: 16px; color: var(--ev-muted); }
.ev-row { position: relative; display: flex; align-items: center; gap: 16px; padding: 12px 16px 12px 12px; border-radius: 14px; border: 1px solid var(--ev-border); background: var(--ev-card); }
.ev-row:hover { border-color: color-mix(in srgb, var(--cat) 55%, var(--ev-border)); }
.ev-row.is-live { border-color: color-mix(in srgb, var(--ev-bad) 45%, var(--ev-border)); }
.ev-row.is-past { opacity: 0.75; }
.ev-row-link { position: absolute; inset: 0; border-radius: inherit; }
.ev-date { width: 54px; flex-shrink: 0; padding: 6px 0; border-radius: 12px; display: flex; flex-direction: column; align-items: center; background: color-mix(in srgb, var(--cat) 14%, transparent); border-left: 3px solid var(--cat); }
.ev-date b { font-weight: normal; font-size: 22px; line-height: 1.1; }
.ev-date span { font-size: 11px; color: var(--ev-muted); }
.ev-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.ev-row-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ev-row h3 { font-size: 17px; line-height: 1.3; overflow-wrap: break-word; }
.ev-row-act { position: relative; z-index: 1; flex-shrink: 0; }

.ev-empty { padding: 50px 20px; border-radius: 16px; border: 1px dashed var(--ev-border); display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--ev-muted); text-align: center; }
.ev-empty i { font-size: 32px; opacity: 0.6; }
.ev-empty p { margin: 0; }

/* Календарь */
.ev-cal { padding: 16px; }
.ev-cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ev-cal-head h2 { font-size: 18px; min-width: 150px; text-align: center; }
.ev-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.ev-cal-wd { padding: 4px 6px; font-size: 12px; color: var(--ev-muted); }
.ev-cal-cell { min-height: 92px; padding: 6px; border-radius: 10px; background: var(--ev-soft); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ev-cal-cell.is-empty { background: none; }
.ev-cal-cell.is-past { opacity: 0.55; }
.ev-cal-cell.is-today { box-shadow: inset 0 0 0 2px var(--ev-accent); }
.ev-cal-num { font-size: 12px; color: var(--ev-muted); }
.is-today .ev-cal-num { color: var(--ev-accent); }
.ev-chip { display: block; padding: 3px 6px; border-radius: 6px; border-left: 3px solid var(--cat); background: color-mix(in srgb, var(--cat) 14%, var(--ev-card)); color: var(--ev-text); font-size: 11px; line-height: 1.3; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-chip b { font-weight: normal; color: var(--ev-muted); }
.ev-chip.is-mine { box-shadow: inset 0 0 0 1px var(--ev-ok); }
.ev-chip:hover { filter: brightness(1.15); }

/* Страница события */
.ev-article { width: 100%; max-width: 860px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.ev-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ev-muted); text-decoration: none; }
.ev-back:hover { color: var(--ev-text); }
.ev-art-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ev-article h1 { font-size: 36px; line-height: 1.2; overflow-wrap: break-word; }
.ev-facts { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; border-radius: 14px; overflow: hidden; background: var(--ev-border); border: 1px solid var(--ev-border); }
.ev-facts > div { padding: 12px 14px; background: var(--ev-card); min-width: 0; }
.ev-facts dt { font-size: 12px; color: var(--ev-muted); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.ev-facts dt i { color: var(--cat); }
.ev-facts dd { margin: 0; font-size: 14px; overflow-wrap: break-word; }
.ev-facts a { color: var(--ev-accent); text-decoration: none; }
.ev-cover { width: 100%; max-height: 380px; object-fit: cover; border-radius: 18px; border: 1px solid var(--ev-border); }
.ev-desc { font-size: 16px; line-height: 1.7; color: color-mix(in srgb, var(--ev-text) 85%, var(--ev-muted)); overflow-wrap: break-word; }
.ev-going { display: flex; flex-direction: column; gap: 12px; }
.ev-going-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ev-going h2 { font-size: 18px; }
.ev-people { display: flex; flex-wrap: wrap; gap: 6px; }
.ev-person { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; border-radius: 9px; background: var(--ev-soft); color: var(--ev-text); font-size: 13px; text-decoration: none; }
.ev-person img { width: 26px; height: 26px; border-radius: 7px; image-rendering: pixelated; }
.ev-manage { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ev-reject input { min-width: 220px; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--ev-border); background: var(--ev-bg); color: var(--ev-text); font: inherit; font-size: 14px; }
.ev-wide { flex-basis: 100%; }

/* Форма */
.ev-form-wrap { width: 100%; max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.ev-form-wrap h1 { font-size: 28px; }
.ev-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0; }
.ev-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ev-field > span:first-child { font-size: 13px; color: var(--ev-muted); }
.ev-field small { opacity: 0.8; }
.ev-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ev-field input, .ev-field textarea, .ev-select select {
    width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px;
    border: 1px solid var(--ev-border); background: var(--ev-bg); color: var(--ev-text); font: inherit; font-size: 14px;
}
.ev-field textarea { resize: vertical; line-height: 1.5; }
.ev-field :is(input, textarea, select):focus { outline: 0; border-color: var(--ev-accent); }
.ev-field.has-err :is(input, textarea, select) { border-color: var(--ev-bad); }
.ev-err { font-size: 12px; color: var(--ev-bad); }
.ev-select { position: relative; display: block; }
.ev-select select { appearance: none; padding-right: 32px; cursor: pointer; }
.ev-select select option { background: var(--ev-card); color: var(--ev-text); }
.ev-select i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 10px; color: var(--ev-muted); pointer-events: none; }
.ev-form .ev-wide { grid-column: 1 / -1; }
.ev-form-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 1100px) {
    .ev-facts { grid-template-columns: 1fr 1fr; }
    .ev-cal-cell { min-height: 76px; }
}

@media (max-width: 760px) {
    .ev { padding: 16px var(--page-pad) 30px; gap: 12px; }
    .ev-head h1, .ev-form-wrap h1 { font-size: 24px; }
    .ev-article h1 { font-size: 26px; }
    .ev-tabs { width: 100%; overflow-x: auto; scrollbar-width: none; }
    .ev-tabs a { flex: 1; text-align: center; padding: 7px 8px; }
    .ev-feature, .ev-feature:has(.ev-feature-img) { grid-template-columns: minmax(0, 1fr); }
    .ev-feature-img { max-height: 180px; }
    .ev-feature-body { padding: 18px; }
    .ev-feature h2 { font-size: 22px; }
    .ev-row { flex-wrap: wrap; gap: 12px; padding: 12px; }
    .ev-row-main { flex-basis: calc(100% - 70px); }
    .ev-row-act { width: 100%; }
    .ev-row-act .ev-rsvp-form, .ev-row-act .ev-btn { width: 100%; }
    /* В календаре на телефоне вместо названий — точки, список событий месяца ниже */
    .ev-cal { padding: 10px; }
    .ev-cal-cell { min-height: 46px; padding: 4px; align-items: center; }
    .ev-chip { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%; background: var(--cat); font-size: 0; }
    .ev-chip.is-mine { box-shadow: 0 0 0 2px var(--ev-ok); }
    .ev-cal-cell.has-events { flex-direction: column; }
    .ev-form { grid-template-columns: 1fr; }
    .ev-reject input { min-width: 0; flex: 1; }
    .ev-reject { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .ev-when-live::before { animation: none; }
}
