/* --- public/styles.css --- */
:root {
    --bg-color: #FFFFFF;
    --text-color: #0F172A;
    --text-color-muted: #64748B;
    --nav-bg: #F8FAFC;
    --container-bg: #FFFFFF;
    --container-border: #E2E8F0;
    --input-bg: #F8FAFC;
    --hover-bg: #F1F5F9;
    --accent-color: #4F46E5;
    --accent-color-text: #FFFFFF;
    --green-accent: #16A34A;
    --red-accent: #DC2626;
    --font-family: 'Inter', sans-serif;
}

body.dark-mode {
    --bg-color: #111827;
    --text-color: #E5E7EB;
    --text-color-muted: #9CA3AF;
    --nav-bg: #1F2937;
    --container-bg: #111827;
    --container-border: #374151;
    --input-bg: #1F2937;
    --hover-bg: #374151;
    --accent-color: #6366F1;
    --accent-color-text: #FFFFFF;
    --green-accent: #22C55E;
    --red-accent: #EF4444;
}

body {
    display: flex;
    margin: 0;
    font-family: var(--font-family);
    height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
}

/* --- Scrollbar Styles --- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--container-border);
  border-radius: 4px;
  border: 2px solid var(--container-bg);
}

::-webkit-scrollbar-thumb:hover {
  background-color: #888;
}


#auth-container {
    width: 100%;
    max-width: 400px;
    margin: auto;
    padding: 2rem;
    border: 1px solid var(--container-border);
    border-radius: 8px;
    background-color: var(--container-bg);
}
#reset-container {
width: 100%;
max-width: 400px;
padding: 2rem;
border: 1px solid var(--container-border);
border-radius: 8px;
background-color: var(--container-bg);
}
#reset-container input {
width: 95%; 
padding: 10px; 
margin-bottom: 10px;
}
#reset-container button {
width: 100%; 
padding: 10px;
}
#message {
margin-top: 1rem;
text-align: center;
font-weight: bold;
}
#chat-container {
    display: none;
    width: 100%;
    height: 100%;
    flex-direction: column;
    flex-grow: 1;
}

#chat-content-wrapper {
    display: flex;
    flex-direction: row;
    flex-grow: 1; 
    min-height: 0; 
    width: 100%;
}

/* --- Left Navigation (Servers) --- */
#top-nav {
    width: 100%;
    height: 60px; 
    background-color: var(--nav-bg); 
    display: flex;
    flex-direction: row; 
    align-items: center;
    padding: 0 12px; 
    flex-shrink: 0;
    border-bottom: 1px solid var(--container-border);
    box-sizing: border-box;
    position: relative;
    z-index: 100;
}

.nav-icon-container {
    width: auto; 
    display: flex;
    flex-direction: row; 
    align-items: center;
    margin-bottom: 0; 
    margin-right: 8px; 
}

.nav-icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background-color: var(--container-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease-in-out; 
    position: relative;
    overflow: hidden;
    border: 1px solid transparent; 
}

.nav-icon-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nav-icon-circle:hover {
    border-radius: 12px; 
    border-color: var(--accent-color);
}

.nav-icon-circle.active {
    border-radius: 12px;
    background-color: var(--accent-color);
    color: var(--accent-color-text);
}

#nav-icon-admin.active {
    background-color: var(--link-color);
}

.nav-separator {
    width: 2px; 
    height: 32px; 
    background-color: var(--container-border);
    border-radius: 1px;
    margin: 0 8px; 
}

#server-list {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-grow: 1;
    gap: 8px; 
    overflow-x: auto;
    overflow-y: hidden;
}

/* --- NEW: Room Header --- */
.room-banner {
    height: 100px;
    width: 100%;
    background-color: var(--hover-bg);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.sticky-room-header {
    /* This is the key to the new effect! */
    position: sticky;
    top: 0;

    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--nav-bg);
    border-bottom: 1px solid var(--container-border);
    z-index: 10;
    cursor: pointer;
}

.sticky-room-header h2 {
    margin: 0;
    font-size: 18px;
}

.sticky-room-header .dropdown-arrow {
    font-size: 20px;
    font-weight: bold;
}
/* --- NEW: Context Menu & Create Channel Modal Styles --- */

/* General Context Menu Style (Unchanged) */
.context-menu {
    position: absolute;
    background-color: var(--bg-color);
    border: 1px solid var(--container-border);
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 100;
    width: 220px;
    padding: 6px;
}
.context-menu button {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: var(--text-color);
    border-radius: 3px;
    font-size: 14px;
}
.context-menu button:hover {
    background-color: var(--accent-color);
    color: var(--accent-color-text);
}
.context-menu .separator {
    height: 1px;
    background-color: var(--container-border);
    margin: 4px 10px;
}

/* --- Create Channel Modal Specifics (New Design) --- */
.channel-type-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Hide the actual radio button */
.channel-type-selector input[type="radio"] {
    display: none;
}

.channel-type-option {
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: var(--input-bg);
    padding: 12px;
    border-radius: 5px;
    border: 1px solid var(--container-border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.channel-type-option:hover {
    background-color: var(--hover-bg);
}

.channel-type-icon {
    font-size: 24px;
    width: 32px;
    text-align: center;
    color: var(--text-color-muted);
}

.channel-type-info strong {
    display: block;
    color: var(--text-color);
}

.channel-type-info span {
    font-size: 12px;
    color: var(--text-color-muted);
}

.radio-dot {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--container-border);
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* This is how we show the selected state */
.channel-type-selector input[type="radio"]:checked + .channel-type-option {
    background-color: var(--hover-bg);
    border-color: var(--accent-color);
}

.channel-type-selector input[type="radio"]:checked + .channel-type-option .radio-dot {
    border-color: var(--accent-color);
}

.channel-type-selector input[type="radio"]:checked + .channel-type-option .radio-dot::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent-color);
}

