/* style.css */
/* Replicating the Classic Lgana (لقانا) Voice Chat Mobile Web UI with Modern Premium Enhancements */

@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&family=Outfit:wght@400;600;700&display=swap');

:root {
    --bg-desktop: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    --header-footer-bg: linear-gradient(135deg, #1f2029 0%, #111217 100%);
    --chat-bg: #0f1015;
    --card-bg-dark: #1e1f26;
    --border-dark: rgba(255, 255, 255, 0.08);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --font-family-ar: 'Tajawal', sans-serif;
    
    /* Lgana Gold Accent */
    --accent-gold: #fbbf24;
    --accent-gold-hover: #f59e0b;
    --accent-danger: #ef4444;
    
    /* Rank colors based on Lgana theme */
    --rank-owner: #f87171;      /* Premium Red */
    --rank-admin: #34d399;      /* Premium Green */
    --rank-super: #c084fc;      /* Premium Purple */
    --rank-member: #60a5fa;     /* Premium Blue */
    --rank-visitor: #94a3b8;    /* Premium Grey */
    --rank-system: #f472b6;     /* Premium Pink */
}

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

body {
    background: var(--bg-desktop);
    font-family: var(--font-family-ar), sans-serif;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    direction: rtl; /* Set default text direction to Arabic */
}

/* Glassmorphism utility card */
.glass-card {
    background: rgba(30, 31, 38, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Login screen (styled as a centered card) */
.login-container {
    width: 92%;
    max-width: 380px;
    border-radius: 20px;
    padding: 30px 24px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.5);
    text-align: center;
}

.login-header h1 {
    font-size: 2rem;
    color: var(--accent-gold);
    margin-bottom: 8px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 25px;
    line-height: 1.4;
}

.form-group {
    margin-bottom: 20px;
    text-align: right;
}

.form-group label {
    display: block;
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.input-field {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 16px; /* Avoid iOS automatic zoom on focus */
    outline: none;
    transition: all 0.25s ease;
    text-align: right;
}

.input-field:focus {
    border-color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}

/* Premium custom dropdown styling */
.select-field {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 16px;
    outline: none;
    transition: all 0.25s ease;
    text-align: right;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fbbf24' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: left 12px center !important;
    background-size: 18px !important;
}

.select-field:focus {
    border-color: var(--accent-gold) !important;
    background-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--accent-gold) 0%, #d97706 100%);
    color: #0f1015;
    border: none;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.45);
}

/* Lgana Frame Container (Full Screen on all devices) */
.mobile-frame {
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Use dvh on modern iOS to exclude browser bar */
    background-color: var(--chat-bg);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Header Bar (Top Bar) */
.room-header {
    background: var(--header-footer-bg);
    border-bottom: 2px solid var(--accent-gold); /* Lgana Gold Accent Border */
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    padding-top: calc(env(safe-area-inset-top, 0px) + 8px);
    padding-bottom: 8px;
    min-height: calc(60px + env(safe-area-inset-top, 0px));
    color: #ffffff;
    z-index: 10;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #ffffff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.25s;
}

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

/* Header btn colors */
.text-green { color: #34d399 !important; }
.text-blue { color: #60a5fa !important; }
.text-yellow { color: var(--accent-gold) !important; }
.text-white { color: #ffffff !important; }

/* Header Speaker/Timer */
.header-center {
    text-align: center;
    flex-grow: 1;
}

.active-speaker-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent-gold); /* Yellow/Gold speaker name */
    text-shadow: 0 2px 4px rgba(0,0,0,0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    margin: 0 auto;
}

.active-speaker-timer {
    font-size: 0.8rem;
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
    opacity: 0.8;
    margin-top: 2px;
}

/* Pinned Announcement Box (إعلان الغرفة) */
.announcement-card {
    background: rgba(30, 31, 38, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-muted);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.announcement-header {
    font-weight: 700;
    color: var(--accent-gold);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.announcement-body {
    text-align: justify;
    word-break: break-word;
}

/* Chat Messages Area */
.chat-messages-container {
    flex: 1;
    min-height: 0; /* Critical: prevents flex from ignoring overflow-y:auto */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--chat-bg);
}

/* Single Message Block (Lgana Card Style) */
.message-wrapper {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    width: 100%;
    min-height: 50px; /* Guarantee visibility even if content fails to render */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    flex-shrink: 0; /* Never let messages shrink/collapse */
    transition: transform 0.2s ease;
}

.message-wrapper:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.05);
}

/* Rank Right Borders & Customized Premium Gradients (Adjusted to right for RTL layout) */
.message-wrapper.owner-border {
    background: linear-gradient(135deg, rgba(248, 113, 113, 0.05) 0%, rgba(30, 31, 38, 0.4) 100%);
    border: 1px solid rgba(248, 113, 113, 0.15);
    border-right: 4px solid var(--rank-owner);
    border-left: none;
}
.message-wrapper.admin-border {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.05) 0%, rgba(30, 31, 38, 0.4) 100%);
    border: 1px solid rgba(52, 211, 153, 0.15);
    border-right: 4px solid var(--rank-admin);
    border-left: none;
}
.message-wrapper.super-border {
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.05) 0%, rgba(30, 31, 38, 0.4) 100%);
    border: 1px solid rgba(192, 132, 252, 0.15);
    border-right: 4px solid var(--rank-super);
    border-left: none;
}
.message-wrapper.member-border {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.05) 0%, rgba(30, 31, 38, 0.4) 100%);
    border: 1px solid rgba(96, 165, 250, 0.15);
    border-right: 4px solid var(--rank-member);
    border-left: none;
}
.message-wrapper.visitor-border {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-right: 4px solid var(--rank-visitor);
    border-left: none;
}
.message-wrapper.system-border {
    background: rgba(244, 114, 182, 0.03);
    border: 1px solid rgba(244, 114, 182, 0.1);
    border-right: 4px solid var(--rank-system);
    border-left: none;
}

