/* Live event page — VK stream + realtime chat.
   Design tokens per CLAUDE.md: brand #c495ff, card #f3e8ff/#e9d5ff, Inter, radius 12px. */

.gg--live-single {
    --gg-brand: #c495ff;
    --gg-card-bg: #f3e8ff;
    --gg-card-border: #e9d5ff;
    --gg-heading: #1e293b;
    --gg-body: #475569;
    --gg-muted: #64748b;
    --gg-placeholder: #94a3b8;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--gg-body);
}

.gg--live-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 3rem;
}

/* ── Hero ─────────────────────────────────────────────── */
.gg--live-hero__inner {
    padding: 1.5rem 0 0.5rem;
}
.gg--live-hero__title {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    line-height: 1.2;
    color: var(--gg-heading);
    margin: 0.75rem 0 0.5rem;
}
.gg--live-hero__lead {
    font-size: 1.05rem;
    color: var(--gg-body);
    margin: 0 0 0.5rem;
    max-width: 720px;
}
.gg--live-hero__starts {
    color: var(--gg-muted);
    font-size: 0.95rem;
}
.gg--live-hero__starts time {
    color: var(--gg-heading);
    font-weight: 600;
}

/* ── Status badge ─────────────────────────────────────── */
.gg--live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--gg-card-bg);
    color: #7a4fc2;
    border: 1px solid var(--gg-card-border);
}
.gg--live-badge__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}
.gg--live-badge--live {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
}
.gg--live-badge--live .gg--live-badge__dot {
    background: #ef4444;
    animation: gg-live-pulse 1.4s ease-in-out infinite;
}
.gg--live-badge--ended {
    background: #f1f5f9;
    color: var(--gg-muted);
    border-color: #e2e8f0;
}
@keyframes gg-live-pulse {
    0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50% { transform: scale(1.15); opacity: 0.7; box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* ── Video ────────────────────────────────────────────── */
.gg--live-video__frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    box-shadow: 0 4px 24px rgba(196, 149, 255, 0.12);
}
.gg--live-video__frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.gg--live-video__fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    background: var(--gg-card-bg);
    border: 1px dashed var(--gg-card-border);
    color: var(--gg-muted);
    text-align: center;
    padding: 1rem;
}

.gg--live-content {
    color: var(--gg-body);
    line-height: 1.65;
}

/* ── Chat ─────────────────────────────────────────────── */
.gg--live-chat {
    border: 1px solid var(--gg-card-border);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 24px rgba(196, 149, 255, 0.12);
    overflow: hidden;
}
.gg--live-chat__label {
    padding: 0.9rem 1.15rem;
    font-weight: 700;
    color: var(--gg-heading);
    border-bottom: 1px solid #f1f5f9;
    background: var(--gg-card-bg);
}
.gg--live-chat__thread {
    max-height: 60vh;
    min-height: 220px;
    overflow-y: auto;
    padding: 1rem 1.15rem;
    scroll-behavior: smooth;
}
.gg--live-chat__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.gg--live-chat__empty {
    color: var(--gg-muted);
    text-align: center;
    padding: 2rem 0;
}
.gg--live-chat__msg {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
}
.gg--live-chat__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: var(--gg-card-bg);
}
.gg--live-chat__bubble {
    position: relative;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    flex: 1;
    min-width: 0;
}
.gg--live-chat__msg--own .gg--live-chat__bubble {
    background: var(--gg-card-bg);
    border-color: var(--gg-card-border);
}
.gg--live-chat__msg--pending {
    opacity: 0.7;
}
.gg--live-chat__head {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
    flex-wrap: wrap;
}
.gg--live-chat__author {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--gg-heading);
}
.gg--live-chat__head time {
    font-size: 0.75rem;
    color: var(--gg-muted);
    font-variant-numeric: tabular-nums;
}
.gg--live-chat__badge {
    font-size: 0.7rem;
    color: #b45309;
    background: #fef3c7;
    border-radius: 6px;
    padding: 0.05rem 0.4rem;
}
.gg--live-chat__text {
    color: var(--gg-body);
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.gg--live-chat__delete {
    position: absolute;
    top: 2px;
    right: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--gg-placeholder);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.15s, color 0.15s;
}
/* On pointers that support hover, reveal on message hover to reduce clutter.
   On touch devices (no hover) the button stays visible so moderation works. */
@media (hover: hover) {
    .gg--live-chat__delete {
        opacity: 0;
    }
    .gg--live-chat__msg:hover .gg--live-chat__delete,
    .gg--live-chat__delete:focus-visible {
        opacity: 1;
    }
}
.gg--live-chat__delete:hover,
.gg--live-chat__delete:focus-visible {
    color: #ef4444;
}