.channel-name-input-wrapper {
    position: relative;
}

.channel-name-prefix {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    color: var(--text-color-muted);
    pointer-events: none;
}

#new-channel-name {
    width: 100%;
    padding: 12px 12px 12px 36px; /* Add left padding for the '#' */
    box-sizing: border-box;
    border: 1px solid var(--container-border);
    border-radius: 5px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--container-border);
}

.modal-footer button {
    padding: 10px 20px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.modal-footer .cancel-btn {
    background: none;
    color: var(--text-color);
}

.modal-footer .submit-btn {
    background-color: var(--accent-color);
    color: var(--accent-color-text);
}
/* --- Placeholders from screenshot --- */
.room-meta-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--container-border);
    flex-shrink: 0;
}

.boost-goal-bar {
    font-size: 12px;
    color: var(--text-color-muted);
}
#prompt-modal {
    z-index: 6001;
}
.boost-goal-bar .progress-bar {
    width: 100%;
    height: 4px;
    background-color: var(--container-border);
    border-radius: 2px;
    margin: 4px 0;
}

.boost-goal-bar .progress {
    height: 100%;
    background-color: #A855F7; /* Purple color */
    border-radius: 2px;
}

.browse-channels-btn {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-color);
    padding: 10px 0;
    font-size: 16px;
    cursor: pointer;
    margin-top: 8px;
}

/* --- Placeholders from screenshot --- */
.room-meta-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--container-border);
}

.boost-goal-bar {
    font-size: 12px;
    color: var(--text-color-muted);
}

.boost-goal-bar .progress-bar {
    width: 100%;
    height: 4px;
    background-color: var(--container-border);
    border-radius: 2px;
    margin: 4px 0;
}

.boost-goal-bar .progress {
    height: 100%;
    background-color: #A855F7; 
    border-radius: 2px;
}

.browse-channels-btn {
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--text-color);
    padding: 10px 0;
    font-size: 16px;
    cursor: pointer;
    margin-top: 8px;
}
/* --- Secondary Navigation (Channels/Friends) --- */
#secondary-nav {
    width: 240px;
    height: 100%; 
    flex-shrink: 0;
    background-color: var(--nav-bg);
    display: flex; 
    flex-direction: column;
    border-right: 1px solid var(--container-border);
}
#channel-list-container {
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}

.channel-item {
    padding: 8px 1rem;
    border-radius: 5px;
    cursor: pointer;
    display: block;
}

.channel-item:hover, .channel-item.active {
    background-color: var(--hover-bg);
}

.channel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
}

.add-channel-btn {
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    padding: 4px;
}
/* --- Badges --- */
.profile-username-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
#profile-badges {
    margin-top: 8px;
    display: flex;
    align-items: center; 
    gap: 4px; 
}
.profile-badge {
    width: 22px; 
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.profile-badge svg {
    width: 100%;
    height: 100%;
}
.profile-badge img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.profile-secondary-info {
    font-size: 14px;
    color: var(--text-color-muted);
    margin-top: 2px;
}
/* --- Badge Management Modal Styles --- */
#badge-checklist {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.badge-checkbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--hover-bg);
    padding: 10px;
    border-radius: 5px;
}

.badge-checkbox-item label {
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.badge-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}
/* --- User Controls & Settings --- */
#user-controls-container {
    position: absolute; 
    bottom: 0;
    left: 0;
    width: 240px; 
    background-color: var(--nav-bg); 
    z-index: 10; 
    box-sizing: border-box; 
    border-right: 1px solid var(--container-border); 
}
#user-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    cursor: pointer;
    background-color: var(--hover-bg);
    transition: background-color 0.2s;
    border-radius: 5px;
    margin: 8px;
}
#user-panel:hover {
    background-color: var(--hover-bg);
}
#user-info {
    display: flex;
    align-items: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#user-avatar-main {
    width: 38px;
    height: 38px;
}
#user-info span {
    font-weight: bold;
    margin-left: 8px;
}

#user-controls button {
    font-size: 20px;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    opacity: 0.7;
    padding: 5px;
}

#user-controls button:hover {
    opacity: 1;
}
#settings-popup {
    position: fixed;
    bottom: 90px;
    left: 12px;
    border: 1px solid var(--container-border);
    border-radius: 8px;
    background-color: var(--nav-bg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 240px; 
    z-index: 1002;
    overflow: hidden;
}
#modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 5000;
}

#settings-modal-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: transparent; 
    z-index: 5001; 
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5vh 5vw;
    box-sizing: border-box;
}

.settings-panel {
    position: relative;
    width: 100%;
    max-width: 960px;
    height: 100%;
    max-height: 740px;
    display: flex;
    flex-direction: row;
    background-color: var(--bg-color); 
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    overflow: hidden;
    animation: modal-fade-in 0.2s ease-out;
}

#settings-close-btn {
    position: absolute;
    top: 15px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--container-border);
    background: none;
    font-size: 24px;
    line-height: 24px;
    color: var(--text-color-muted);
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
#settings-close-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-color);
}

#settings-sidebar {
    width: 280px;
    background-color: var(--nav-bg); 
    padding: 60px 10px 20px 20px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.settings-nav-list {
    flex-grow: 1;
}

.settings-category-header {
    padding: 0 10px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-color-muted);
    text-transform: uppercase;
}

.settings-nav-item {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 5px;
    text-align: left;
    background: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
}
.settings-nav-item.active {
    background-color: var(--hover-bg); 
    color: var(--text-color);
}
.settings-nav-item:not(.active):hover {
    background-color: rgba(55, 65, 81, 0.5);
}

#settings-content {
    flex-grow: 1;
    padding: 60px 40px;
    overflow-y: auto;
    background-color: var(--bg-color); 
}

