/* ==========================================================================
   CLUBHOUSE-STYLE AUDIO ROOMS (WARM ELEGANT THEME & SOUNDWAVE EFFECTS)
   FULLY RESPONSIVE ACROSS ALL DEVICES
   ========================================================================== */

:root {
    --bg-clubhouse: #fbf9f5;
    --bg-card: #ffffff;
    --bg-panel: #f4efe6;
    
    --primary: #52525b;
    --accent-green: #22c55e;
    --accent-gold: #f59e0b;
    --accent-coral: #ef4444;
    --accent-purple: #8b5cf6;
    
    --text-main: #27272a;
    --text-muted: #71717a;
    --text-light: #a1a1aa;
    
    --border-color: #ede5d8;
    --border-soft: #f4efe6;
    
    --font-ui: 'Cairo', 'Tajawal', sans-serif;
    
    --radius-avatar: 32px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-full: 9999px;
    
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.04);
    --shadow-speaking: 0 0 0 4px #22c55e, 0 10px 25px rgba(34, 197, 94, 0.35);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.clubhouse-mode {
    font-family: var(--font-ui);
    background-color: var(--bg-clubhouse);
    color: var(--text-main);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header Bar */
.ch-header-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(251, 249, 245, 0.94);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ch-header-brand-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.ch-btn-back {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1rem;
    box-shadow: var(--shadow-soft);
    transition: all 0.2s;
    flex-shrink: 0;
}

.ch-btn-back:hover {
    background: var(--bg-panel);
}