/* ── Form ─────────────────────────────────────────────── */
.gg--live-chat__form {
    padding: 0.9rem 1.15rem 1.15rem;
    border-top: 1px solid #f1f5f9;
}
.gg--live-chat__form-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
.gg--live-chat__input-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
}
.gg--live-chat__input-row textarea {
    flex: 1;
    resize: none;
    min-height: 44px;
    max-height: 140px;
    padding: 0.6rem 0.85rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font: inherit;
    font-size: 0.95rem;
    color: var(--gg-heading);
    line-height: 1.4;
    transition: border-color 0.15s;
}
.gg--live-chat__input-row textarea::placeholder {
    color: var(--gg-placeholder);
}
.gg--live-chat__input-row textarea:focus {
    outline: none;
    border-color: var(--gg-brand);
}
.gg--live-chat__hp {
    position: absolute !important;
    left: -9999px;
    width: 1px;
    height: 1px;
}
.gg--live-chat__submit {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.7rem 1.35rem;
    border: 2px solid var(--gg-brand);
    border-radius: 12px;
    background: var(--gg-brand);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.gg--live-chat__submit:hover:not(:disabled) {
    background: #fff;
    color: var(--gg-brand);
}
.gg--live-chat__submit:disabled {
    opacity: 0.6;
    cursor: default;
}
.gg--live-chat__spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gg-live-spin 0.7s linear infinite;
}
.gg--live-chat__form.is-sending .gg--live-chat__spinner {
    display: inline-block;
}
@keyframes gg-live-spin {
    to { transform: rotate(360deg); }
}
.gg--live-chat__hint {
    margin: 0.6rem 0 0;
    font-size: 0.85rem;
    color: var(--gg-muted);
}
.gg--live-chat__session {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--gg-muted);
}
.gg--live-chat__session-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gg-placeholder);
}
.gg--live-chat__session.is-authenticated .gg--live-chat__session-dot {
    background: #22c55e;
}
.gg--live-chat__error {
    margin: 0.5rem 0 0;
    color: #ef4444;
    font-size: 0.85rem;
}
.gg--live-chat__form--closed {
    opacity: 0.75;
}

/* ── Auth modal ───────────────────────────────────────── */
.gg--live-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.gg--live-auth-modal[hidden] {
    display: none;
}
.gg--live-auth-modal__scrim {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}
.gg--live-auth-modal__panel {
    position: relative;
    background: #fff;
    border-radius: 12px;
    max-width: 420px;
    width: 100%;
    padding: 1.75rem 1.5rem 1.5rem;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.3);
}
.gg--live-auth-modal__panel h2 {
    font-size: 1.25rem;
    color: var(--gg-heading);
    margin: 0 0 0.5rem;
}
.gg--live-auth-modal__panel p {
    color: var(--gg-body);
    font-size: 0.95rem;
    margin: 0 0 1rem;
}
.gg--live-auth-modal__close {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    width: 34px;
    height: 34px;
    border: 0;
    background: transparent;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--gg-muted);
    cursor: pointer;
}
.gg--live-auth-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.gg--live-auth-modal__provider {
    padding: 0.875rem 1.5rem;
    border: 2px solid var(--gg-brand);
    border-radius: 12px;
    background: #fff;
    color: var(--gg-brand);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.gg--live-auth-modal__provider--primary {
    background: var(--gg-brand);
    color: #fff;
}
.gg--live-auth-modal__provider:hover {
    background: #fff;
    color: var(--gg-brand);
}
.gg--live-auth-modal__provider--primary:hover {
    background: var(--gg-card-bg);
}
.gg--live-auth-modal__manual {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--gg-muted);
}
.gg--live-auth-modal__command {
    display: inline-block;
    margin-top: 0.4rem;
    padding: 0.35rem 0.6rem;
    border: 1px dashed var(--gg-card-border);
    border-radius: 8px;
    background: var(--gg-card-bg);
    color: #7a4fc2;
    font-family: monospace;
    cursor: pointer;
}
.gg--live-auth-modal__note {
    font-size: 0.8rem;
    color: var(--gg-placeholder);
    margin-top: 0.75rem !important;
}

/* ── Wider screens: video + chat side by side ─────────── */
@media (min-width: 992px) {
    .gg--live-layout {
        display: grid;
        grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr);
        grid-template-areas:
            'video chat'
            'content chat';
        align-items: start;
    }
    .gg--live-video { grid-area: video; }
    .gg--live-content { grid-area: content; }
    .gg--live-chat {
        grid-area: chat;
        position: sticky;
        top: 1.5rem;
        display: flex;
        flex-direction: column;
        max-height: calc(100vh - 3rem);
    }
    .gg--live-chat__thread {
        flex: 1;
        max-height: none;
    }
}

/* ── Reduced motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .gg--live-badge--live .gg--live-badge__dot {
        animation: none;
    }
    .gg--live-chat__spinner {
        animation-duration: 1.4s;
    }
    .gg--live-chat__thread {
        scroll-behavior: auto;
    }
}