.settings-page h1, .settings-page h2 {
    color: var(--text-color);
    margin-bottom: 10px;
}
h1 {
    font-size: 20px;
}
.account-profile-section {
    position: relative;
    border-radius: 8px;
    background-color: var(--nav-bg);
    margin-bottom: 24px;
}
.account-profile-banner {
    height: 120px;
    background-color: var(--accent-color);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}
.account-profile-header {
    display: flex;
    align-items: center;
    padding: 16px;
    padding-left: 116px; 
}
.account-profile-avatar {
    position: absolute;
    top: 68px;
    left: 16px;
}
.account-profile-avatar .pfp {
    width: 80px;
    height: 80px;
    font-size: 36px;
    border-radius: 50%;
    border: 6px solid var(--nav-bg); 
}
.account-profile-username {
    flex-grow: 1;
    font-size: 20px;
    font-weight: bold;
    color: var(--text-color);
}
.edit-profile-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 3px;
    background-color: var(--accent-color);
    color: var(--accent-color-text);
    cursor: pointer;
    font-weight: 500;
}
.account-details-box {
    background-color: var(--nav-bg);
    border-radius: 8px;
    padding: 0 8px;
}
.detail-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 8px;
    border-bottom: 1px solid var(--container-border);
}
.detail-field:last-child {
    border-bottom: none;
}
.detail-label {
    text-transform: uppercase;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-color-muted);
    margin-bottom: 4px;
}
.detail-value {
    font-size: 16px;
    color: var(--text-color);
}
.edit-btn {
    padding: 6px 16px;
    border-radius: 3px;
    background-color: var(--hover-bg);
    color: var(--text-color);
    border: 1px solid var(--container-border);
    cursor: pointer;
    font-weight: 500;
}
.edit-btn:hover {
    background-color: #4b5563;
}
.section-header {
    margin-top: 40px;
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: bold;
}
.account-action-box.danger-zone {
    border-top: 1px solid var(--red-accent);
    padding-top: 6px;
}
.account-action-box p {
    margin-top: 0;
    margin-bottom: 16px;
    color: var(--text-color-muted);
    font-size: 14px;
}
.action-btn.danger-btn {
    background-color: var(--red-accent);
    color: white;
    border: none;
}
/* --- PROFILE SETTINGS TAB STYLES --- */

.profile-settings-form .form-group {
    margin-bottom: 24px;
}

.profile-settings-form label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-color-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.profile-settings-form input[type="text"],
.profile-settings-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--container-border);
    border-radius: 5px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 16px;
    box-sizing: border-box;
}

.profile-settings-form textarea {
    resize: vertical;
}

.profile-settings-form .divider {
    border: none;
    height: 1px;
    background-color: var(--container-border);
    margin: 24px 0;
}

.profile-settings-form .button-group {
    display: flex;
    gap: 16px;
}

.profile-settings-form .action-btn {
    border: none;
    padding: 10px 16px;
    font-weight: 500;
    font-size: 14px;
}

.profile-settings-form .action-btn.accent-btn {
    background-color: var(--accent-color);
    color: var(--accent-color-text);
}

/* Upload Modal Styles */
#upload-preview {
    margin-top: 1rem;
    width: 100%;
    height: 180px;
    border: 2px dashed var(--container-border);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--input-bg);
    overflow: hidden;
}

#upload-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
/* --- MESSAGE BLUR--- */
.media-wrapper {
    position: relative;
    display: inline-block;
    max-width: 300px;
}

.media-wrapper.blurred img {
    filter: blur(20px);
    cursor: pointer;
}

.media-wrapper .reveal-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 8px 16px;
    border: none;
    border-radius: 5px;
    background-color: rgba(0,0,0,0.6);
    color: white;
    cursor: pointer;
    z-index: 1;
}
/* --- PRIVACY & SAFETY PAGE STYLES --- */
.settings-section {
    margin-top: 40px;
}

.settings-section .section-header {
    text-transform: uppercase;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-color-muted);
    margin-top: 40px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--container-border);
}

.section-description {
    font-size: 14px;
    color: var(--text-color-muted);
    margin-top: 0;
    margin-bottom: 16px;
}
.radio-group-visual {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.theme-preview-box {
    cursor: pointer;
    border: 2px solid var(--container-border);
    border-radius: 8px;
    padding: 8px;
    transition: border-color 0.2s;
    width: 150px;
    text-align: center;
}
.theme-preview-box:hover {
    border-color: var(--accent-color);
}

.theme-preview-box input[type="radio"] {
    display: none; /* Hide the actual radio button */
}

.theme-preview-box input[type="radio"]:checked + .preview-image + span {
    font-weight: bold;
    color: var(--accent-color);
}

.theme-preview-box input[type="radio"]:checked + .preview-image {
    border-color: var(--accent-color);
}

.preview-image {
    height: 80px;
    border-radius: 5px;
    margin-bottom: 8px;
    border: 2px solid transparent;
    background-size: cover;
    background-position: center;
}

.light-preview { background-color: #FFFFFF; border: 1px solid #E2E8F0; }
.dark-preview { background-color: #1F2937; }
.sync-preview { background: linear-gradient(to bottom right, #FFFFFF 50%, #1F2937 50%); border: 1px solid #E2E8F0;}
.cozy-preview { background-image: url('/images/cozy_preview.png'); } /* You will need to create this image */
.compact-preview { background-image: url('/images/compact_preview.png'); } /* You will need to create this image */


.setting-row {
    margin-top: 24px;
}

.settings-slider-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.settings-slider-container input[type="range"] {
    flex-grow: 1;
}
/* --- NEW: Accessibility Styles --- */
body.reduced-motion * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
}

body.high-contrast-mode {
    --bg-color: #000000;
    --text-color: #FFFFFF;
    --text-color-muted: #ADADAD;
    --nav-bg: #000000;
    --container-bg: #000000;
    --container-border: #FFFFFF;
    --input-bg: #000000;
    --hover-bg: #2A2A2A;
    --accent-color: #339DFF;
    --accent-color-text: #000000;
    --green-accent: #55FF55;
    --red-accent: #FF5555;
}

.tts-btn {
    font-size: 14px; 
}
/* --- NEW: Voice & Video Settings Styles --- */

.settings-select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--container-border);
    border-radius: 5px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 14px;
    margin-top: 8px;
}

#camera-preview-wrapper {
    margin-top: 16px;
    background-color: #000;
    border-radius: 5px;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

#camera-preview {
    width: 100%;
    height: auto;
}

#test-camera-btn {
    position: absolute;
    z-index: 1;
}
.setting-row.disabled {
    opacity: 0.5;
    pointer-events: none;
}
/* --- NEW: Mic Test & Camera Stop Styles --- */