.ch-room-club-title {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ch-club-pill {
    font-size: 0.74rem;
    font-weight: 800;
    color: #854d0e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ch-room-name {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--text-main);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ch-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ch-badge-live {
    background: #fef2f2;
    color: #ef4444;
    border: 1px solid #fecaca;
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 0.76rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.live-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.ch-btn-leave {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
    padding: 7px 16px;
    border-radius: var(--radius-full);
    font-family: var(--font-ui);
    font-size: 0.86rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.ch-btn-leave:hover {
    background: #fecaca;
}

/* Main Clubhouse Layout */
.ch-main-stage-container {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 16px 120px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

/* Stage Section Headers */
.ch-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.ch-section-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ch-counter-pill {
    background: #ede5d8;
    color: #44403c;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

/* ========================================================
   1. SPEAKERS ON STAGE (SQUIRCLE AVATARS WITH GREEN GLOW)
   ======================================================== */
.ch-speakers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 20px 14px;
    justify-items: center;
}

.ch-speaker-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s ease;
    width: 100%;
    max-width: 130px;
}

.ch-speaker-card:hover {
    transform: translateY(-2px);
}

/* Squircle Avatar Container */
.ch-avatar-squircle-wrap {
    position: relative;
    width: 90px;
    height: 90px;
    border-radius: var(--radius-avatar);
    background: #ffffff;
    padding: 4px;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ch-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: calc(var(--radius-avatar) - 4px);
    object-fit: cover;
    display: block;
}

/* Active Speaker Glowing Soundwave */
.ch-speaker-card.is-speaking .ch-avatar-squircle-wrap {
    box-shadow: var(--shadow-speaking);
    animation: speakerPulse 1.6s infinite alternate;
}

@keyframes speakerPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 3px #22c55e, 0 8px 20px rgba(34, 197, 94, 0.3); }
    100% { transform: scale(1.04); box-shadow: 0 0 0 6px #22c55e, 0 14px 30px rgba(34, 197, 94, 0.5); }
}

.ch-mod-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: #ffffff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.ch-mic-status {
    position: absolute;
    bottom: -2px;
    left: -2px;
    background: #ffffff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.ch-mic-status.live {
    background: #22c55e;
    color: #ffffff;
}

.ch-mic-status.muted {
    background: #ef4444;
    color: #ffffff;
}

.ch-speaker-name {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.ch-speaker-title {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* ========================================================
   2. AUDIENCE FOLLOWED BY SPEAKERS
   ======================================================== */
.ch-audience-followed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 16px 12px;
    justify-items: center;
}

.ch-listener-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    cursor: pointer;
    width: 100%;
    max-width: 90px;
}

.ch-listener-avatar-wrap {
    width: 68px;
    height: 68px;
    border-radius: 24px;
    background: #ffffff;
    padding: 3px;
    box-shadow: var(--shadow-soft);
    position: relative;
}

.ch-listener-img {
    width: 100%;
    height: 100%;
    border-radius: 21px;
    object-fit: cover;
}

.ch-listener-name {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* ========================================================
   3. GENERAL AUDIENCE IN ROOM
   ======================================================== */
.ch-audience-general-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 14px 10px;
    justify-items: center;
}

.ch-general-avatar-wrap {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: #ffffff;
    padding: 2px;
    box-shadow: var(--shadow-soft);
}

.ch-general-img {
    width: 100%;
    height: 100%;
    border-radius: 16px;
    object-fit: cover;
}

.ch-general-name {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

/* ========================================================
   BOTTOM CONTROLS DOCK (RAISE HAND, MUTE, REACTIONS)
   ======================================================== */
.ch-bottom-dock-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(251, 249, 245, 0.96);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-color);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ch-dock-content-wrap {
    max-width: 900px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ch-dock-reactions-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ch-reaction-bubble-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid var(--border-color);
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.ch-reaction-bubble-btn:hover {
    transform: scale(1.15) translateY(-3px);
    background: #fff;
    border-color: #cbd5e1;
}

.ch-reaction-bubble-btn:active {
    transform: scale(0.9);
}

.ch-dock-center-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ch-dock-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f4efe6;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-family: var(--font-ui);
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ch-dock-btn:hover {
    background: #ede5d8;
}

.ch-dock-btn.active {
    background: #22c55e;
    color: #ffffff;
    border-color: #22c55e;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.35);
}

.ch-dock-btn.hand-active {
    background: #f59e0b;
    color: #ffffff;
    border-color: #f59e0b;
}

.ch-btn-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* Room Reaction Floating Animation */
.floating-reaction-bubble {
    position: fixed;
    bottom: 80px;
    font-size: 2rem;
    pointer-events: none;
    z-index: 9999;
    animation: floatUp 2.2s ease-out forwards;
}

@keyframes floatUp {
    0% { transform: translateY(0) scale(0.5); opacity: 0; }
    20% { opacity: 1; transform: translateY(-20px) scale(1.2); }
    100% { transform: translateY(-180px) scale(1); opacity: 0; }
}

/* Modal Speaker Profile Bottom Sheet */
.ch-speaker-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.ch-speaker-modal.active {
    display: flex;
}

.ch-modal-sheet {
    background: #ffffff;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 28px 20px 24px;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.ch-modal-avatar {
    width: 88px;
    height: 88px;
    border-radius: 28px;
    object-fit: cover;
    margin-bottom: 10px;
    box-shadow: var(--shadow-soft);
}

.ch-modal-name {
    font-size: 1.2rem;
    font-weight: 900;
    color: var(--text-main);
}

.ch-modal-handle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.ch-modal-bio {
    font-size: 0.86rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 18px;
}

.ch-modal-actions-row {
    display: flex;
    gap: 10px;
    width: 100%;
}

.btn-modal-follow {
    flex: 1;
    background: #4f46e5;
    color: #ffffff;
    border: none;
    padding: 11px;
    border-radius: var(--radius-full);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 800;
    cursor: pointer;
}

.btn-modal-close {
    position: absolute;
    top: 14px;
    left: 14px;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
}

/* ========================================================
   COMPREHENSIVE RESPONSIVE DESIGN (ALL SCREENS)
   ======================================================== */

/* Tablets & Small Screens (max-width: 768px) */
@media (max-width: 768px) {
    .ch-speakers-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px 10px;
    }
    .ch-avatar-squircle-wrap {
        width: 80px;
        height: 80px;
    }
    .ch-audience-followed-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .ch-audience-general-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Mobile Screens (max-width: 540px) */
@media (max-width: 540px) {
    .ch-header-bar {
        padding: 10px 14px;
    }
    .ch-badge-live {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    .ch-badge-live span:last-child {
        display: none;
    }
    .ch-btn-leave {
        padding: 6px 12px;
        font-size: 0.78rem;
    }
    .ch-main-stage-container {
        padding: 16px 12px 110px;
        gap: 22px;
    }
    .ch-speakers-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .ch-avatar-squircle-wrap {
        width: 72px;
        height: 72px;
        border-radius: 24px;
    }
    .ch-avatar-img {
        border-radius: 20px;
    }
    .ch-audience-followed-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .ch-listener-avatar-wrap {
        width: 56px;
        height: 56px;
        border-radius: 18px;
    }
    .ch-listener-img {
        border-radius: 16px;
    }
    .ch-audience-general-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .ch-general-avatar-wrap {
        width: 48px;
        height: 48px;
        border-radius: 16px;
    }
    .ch-general-img {
        border-radius: 14px;
    }
    /* Bottom Controls */
    .ch-bottom-dock-bar {
        padding: 8px 12px;
    }
    .ch-dock-reactions-group {
        gap: 4px;
    }
    .ch-reaction-bubble-btn {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    .ch-dock-btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    .ch-dock-btn span:last-child {
        display: none;
    }
    .ch-btn-circle {
        width: 36px;
        height: 36px;
    }
}

/* Extra Small Mobile (max-width: 360px) */
@media (max-width: 360px) {
    .ch-speakers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .ch-audience-followed-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .ch-audience-general-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
