/* ==========================================================================
   CoP Spaces — Jitsi-powered live meeting rooms
   ========================================================================== */

.cop-space-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-radius: var(--cop-radius, 10px);
    margin-bottom: 16px;
    gap: 12px;
    flex-wrap: wrap;
}
.cop-space-live {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
}
.cop-space-scheduled {
    background: #f0f4ff;
    border: 1px solid #c7d2fe;
    color: #1e293b;
}
.cop-space-banner-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.cop-space-banner-info strong { font-size: 15px; display: block; }
.cop-space-banner-meta { font-size: 12px; opacity: .8; display: block; margin-top: 2px; }
.cop-space-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }
.cop-space-start-bar { display: flex; gap: 8px; margin-bottom: 16px; }

.cop-space-live-dot {
    width: 12px; height: 12px;
    background: #ef4444;
    border-radius: 50%;
    flex-shrink: 0;
    animation: copSpacesPulse 1.5s ease-in-out infinite;
}
@keyframes copSpacesPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.6); }
    50%      { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

.cop-space-btn-danger { background: #ef4444 !important; color: #fff !important; }

/* Invite chip/result styles */
.cop-space-invite-result {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    background: #fff;
    transition: background .15s;
}
.cop-space-invite-result:hover { background: #f1f5f9; }
.cop-space-invite-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--cop-bg, #f1f5f9);
    border: 1px solid var(--cop-border, #e2e8f0);
    border-radius: 16px;
    font-size: 12px;
}
.cop-space-invite-chip-x {
    cursor: pointer;
    color: var(--cop-danger, #ef4444);
    font-weight: 700;
}

/* Jitsi iframe mount */
.cop-spaces-jitsi-container {
    margin-bottom: 16px;
    border-radius: var(--cop-radius-lg, 12px);
    overflow: hidden;
    background: #1a1a2e;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.cop-spaces-jitsi-container #cop-spaces-jitsi-frame {
    width: 100%;
    min-height: 560px;
    background: #1a1a2e;
}
.cop-spaces-jitsi-container iframe {
    display: block;
    width: 100%;
    border: 0;
}
.cop-spaces-jitsi-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: #0f172a;
    border-top: 1px solid #334155;
}

/* LiveKit meeting UI (custom-built — LiveKit is SDK-level so we render our own) */
.cop-lk-stage {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 560px;
    background: #0f172a;
    color: #fff;
}
.cop-lk-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    padding: 16px;
    overflow-y: auto;
    align-content: start;
}
.cop-lk-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #1e293b;
    border: 2px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 16 / 10;
    transition: border-color .15s;
}
.cop-lk-tile.speaking { border-color: var(--cop-primary, #75b83d); box-shadow: 0 0 0 2px rgba(117, 184, 61, .35); }
.cop-lk-tile-media {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    position: relative;
    overflow: hidden;
}
.cop-lk-tile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #334155 center/cover no-repeat;
    color: #fff;
    font-size: 28px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cop-lk-track-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.cop-lk-track-audio { display: none !important; }
.cop-lk-tile-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(15, 23, 42, .92);
    color: #fff;
}
.cop-lk-tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 80%; }
.cop-lk-tile-mic { font-size: 13px; }
.cop-lk-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    background: #0b1220;
    border-top: 1px solid #334155;
}

/* "Live Now" sidebar widget (rendered from the theme's sidebar.php) */
.copt-sidebar-live {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
    border-radius: 8px;
    margin-bottom: 8px;
    text-decoration: none;
    transition: opacity .2s;
}
.copt-sidebar-live:hover { opacity: .9; }
.copt-sidebar-live-title { font-size: 12px; font-weight: 600; line-height: 1.3; }
.copt-sidebar-live-meta { font-size: 10px; opacity: .7; }

@media (max-width: 768px) {
    .cop-space-banner { flex-direction: column; text-align: center; }
    .cop-space-banner-info { justify-content: center; }
    .cop-spaces-jitsi-container #cop-spaces-jitsi-frame { min-height: 400px; }
}