#mic-test-area {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}

#mic-test-area .action-btn {
    padding: 8px 16px;
    font-weight: 500;
    border: 1px solid var(--container-border);
    border-radius: 5px;
    flex-shrink: 0; /* Prevent the button from shrinking */
}

.mic-meter {
    flex-grow: 1;
    height: 12px;
    background-color: var(--input-bg);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--container-border);
}

.mic-meter-level {
    width: 0%;
    height: 100%;
    background-color: var(--green-accent);
    transition: width 0.05s linear;
}

.setting-toggle-inline {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

#stop-camera-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    z-index: 2;
}
/* --- Dynamic Theme/Appearance Classes --- */

body.compact-mode .message-item {
    padding-top: 2px;
    padding-bottom: 2px;
}
body.compact-mode .message-avatar {
    display: none;
}
body.compact-mode .message-content {
    margin-left: 0;
}

#chat-container.saturated {
    filter: saturate(var(--saturation-level, 100%));
}
.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.setting-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--nav-bg);
    padding: 16px;
    border-radius: 8px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--container-border);
    transition: .4s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--green-accent);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.blocked-users-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.blocked-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--nav-bg);
    padding: 8px 16px;
    border-radius: 8px;
}

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

.blocked-user-info .pfp {
    width: 32px;
    height: 32px;
    margin-right: 0;
}
/* --- User Profile Modal Styles --- */
.profile-modal-content {
    position: fixed; 
    width: 340px;
    border-radius: 8px;
    background-color: var(--bg-color);
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    animation: modal-fade-in 0.2s ease-out;
    pointer-events: auto;
}

.profile-header {
    position: relative;
    height: 120px;
}

.profile-banner {
    position: absolute;
    top: 0;             
    left: 0;            
    width: 100%;        
    height: 120px;
    background-color: var(--accent-color);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.avatar-wrapper {
    position: relative;
    width: 40px; 
    height: 40px;
    flex-shrink: 0;
    margin-right: 12px;
}

.friend-list-item .avatar-wrapper,
.participant-item .avatar-wrapper {
    width: 32px;
    height: 32px;
    margin-right: 10px;
}

#user-panel .avatar-wrapper {
    width: 38px;
    height: 38px;
    margin-right: 0;
}

.profile-avatar-wrapper {
    position: absolute;
    bottom: -40px;
    left: 16px;
}

#user-profile-modal .profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 4px solid var(--bg-color);
    background-color: var(--hover-bg);
}

.profile-actions {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 8px;
}

.profile-action-btn {
    background-color: rgba(0,0,0,0.4);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
}

.profile-body {
    padding: 60px 16px 16px 16px;
}

#profile-username {
    margin: 0;
    font-size: 24px;
}

#profile-bio {
    font-size: 14px;
    color: var(--text-color-muted);
    min-height: 20px;
}
.profile-bio-text { 
    font-size: 14px;
    color: var(--text-color);
    min-height: 20px;
    margin-top: 16px;
}
.profile-divider {
    height: 1px;
    background-color: var(--container-border);
    margin: 16px 0;
}

.profile-info h4 {
    font-size: 12px;
    color: var(--text-color-muted);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.profile-info p {
    margin-top: 0;
}

#profile-context-menu {
    position: absolute;
    background-color: var(--bg-color);
    border: 1px solid var(--container-border);
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    width: 180px;
    z-index: 1003;
}
#profile-context-menu button {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: var(--red-accent);
}
#profile-context-menu button:hover {
    background-color: var(--hover-bg);
}
/* --- User Report --- */
#report-form label {
    display: block;
    margin-top: 1rem;
    margin-bottom: 0.25rem;
    font-weight: bold;
    font-size: 0.9em;
}

#report-form select,
#report-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--container-border);
    border-radius: 5px;
    background: var(--input-bg);
    color: var(--text-color);
}

#report-form textarea {
    min-height: 80px;
    resize: vertical;
}
.report-action-btn {
    background: none;
    border: 1px solid var(--container-border);
    border-radius: 5px;
    padding: 4px 8px;
    margin: 2px;
    cursor: pointer;
    font-size: 12px;
}
.report-action-btn:hover {
    background-color: var(--hover-bg);
}
.resolve-btn {
    border-color: var(--green-accent);
    color: var(--green-accent);
}
.dismiss-btn, .progress-btn {
    border-color: #F59E0B; /* Amber color */
    color: #F59E0B;
}
.delete-btn {
    border-color: var(--red-accent);
    color: var(--red-accent);
}
/* --- Report Status Badge Styles --- */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    text-transform: capitalize;
    white-space: nowrap;
}

.status-badge.status-open,
.status-badge.status-in_progress {
    background-color: rgba(59, 130, 246, 0.2);
    color: #3B82F6;
}
body.dark-mode .status-badge.status-open,
body.dark-mode .status-badge.status-in_progress {
    background-color: rgba(96, 165, 250, 0.2);
    color: #93C5FD;
}

.status-badge.status-resolved {
    background-color: rgba(34, 197, 94, 0.2);
    color: #16A34A;
}
body.dark-mode .status-badge.status-resolved {
    background-color: rgba(74, 222, 128, 0.2);
    color: #86EFAC;
}