/* Message Header */
.message-header-row {
    background: rgba(0, 0, 0, 0.15);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.message-sender-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-sender-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.message-sender-name {
    font-size: 0.9rem;
    font-weight: 700;
}

.message-timestamp {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
}

/* Message Text body */
.message-text-body {
    padding: 10px 14px;
    font-size: 0.95rem;
    word-break: break-word;
    text-align: right;
    font-weight: 500;
    color: var(--text-main); /* High contrast */
    min-height: 20px;
    line-height: 1.45;
}

/* System Message Style */
.message-wrapper.system {
    border-right: 4px solid var(--rank-system);
    border-left: none;
    background: rgba(244, 114, 182, 0.04);
}
.message-wrapper.system .message-header-row {
    background: rgba(244, 114, 182, 0.08);
}
.message-wrapper.system .message-text-body {
    color: #f472b6;
    font-style: italic;
    font-size: 0.88rem;
}

/* Footer (Input Bar) */
.room-footer {
    background: var(--header-footer-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    min-height: calc(65px + env(safe-area-inset-bottom, 0px));
    z-index: 10;
}

.footer-left, .footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-btn {
    background: rgba(255, 255, 255, 0.04);
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.footer-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

/* Action Mic Button */
#btn-footer-mic {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
    color: #ffffff;
    font-size: 1.15rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.btn-mic-inactive {
    background: #10b981; /* Green for Request Mic */
}

.btn-mic-queued {
    background: var(--accent-gold); /* Yellow/Gold when in Queue */
    animation: pulseGold 1.5s infinite alternate;
}

.btn-mic-active {
    background: var(--accent-danger); /* Red when Speaker */
    animation: ripplePulse 1s infinite linear;
}

/* Camera btn visual */
.btn-camera {
    color: #ec4899;
}

/* Emoji / Upload icons colors */
.btn-emoji { color: var(--accent-gold); }
.btn-upload { color: #34d399; }

/* Input box in footer */
.footer-center {
    flex-grow: 1;
    padding: 0 8px;
}

.footer-input {
    width: 100%;
    height: 38px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 20px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 16px; /* Avoid iOS automatic zoom on focus */
    outline: none;
    color: var(--text-main);
    text-align: right;
    transition: all 0.25s ease;
}

.footer-input:focus {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-gold);
}

/* Emoji Panel */
.emoji-panel {
    background: #121319;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    height: 250px;
    display: none;
    flex-direction: column;
    z-index: 100;
}

.emoji-panel-tabs {
    display: flex;
    background: #0f1015;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    overflow-x: auto;
}

.emoji-panel-tabs span {
    padding: 12px 24px;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
}

.emoji-panel-tabs span.active-tab {
    background: #121319;
    border-bottom: 2px solid var(--accent-gold);
    color: var(--accent-gold);
    font-weight: 700;
}

.emoji-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    padding: 12px;
    gap: 12px;
    justify-items: center;
    align-items: center;
}

.emoji-item {
    font-size: 1.7rem;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s;
}

.emoji-item:hover {
    transform: scale(1.25);
}

/* Side Drawers (Slide-out Overlays) */
.users-drawer-overlay, .queue-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    z-index: 999;
}

.users-drawer, .queue-drawer {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80%;
    max-width: 320px;
    background: #181920;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0,0,0,0.7);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border: none;
}

/* Right-side drawers (Standard drawer animation in RTL) */
.users-drawer {
    right: 0;
    transform: translateX(100%);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.queue-drawer {
    left: 0;
    transform: translateX(-100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

/* Drawer headers */
.drawer-header {
    height: 60px;
    background: #121319;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
}

.drawer-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.close-drawer-btn {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
}

.close-drawer-btn:hover {
    color: #ffffff;
}

.drawer-content {
    flex: 1;
    overflow-y: auto;
    background: #181920;
}

/* Active Users Category Tree styling */
.rank-header {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 10px 16px;
    background: #121319;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Sidebar List Item */
.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    transition: background 0.2s;
}

.list-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.list-item-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.15);
    color: var(--accent-gold);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 700;
}

.list-item-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    flex-grow: 1;
    text-align: right;
}

/* Status Icons */
.list-item-status-icon {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.text-mic-speaking {
    color: #10b981; /* Green speaking mic */
    animation: pulseMic 1.2s infinite alternate;
}

.text-hand-queued {
    color: var(--accent-gold); /* Yellow raising hand */
}

/* Queue Drawer Styling */
.queue-status-banner {
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.2);
    color: var(--accent-gold);
    padding: 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: center;
}

/* Ranks colors text */
.rank-owner-text { color: var(--rank-owner) !important; }
.rank-admin-text { color: var(--rank-admin) !important; }
.rank-super-text { color: var(--rank-super) !important; }
.rank-member-text { color: var(--rank-member) !important; }
.rank-visitor-text { color: var(--rank-visitor) !important; }

.crown-gold { color: var(--accent-gold); margin-left: 4px; }
.shield-green { color: #34d399; margin-left: 4px; }
.star-purple { color: #c084fc; margin-left: 4px; }

/* Custom hidden audio tags */
audio {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    z-index: -9999;
}

/* Animations */
@keyframes pulseGold {
    from { box-shadow: 0 0 4px rgba(251, 191, 36, 0.3); }
    to { box-shadow: 0 0 15px rgba(251, 191, 36, 0.7); }
}

@keyframes ripplePulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes pulseMic {
    from { transform: scale(0.95); opacity: 0.8; }
    to { transform: scale(1.15); opacity: 1; }
}

@keyframes ripple {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Header Badge for count */
.header-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.65rem;
    font-weight: 700;
    color: #ffffff;
    border-radius: 10px;
    padding: 2px 6px;
    min-width: 18px;
    text-align: center;
    line-height: 1;
    font-family: 'Outfit', sans-serif;
    border: 1px solid rgba(0,0,0,0.5);
}

.bg-green {
    background-color: #10b981 !important;
}

.bg-yellow {
    background-color: #f59e0b !important;
}

/* Footer Send Button */
.footer-send-btn {
    background: linear-gradient(135deg, var(--accent-gold) 0%, #d97706 100%);
    color: #0f1015;
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.3);
    flex-shrink: 0;
}

.footer-send-btn:hover {
    filter: brightness(1.15);
    transform: scale(1.05);
}

/* Active Mic Slot Area (منطقة المايك النشط) */
.active-mic-area {
    background: linear-gradient(90deg, #1e1f26 0%, #13141a 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 10px 16px;
    position: relative;
    overflow: visible; /* Need to show floating stars outside boundaries if any */
}

.mic-slot-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 2;
}

.mic-avatar-ring {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #33333e;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.active-mic-area.active .mic-avatar-ring {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.7);
    animation: ringGlow 1.5s infinite alternate;
}

.mic-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1e1f26;
    color: var(--text-muted);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    font-weight: bold;
    border: 2px solid #2a2a35;
}

.active-mic-area.active .mic-avatar {
    background: #1e1b4b; /* Deep night bg for speaking user */
    color: var(--accent-gold);
    border-color: #fbbf24;
}

.mic-speaker-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mic-speaker-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.active-mic-area.active .mic-speaker-name {
    color: var(--accent-gold); /* Bright yellow */
}

.mic-speaker-status {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.active-mic-area.active .mic-speaker-status {
    color: #34d399; /* Green active tag */
    font-weight: 600;
}

.mic-timer-badge {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 10px;
    border-radius: 12px;
    color: #ffffff;
    font-size: 0.78rem;
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.active-mic-area.active .mic-timer-badge {
    border-color: var(--accent-gold);
    background: rgba(245, 158, 11, 0.12);
    color: var(--accent-gold);
}

/* Star Animation Container (مايك النجوم) */
.star-animation-container {
    position: absolute;
    top: 50%;
    left: 24px; /* Center aligned on the mic-avatar-ring (width is 48px, so center is 24px) */
    transform: translate(-50%, -50%);
    width: 72px;
    height: 72px;
    pointer-events: none;
    display: none;
    z-index: 1;
}

.active-mic-area.active .star-animation-container {
    display: block;
}

/* Individual Sparkling Stars */
.sparkling-star {
    position: absolute;
    font-size: 0.75rem;
    user-select: none;
    opacity: 0;
    animation: starSparkle 2.2s infinite ease-in-out;
}

.star-1 {
    top: 0%;
    left: 45%;
    animation-delay: 0s;
}
.star-2 {
    top: 35%;
    left: 85%;
    font-size: 0.6rem;
    animation-delay: 0.3s;
}
.star-3 {
    top: 75%;
    left: 65%;
    animation-delay: 0.6s;
}
.star-4 {
    top: 70%;
    left: 15%;
    font-size: 0.65rem;
    animation-delay: 0.9s;
}
.star-5 {
    top: 25%;
    left: 5%;
    animation-delay: 1.2s;
}
.star-6 {
    top: 10%;
    left: 75%;
    font-size: 0.55rem;
    animation-delay: 1.5s;
}

@keyframes starSparkle {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    40% {
        opacity: 1;
        transform: scale(1.3) rotate(180deg);
        filter: drop-shadow(0 0 4px var(--accent-gold));
    }
    80% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

@keyframes ringGlow {
    from {
        box-shadow: 0 0 6px rgba(251, 191, 36, 0.3);
    }
    to {
        box-shadow: 0 0 16px rgba(251, 191, 36, 0.6), 0 0 24px rgba(251, 191, 36, 0.2);
    }
}

/* Mobile responsive layout overrides for very small screen widths */
@media (max-width: 599px) {
    .room-header {
        padding: 0 10px !important;
        padding-top: calc(env(safe-area-inset-top, 0px) + 6px) !important;
        min-height: calc(55px + env(safe-area-inset-top, 0px)) !important;
    }
    .header-btn {
        width: 34px !important;
        height: 34px !important;
        font-size: 1.1rem !important;
    }
    .header-badge {
        top: -3px !important;
        right: -3px !important;
        padding: 1px 4px !important;
        min-width: 15px !important;
    }
    .active-speaker-name {
        font-size: 0.95rem !important;
        max-width: 120px !important;
    }
    .room-footer {
        padding: 8px 10px calc(env(safe-area-inset-bottom, 0px) + 8px) 10px !important;
        gap: 6px !important;
    }
    .footer-left, .footer-right {
        gap: 4px !important;
    }
    .footer-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 1.05rem !important;
    }
    #btn-footer-mic {
        width: 36px !important;
        height: 36px !important;
        font-size: 1rem !important;
    }
    .footer-send-btn {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.75rem !important;
    }
    .footer-input {
        padding: 0 12px !important;
        height: 34px !important;
        font-size: 15px !important;
    }
    .announcement-card {
        padding: 8px 12px !important;
        max-height: 80px !important;
        overflow-y: auto;
    }
    .users-drawer, .queue-drawer {
        width: 85% !important;
    }
}

/* Support for very small device screens (e.g. iPhone SE, width <= 320px) */
@media (max-width: 330px) {
    .room-header {
        padding: 0 6px !important;
    }
    .header-btn {
        width: 30px !important;
        height: 30px !important;
        font-size: 1rem !important;
    }
    .active-speaker-name {
        max-width: 90px !important;
        font-size: 0.85rem !important;
    }
    .room-footer {
        padding: 6px 4px calc(env(safe-area-inset-bottom, 0px) + 6px) 4px !important;
        gap: 4px !important;
    }
    .footer-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.95rem !important;
    }
    #btn-footer-mic {
        width: 32px !important;
        height: 32px !important;
        font-size: 0.9rem !important;
    }
    .footer-send-btn {
        width: 28px !important;
        height: 28px !important;
    }
    .footer-input {
        padding: 0 8px !important;
        height: 30px !important;
        font-size: 13px !important;
    }
    .mic-slot-wrapper {
        gap: 8px !important;
    }
    .mic-avatar-ring {
        width: 40px !important;
        height: 40px !important;
    }
    .mic-avatar {
        width: 34px !important;
        height: 34px !important;
        font-size: 0.9rem !important;
    }
    .mic-speaker-name {
        font-size: 0.85rem !important;
        max-width: 110px !important;
    }
    .mic-timer-badge {
        padding: 4px 6px !important;
        font-size: 0.7rem !important;
    }
}

/* Private Chat Modal / Popup (Modern premium design) */
.private-chat-modal {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 330px;
    height: 420px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    z-index: 2000;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 599px) {
    .private-chat-modal {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100% !important;
        height: 65vh !important;
        height: 65dvh !important;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.5);
    }
}

