/* ================================================================
   Parashar Guru — LiveKit Room Overlay
   Premium glassmorphic video call UI
   ================================================================ */

#pg-livekit-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #0a0a0f 0%, #141420 50%, #0d0d14 100%);
    color: #fff;
    font-family: 'Inter', 'Outfit', system-ui, sans-serif;
    overflow: hidden;
}

/* ---- Header ---- */
.pg-lk-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    flex-shrink: 0;
    z-index: 2;
}

.pg-lk-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pg-lk-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
    transition: all 0.3s ease;
}

.pg-lk-status-dot.pg-lk-connected {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
    animation: pg-lk-pulse 2s infinite;
}

@keyframes pg-lk-pulse {
    0%, 100% { box-shadow: 0 0 6px rgba(34, 197, 94, 0.4); }
    50% { box-shadow: 0 0 12px rgba(34, 197, 94, 0.8); }
}

.pg-lk-status-text {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.pg-lk-participant-count {
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.06);
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ---- Video Grid ---- */
.pg-lk-grid {
    flex: 1;
    display: grid;
    gap: 0.5rem;
    padding: 0.75rem;
    overflow: hidden;
    grid-template-columns: 1fr;
    align-content: center;
}

/* Responsive grid layouts */
@media (min-width: 640px) {
    .pg-lk-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .pg-lk-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1400px) {
    .pg-lk-grid { grid-template-columns: repeat(4, 1fr); }
}

/* Single participant → full width */
.pg-lk-grid:has(.pg-lk-tile:only-child) {
    grid-template-columns: 1fr;
}

.pg-lk-tile {
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 1rem;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.pg-lk-tile:hover {
    transform: scale(1.01);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.pg-lk-tile-local {
    border-color: rgba(240, 178, 65, 0.2);
    box-shadow: inset 0 0 0 1px rgba(240, 178, 65, 0.1);
}

.pg-lk-tile-video {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(20, 20, 35, 0.9), rgba(10, 10, 20, 0.95));
}

.pg-lk-tile-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 1rem;
}

.pg-lk-tile-video:empty::after {
    content: '🧘';
    font-size: 2.5rem;
    opacity: 0.3;
}

.pg-lk-tile-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 1;
}

/* ---- Controls Bar ---- */
.pg-lk-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    flex-shrink: 0;
    z-index: 2;
}

.pg-lk-ctrl-btn {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.pg-lk-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.05);
}

.pg-lk-ctrl-btn:active {
    transform: scale(0.95);
}

.pg-lk-ctrl-btn.pg-lk-ctrl-off {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.pg-lk-ctrl-btn.pg-lk-ctrl-off:hover {
    background: rgba(239, 68, 68, 0.25);
}

.pg-lk-ctrl-btn.pg-lk-ctrl-disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.pg-lk-ctrl-leave {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: #ef4444 !important;
}

.pg-lk-ctrl-leave:hover {
    background: rgba(239, 68, 68, 0.3) !important;
    transform: scale(1.1) !important;
}

/* ---- Sidebar (Participant List) ---- */
.pg-lk-sidebar {
    position: absolute;
    top: 3.5rem;
    right: 0;
    width: 260px;
    max-height: calc(100vh - 8rem);
    background: rgba(15, 15, 25, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0 0 0 1rem;
    overflow-y: auto;
    z-index: 5;
}

.pg-lk-sidebar-header {
    padding: 1rem 1.25rem;
    font-size: 0.65rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pg-lk-participant-list {
    padding: 0.5rem;
}

.pg-lk-p-item {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    border-radius: 0.5rem;
    transition: background 0.15s ease;
}

.pg-lk-p-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.pg-lk-p-local {
    color: #f0b241;
    font-weight: 700;
}

/* ---- Mobile Adjustments ---- */
@media (max-width: 639px) {
    .pg-lk-sidebar {
        display: none;
    }

    .pg-lk-tile {
        aspect-ratio: 4 / 3;
        min-height: 100px;
    }

    .pg-lk-controls {
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .pg-lk-ctrl-btn {
        width: 44px;
        height: 44px;
    }
}