.status-badge.status-dismissed {
    background-color: rgba(107, 114, 128, 0.2);
    color: #6B7280;
}
body.dark-mode .status-badge.status-dismissed {
    color: #9CA3AF;
}
/* --- NEW: Role Management UI Styles --- */

/* This makes the two columns fill the space correctly */
#room-settings-content {
    display: flex;
    flex-grow: 1;
    overflow: hidden; /* Prevents content from breaking out */
}

#roles-list-sidebar {
    width: 220px;
    flex-shrink: 0;
    background-color: var(--input-bg);
    padding: 1rem;
    border-right: 1px solid var(--container-border);
    display: flex;
    flex-direction: column;
}

#roles-list-sidebar h3 {
    margin-top: 0;
}

#roles-list {
    flex-grow: 1;
    overflow-y: auto; /* Allows the role list itself to scroll if needed */
}

.role-list-item {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: var(--text-color);
    border-radius: 5px;
    font-size: 14px;
    margin-bottom: 4px;
}

.role-list-item:hover {
    background-color: var(--hover-bg);
}

.role-list-item.active {
    background-color: var(--accent-color);
    color: var(--accent-color-text);
}

#create-role-btn {
    margin-top: 1rem;
    width: 100%;
    padding: 10px;
}

#role-editor-content {
    flex-grow: 1;
    padding: 1rem 2rem;
    /* This is the key to making the permissions scroll! */
    overflow-y: auto;
}

.permission-category-header {
    text-transform: uppercase;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-color-muted);
    margin-top: 24px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--container-border);
}
/* --- NEW: Member Group Header Styles --- */
.member-group-header {
    padding: 24px 8px 8px 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-color-muted);
    text-transform: uppercase;
}
.context-menu-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 3px;
    cursor: pointer;
}
.context-menu-checkbox:hover {
    background-color: var(--hover-bg);
}
/* --- Main Chat Area --- */
#main-content-area {
    height: 100%;
    flex-grow: 1;
}

.chat-window {
    width: 100%;
    height: 100%;
    flex-grow: 1;
    display: none;
    flex-direction: row;
    background-color: var(--bg-color);
}

.chat-window.active {
    display: flex;
}

.chat-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid var(--container-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header h2 {
    margin: 0;
}

.room-code-display {
    font-size: 14px;
    color: #888;
}

.room-code-display span {
    font-weight: bold;
    user-select: all;
    cursor: pointer;
}

.messages-list {
    list-style-type: none;
    margin: 0;
    padding: 1rem;
    flex-grow: 1;
    overflow-y: auto;
}
.input-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    opacity: 0.7;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px; 
    color: var(--text-color);
}

.input-action-btn:hover {
    opacity: 1;
}
.message-form {
    order: 3;
    flex-shrink: 0; 
}

.message-input-wrapper {
    display: flex;
    align-items: center;
    flex-grow: 1;
    background-color: var(--input-bg);
    border: 1px solid var(--container-border);
    border-radius: 20px;
    padding: 0 8px;
}

.message-input {
    border: none;
    padding: 0.75rem;
    flex-grow: 1;
    background-color: transparent;
    color: var(--text-color);
    outline: none;
}

#file-upload-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: 8px;
    opacity: 0.6;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#file-upload-btn:hover {
    opacity: 1;
}

#file-upload-btn svg {
    width: 24px;
    height: 24px;
    fill: var(--text-color);
}

.message-item {
    display: flex;
    position: relative;
    padding: 8px 16px;
}
.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 16px;
    background-color: var(--hover-bg);
    flex-shrink: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}
.pfp, .message-avatar, .participant-avatar {
    position: static;
    margin-right: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.message-username {
    font-weight: bold;
    margin-right: 8px;
}

.message-timestamp {
    font-size: 12px;
    color: #888;
}

.message-text {
    font-size: var(--chat-font-size, 1rem); 
    line-height: 1.4;
    word-break: break-word;
}
.message-text.jumbo-emojis {
    font-size: calc(var(--chat-font-size, 1rem) * 2.5); 
    line-height: 1.1;
}
.message-text a {
    color: var(--link-color);
}

.message-text img {
    max-width: 300px;
    max-height: 200px;
    border-radius: 5px;
    margin-top: 5px;
    cursor: pointer;
}

.message-text .file-attachment {
    display: flex;
    align-items: center;
    background-color: var(--hover-bg);
    border: 1px solid var(--container-border);
    padding: 10px;
    border-radius: 5px;
    margin-top: 5px;
    text-decoration: none;
    color: var(--text-color);
}

.message-text .file-attachment:hover {
    background-color: var(--container-border);
}

.message-text .file-attachment svg {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    fill: var(--text-color);
}
#picker-container {
    position: absolute;
    z-index: 1004;
}

body.dark-mode emoji-picker {
    --background: var(--container-bg);
    --border-color: var(--container-border);
    --input-background: var(--input-bg);
    --text-color: var(--text-color);
    --secondary-text-color: #aaa;
}

/* --- Participant Sidebar --- */
.participant-list-sidebar {
    width: 240px;
    border-left: 1px solid var(--container-border);
    background-color: var(--container-bg);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    flex-shrink: 0;
}

.participant-list-sidebar h3 {
    margin-top: 0;
}

.participant-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
}

.participant-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 5px;
    border-radius: 3px;
    cursor: pointer;
}

.participant-item:hover {
    background-color: var(--hover-bg);
}

.participant-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
    background-color: #ccc;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.participant-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.participant-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: absolute;
    bottom: -2px;
    right: -2px;
    border: 2px solid var(--container-bg);
}
.status-circle, .participant-status-dot {
    background-color: #95a5a6; 
}

.status-circle.online, .participant-status-dot.online {
    background-color: #2ecc71; 
}

.status-circle.idle, .participant-status-dot.idle {
    background-color: #f1c40f; 
}