.private-chat-header {
    height: 52px;
    background: #121319;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
}

.private-chat-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.private-chat-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(251, 191, 36, 0.08);
    border: 1px solid rgba(251, 191, 36, 0.15);
    color: var(--accent-gold);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.85rem;
}

.private-chat-username {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
}

.close-pm-btn {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
}

.close-pm-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.private-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #181920;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.private-chat-footer {
    height: 52px;
    background: #121319;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 8px);
    min-height: calc(52px + env(safe-area-inset-bottom, 0px));
}

#pm-form {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 100%;
    width: 100%;
}

#pm-input {
    flex: 1;
    height: 36px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    padding: 0 14px;
    font-size: 14px;
    color: #ffffff;
    outline: none;
    font-family: inherit;
    text-align: right;
    transition: border-color 0.2s;
}

#pm-input:focus {
    border-color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.06);
}

#pm-form button {
    background: linear-gradient(135deg, var(--accent-gold) 0%, #d97706 100%);
    color: #0f1015;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.35);
    flex-shrink: 0;
    transition: transform 0.2s;
}

#pm-form button:hover {
    transform: scale(1.05);
}

/* PM Message Bubbles */
.pm-msg-row {
    display: flex;
    width: 100%;
}

.pm-msg-row.sent {
    justify-content: flex-start; /* Displays on the right in RTL because order flips, or let's use flex direction to match alignment */
}