.status-circle.do-not-disturb, .participant-status-dot.do-not-disturb {
    background-color: #e74c3c; 
}
.status-circle-lg.do-not-disturb {
    background-color: #e74c3c; /* Red color for the status selection menu */
}
.status-circle.offline, .participant-status-dot.offline,
.status-circle.invisible, .participant-status-dot.invisible {
    background-color: #95a5a6; 
}

/* User Panel Avatar Status */
#user-avatar-main {
    position: relative;
}

#user-avatar-main .participant-status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border: 3px solid var(--hover-bg);
}

/* Participant List Avatar Status */
.pfp .participant-status-dot, 
.avatar-wrapper .participant-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    border: 3px solid var(--bg-color); 
}
.friend-list-item .participant-status-dot,
.participant-item .participant-status-dot {
    border-width: 2px;
}
/* Status Selection Context Menu */
#status-context-menu {
    position: fixed; 
    background-color: var(--nav-bg);
    border: 1px solid var(--container-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 220px;
    z-index: 1002;
    padding: 8px;
}

#status-context-menu button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: var(--text-color);
    border-radius: 5px;
    font-size: 14px;
}

#status-context-menu button:hover {
    background-color: var(--hover-bg);
}

.status-circle-lg {
    height: 12px;
    width: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-circle-lg.online { background-color: #2ecc71; }
.status-circle-lg.idle { background-color: #f1c40f; }
.status-circle-lg.do-not-disturb { background-color: #e74c3c; }
.status-circle-lg.invisible { background-color: #95a5a6; }
.profile-secondary-text {
    font-size: 12px;
    color: var(--text-color-muted);
    margin: -4px 0 10px 0; 
}
/* --- PROFILE PREVIEW STYLES --- */
.profile-preview-wrapper {
    background-color: var(--bg-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 2rem;
    border: 1px solid var(--container-border);
}

.profile-preview-wrapper .profile-modal-content {
    position: static;
    width: auto;
    box-shadow: none;
}

.profile-preview-wrapper .profile-header {
    min-height: 120px; 
}
/* --- Modals --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent; 
    pointer-events: none; 
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 6000;
}

#user-profile-modal {
    z-index: 1002;
}

.modal-content {
    background: var(--nav-bg); 
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--container-border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2); 
    width: 90%;
    max-width: 400px;
    pointer-events: auto;
    animation: modal-fade-in 0.2s ease-out; 
}
@keyframes modal-fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-color);
}

.modal-body input {
    width: calc(100% - 22px);
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--container-border);
    border-radius: 5px;
    background: var(--input-bg);
    color: var(--text-color);
}

.modal-body button {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: none;
    background: var(--button-bg);
    color: var(--button-text);
    cursor: pointer;
}

.modal-tabs {
    display: flex;
    margin-bottom: 1rem;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-color);
}

.tab-btn.active {
    border-bottom-color: var(--link-color);
}


/* --- Friends List --- */
.friend-section {
    margin-bottom: 1.5rem;
}

.friend-list-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 5px;
    cursor: pointer;
    justify-content: space-between;
    position: relative;
}

.friend-list-item:hover {
    background-color: var(--hover-bg);
}

.friend-list-item.active {
    background-color: var(--hover-bg);
    font-weight: bold;
}

.friend-list-item.has-notification::before {
    content: '●';
    color: var(--red-accent);
    position: absolute;
    left: -5px;
    font-size: 14px;
}


.action-buttons button {
    margin-left: 0.5rem;
    padding: 5px 10px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
}

.accept-btn {
    background-color: var(--green-accent);
    color: white;
}

.reject-btn {
    background-color: var(--red-accent);
    color: white;
}

/* --- Voice Chat --- */
.voice-channel-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 1rem;
    border-radius: 5px;
    cursor: pointer;
}
.voice-channel-item:hover {
    background-color: var(--hover-bg);
}
.voice-channel-item.connected {
    background-color: #374151;
    color: white;
}
.voice-users {
    margin-top: 5px;
    padding-left: calc(1rem + 20px);
}
.voice-user {
    display: flex;
    align-items: center;
    font-size: 14px;
    margin-bottom: 4px;
}
.voice-user .pfp {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    transition: box-shadow 0.2s ease-in-out;
    border-radius: 50%;
    border: 2px solid transparent;
}
.voice-user.speaking .pfp {
    border-color: var(--green-accent);
    box-shadow: 0 0 8px 1px var(--green-accent);
}
#voice-connection-panel {
    padding: 0.5rem 1rem;
}
#voice-connection-info {
    font-size: 14px;
    margin-bottom: 8px;
}
#voice-connection-info strong {
    color: var(--green-accent);
}
#voice-controls {
    display: flex;
    justify-content: space-around;
}
#voice-controls button {
    font-size: 20px;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    opacity: 0.7;
}
#voice-controls button:hover {
    opacity: 1;
}
#voice-controls button.active {
    opacity: 1;
    color: var(--red-accent);
}
/* --- VIDEO & SCREEN SHARE GRID STYLES --- */
#video-grid-container {
    width: 100%;
    height: 100%;
    display: grid;
    gap: 16px;
    padding: 16px;
    box-sizing: border-box;
    align-content: center; /* This is key for centering the whole grid block */
}

/* Default state for 5+ users, using auto-fit */
#video-grid-container {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* 1 participant: Centered and not full-width */
#video-grid-container.participant-count-1 {
    grid-template-columns: minmax(0, 1fr);
    max-width: 75%; /* Adjust as needed */
    margin: auto;
}

/* 2 participants: Side-by-side */
#video-grid-container.participant-count-2 {
    grid-template-columns: 1fr 1fr;
    align-items: center;
}

/* 3 participants: Two on top, one centered below */
#video-grid-container.participant-count-3 {
    grid-template-columns: 1fr 1fr;
    align-items: center;
}
.video-tile.third-participant-tile {
    grid-column: 1 / span 2; /* Make the third tile span the full width */
    justify-self: center;    /* Center the tile itself in the spanned columns */
    width: 50%;              /* The tile's width is 50% of the grid's width */
}

/* 4 participants: A 2x2 grid */
#video-grid-container.participant-count-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

/* Focused View for Screen Share */
.video-tile.focused {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000; /* Make sure it's on top of other tiles */
    border-radius: 0;
}

.video-tile {
    position: relative;
    aspect-ratio: 16 / 9;
    background-color: var(--nav-bg);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.video-tile.can-focus {
    cursor: pointer; /* Cursor for screen shares */
}

/* This will hide the main chat view when the video grid is active */
#chat-view-wrapper.hidden {
    display: none;
}
#chat-view-wrapper {
    width: 100%;
    height: 100%;
}
/* --- Screen Share --- */
#screen-share-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 50; 
    display: flex;
    align-items: center;
    justify-content: center;
}
#screen-share-video {
    width: 100%;
    height: 100%;
    object-fit: contain; 
}
.screen-share-info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
}
#voice-controls #screen-share-btn.active {
    opacity: 1;
    color: var(--green-accent);
}
.chat-window.active {
    display: flex !important;
}

#screen-share-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #000;
  z-index: 50; 
  display: flex;
  align-items: center;
  justify-content: center;
}

#screen-share-overlay video {
  width: 100%;
  height: 100%;
  object-fit: contain; 
}

/* --- Utility & Misc --- */
.hidden {
    display: none !important;
}

.status-circle {
    height: 10px;
    width: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    flex-shrink: 0;
}

.online {
    background-color: #2ecc71;
}

.offline {
    background-color: #95a5a6;
}

#user-context-menu, #room-context-menu, #channel-context-menu {
    position: absolute;
    background-color: var(--bg-color);
    border: 1px solid var(--container-border);
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 100;
    width: 180px;
}

#user-context-menu button, #room-context-menu button, #channel-context-menu button {
    display: block;
    width: 100%;
    padding: 10px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    color: var(--text-color);
}

#user-context-menu button:hover, #room-context-menu button:hover, #channel-context-menu button:hover {
    background-color: var(--hover-bg);
}

#user-context-menu button:disabled {
    color: #888;
    cursor: not-allowed;
}

#room-context-menu #delete-room-btn, #channel-context-menu #delete-channel-btn {
    color: var(--red-accent);
}
#room-context-menu #delete-room-btn:hover, #channel-context-menu #delete-channel-btn:hover {
    background-color: var(--red-accent);
    color: white;
}

.nav-icon-circle .notification-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 10px;
    height: 10px;
    background-color: var(--red-accent);
    border-radius: 50%;
    border: 2px solid var(--nav-bg);
}

.pfp {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 10px;
    background-color: #ccc;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    overflow: hidden;
}

.pfp img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.room-title-container {
    padding: 1rem;
}

.room-title-container.clickable-header {
    cursor: pointer;
    position: relative;
    border-radius: 5px;
}

.room-title-container.clickable-header:hover {
    background-color: var(--hover-bg);
}
/* --- Admin Panel Styles --- */
.admin-section {
    padding: 1rem;
    border-bottom: 1px solid var(--container-border);
}
#announcement-form textarea {
    width: calc(100% - 22px);
    min-height: 60px;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--container-border);
    border-radius: 5px;
    background: var(--input-bg);
    color: var(--text-color);
    resize: vertical;
}
#announcement-form button {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: none;
    background: var(--button-bg);
    color: var(--button-text);
    cursor: pointer;
}
.admin-nav-tabs {
    display: flex;
    border-bottom: 1px solid var(--container-border);
    margin-bottom: 1rem;
}
.admin-tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-color);
    font-size: 1em;
}
.admin-tab-btn.active {
    border-bottom-color: var(--accent-color);
    font-weight: bold;
}
#admin-reports-wrapper td, 
#admin-reports-wrapper th {
    padding: 12px 16px;
}

.report-details-cell {
    max-width: 300px;
    white-space: pre-wrap; 
    word-break: break-word;
}
/* --- System & Announcement Message Style (Informational Box) --- */
.message-item.announcement {
    background-color: var(--hover-bg);
    border-radius: 8px;
    padding: 1rem;
    margin: 8px 0;
}

.message-item.announcement .message-avatar {
    display: none;
}

.message-item.announcement .message-content {
    margin-left: 0;
    padding: 0;
    border-left: none; 
    background-color: transparent;
}

.message-item.announcement .message-username {
    color: var(--green-accent);
    font-weight: bold;
}

.message-item.announcement .message-username::before {
    content: '📢';
    margin-right: 8px;
    font-size: 1.2em;
}
#admin-panel-container {
    padding: 1rem;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}
#admin-panel-container h2 {
    margin-top: 0;
}
#admin-room-list {
    flex-grow: 1;
    overflow-y: auto;
}
.admin-room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--container-border);
}
.admin-room-item:last-child {
    border-bottom: none;
}
.admin-room-info {
    display: flex;
    flex-direction: column;
}
.admin-room-info strong {
    font-size: 1.1em;
}
.admin-room-info span {
    font-size: 0.9em;
    color: #888;
}
.admin-room-actions button {
    margin-left: 8px;
    padding: 5px 10px;
    border: 1px solid var(--container-border);
    border-radius: 5px;
    cursor: pointer;
    background: var(--container-bg);
    color: var(--text-color);
}
.admin-room-actions .delete-btn {
    border-color: var(--red-accent);
    color: var(--red-accent);
}
.admin-room-actions .delete-btn:hover {
    background-color: var(--red-accent);
    color: white;
}
.action-btn.ban-btn {
    color: var(--red-accent);
}
.action-btn.unban-btn {
    color: var(--green-accent);
}
.action-btn:disabled {
    color: #888;
    cursor: not-allowed;
    opacity: 0.5;
}
/* --- New Admin Dashboard Styles --- */
#admin-dashboard-wrapper {
    padding: 1rem;
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#admin-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.stat-card {
    flex-grow: 1;
    background: var(--container-bg);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--container-border);
}