.pm-msg-row.received {
    justify-content: flex-end;
}

.pm-bubble {
    max-width: 80%;
    padding: 8px 14px;
    font-size: 0.9rem;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Sent message styling (Gold background matching Lgana gold) */
.pm-msg-row.sent .pm-bubble {
    background: linear-gradient(135deg, var(--accent-gold) 0%, #d97706 100%);
    color: #0f1015;
    border-radius: 12px 12px 0 12px;
    font-weight: 600;
}

/* Received message styling (Dark/translucent border glass card) */
.pm-msg-row.received .pm-bubble {
    background: rgba(255, 255, 255, 0.04);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px 12px 12px 0;
}

/* Badge count for unread PM in users list */
.pm-unread-badge {
    background-color: #ef4444;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    margin-right: auto; /* Push badge to the left in RTL list items */
    font-family: 'Outfit', sans-serif;
    border: 1px solid rgba(0, 0, 0, 0.2);
    box-shadow: 0 2px 5px rgba(239, 68, 68, 0.35);
    display: inline-block;
    animation: badgeBounce 1.2s infinite alternate;
}

@keyframes badgeBounce {
    from { transform: translateY(0); }
    to { transform: translateY(-2px); }
}

/* Private Chats Drawer (PM list) styling */
.pm-drawer-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: none;
    z-index: 999;
}

.pm-drawer {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80%;
    max-width: 320px;
    background: #181920;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0,0,0,0.7);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border: none;
    right: 0;
    transform: translateX(100%);
    border-left: 1px solid rgba(255, 255, 255, 0.06);
}

/* ==========================================
   User Actions Moderation Modal & Backdrop Styling
   ========================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2400;
    animation: backdropFadeIn 0.2s ease-out forwards;
}

@keyframes backdropFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.user-actions-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    max-width: 90%;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    z-index: 2500;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden;
    direction: rtl;
    background: rgba(30, 31, 38, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: actionsModalScaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes actionsModalScaleIn {
    from {
        opacity: 0;
        transform: translate(-50%, -40%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.user-actions-header {
    height: 56px;
    background: rgba(18, 19, 25, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 18px;
}

.user-actions-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-actions-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    color: var(--accent-gold);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.95rem;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.1);
}

.close-actions-btn {
    background: transparent;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
}

.close-actions-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
    transform: rotate(90deg);
}

.action-menu-btn {
    width: 100%;
    height: 46px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 16px;
    gap: 12px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: right;
    box-sizing: border-box;
}

.action-menu-btn i {
    font-size: 1.15rem;
    width: 24px;
    text-align: center;
    transition: transform 0.2s ease;
}

.action-menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.action-menu-btn:hover i {
    transform: scale(1.1);
}

.action-menu-btn:active {
    transform: translateY(0);
}