.stat-card h4 {
    margin-top: 0;
    color: #888;
    font-size: 0.9em;
}

.stat-card p {
    margin-bottom: 0;
    font-size: 2em;
    font-weight: bold;
}

#admin-user-management {
    margin-top: 2rem;
    flex-shrink: 0;
}

.table-wrapper {
    overflow-x: auto;
}

#admin-user-management table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

#admin-user-management th,
#admin-user-management td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--container-border);
}

#admin-user-management th {
    background-color: var(--container-bg);
}

/* ADDED MESSAGE ACTION STYLES */
.message-item:hover .message-actions {
    opacity: 1;
}

.message-actions {
    position: absolute;
    top: -10px;
    right: 10px;
    display: flex;
    gap: 4px;
    background-color: var(--container-bg);
    border: 1px solid var(--container-border);
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    z-index: 5;
}

.action-btn {
    background: var(--accent-color);
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    border-radius: 4px;
    color : var(--text-color);
}

.action-btn:hover {
    background-color: var(--hover-bg);
}

.message-edited-marker {
    font-size: 10px;
    color: #888;
    margin-left: 8px;
}

/* Edit Message Styles */
.edit-container {
    width: 100%;
}
.edit-textarea {
    width: calc(100% - 20px);
    padding: 10px;
    border-radius: 5px;
    border: 1px solid var(--container-border);
    background-color: var(--input-bg);
    color: var(--text-color);
    min-height: 50px;
    resize: vertical;
}
.edit-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}
.edit-actions button {
    padding: 6px 12px;
    border-radius: 5px;
    border: none;
    cursor: pointer;
}
.edit-save-btn {
    background-color: var(--green-accent);
    color: white;
}
.edit-cancel-btn {
    background-color: var(--container-border);
}

/* Reaction Styles */
.message-reactions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}
.reaction-chip {
    display: flex;
    align-items: center;
    gap: 4px;
    background-color: var(--hover-bg);
    border: 1px solid var(--container-border);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.reaction-chip:hover {
    border-color: var(--link-color);
}
.reaction-chip.reacted { 
    background-color: var(--link-color);
    color: white;
    border-color: var(--link-color);
}

/* --- Mention & Suggestion Styles --- */
.mention {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--accent-color);
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 5px;
}

.mention.self-mention {
    background-color: var(--accent-color);
    color: var(--accent-color-text);
    font-weight: bold;
}

.message-item.has-self-mention {
    background-color: rgba(79, 70, 229, 0.05);
    border-left: 3px solid var(--accent-color);
}

#mention-suggestions-popup {
    position: absolute;
    bottom: 75px; 
    left: 1rem;   
    width: 300px;
    max-height: 200px;
    overflow-y: auto;
    background-color: var(--nav-bg); 
    border: 1px solid var(--container-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 10;
}

.mention-suggestion-item {
    padding: 10px;
    cursor: pointer;
}

.mention-suggestion-item:hover {
    background-color: var(--hover-bg);
}
.mention-suggestion-item.selected {
    background-color: var(--accent-color);
    color: var(--accent-color-text);
}
/* Emoji Picker Styles */
#emoji-picker {
    position: absolute;
    background-color: var(--bg-color);
    border: 1px solid var(--container-border);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    display: flex;
    gap: 8px;
    z-index: 100;
}
#emoji-picker span {
    font-size: 24px;
    cursor: pointer;
    transition: transform 0.1s;
}
#emoji-picker span:hover {
    transform: scale(1.2);
}

.mobile-nav-toggle, .mobile-members-toggle {
    display: none;
}  

@media (max-width: 768px) {
    #chat-container {
        flex-direction: column;
        overflow-x: hidden;
    }

    #top-nav {
        flex-wrap: wrap;
        height: auto;
        padding: 8px;
    }

    #chat-content-wrapper {
        flex-direction: column;
    }

    #secondary-nav, .participant-list-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        height: 100%;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        box-shadow: 2px 0 10px rgba(0,0,0,0.2);
        width: 280px;
    }

    #secondary-nav.visible {
        transform: translateX(0);
    }
    
    .participant-list-sidebar {
       left: auto;
       right: 0;
       transform: translateX(100%);
    }
    
    .participant-list-sidebar.visible {
        transform: translateX(0);
    }

    .chat-main {
        width: 100%;
    }

    .mobile-nav-toggle, .mobile-members-toggle {
        display: block;
        cursor: pointer;
        font-size: 24px;
        background: none;
        border: none;
        color: var(--text-color);
    }

    .chat-header h2 {
        flex-grow: 1;
        text-align: center;
    }
    
    #page-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0,0,0,0.5);
        z-index: 1000;
        display: none;
    }
    
    #page-overlay.visible {
        display: block;
    }
}


/* --- New Profile Card DM Styles --- */

#profile-dm-form {
    padding: 0; /* Remove horizontal padding from the form itself */
    margin-top: 16px; /* Keep the space from the divider */
}

/* The input now correctly uses the padding of its parent, making it wider */
#profile-dm-input {
    width: 100%;
    background-color: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--container-border);
    border-radius: 5px;
    padding: 10px;
    font-size: 14px;
    box-sizing: border-box;
    outline: none;
}

#profile-dm-input::placeholder {
    color: var(--text-color-muted);
    opacity: 1;
}

/* Styles for the "Not Friends" message and quote */
#profile-not-friends-message {
    text-align: center;
    padding: 10px 0;
}

.not-friends-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color-muted);
    margin: 0 0 12px 0;
}

#profile-random-quote {
    font-size: 13px;
    font-style: italic;
    color: var(--text-color-muted);
    margin: 0;
    padding: 0 10px;
    border-left: 3px solid var(--container-border);
}