/* SimpleMessenger - Complete CSS Rewrite (Apple HIG / iMessage Vibe) */
:root {
    /* Color Palette - Refined Lighter Dark Theme */
    --bg-base: #1c1c1f;
    --bg-surface: #252529;
    --bg-surface-elevated: #2c2c31;
    --accent-blue: #0a84ff;
    --accent-blue-hover: #007aff;
    --text-primary: #ffffff;
    --text-secondary: #a1a1a6;
    --text-tertiary: #7c7c82;
    --divider-color: rgba(255, 255, 255, 0.08);

    /* Input & Bubbles */
    --input-bg: #323236;
    --bubble-received: #3a3a3f;
    --bubble-sent: var(--accent-blue);

    /* Typography & Radiology */
    --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --radius-bubble: 16px;
    --radius-bubble-tight: 4px;
    --radius-ui: 16px;
}

/* Base Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body,
html {
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-family);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    /* Prevent body scroll */
}

/* App Containers */
.app-container {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
}

.view {
    display: none;
    width: 100%;
    height: 100%;
}

.view.active {
    display: flex;
}

/* ==========================================================================
   AUTH VIEW
   ========================================================================== */
/* --- NEW FULL SCREEN AUTH --- */
.full-screen-auth {
    display: none;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-base);
    /* Pure black base */
    width: 100%;
}

#auth-view.active {
    display: flex;
}

.auth-content {
    width: 100%;
    max-width: 480px;
    padding: 0 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: transparent;
}

.brand-huge {
    font-size: 80px;
    font-weight: 700;
    letter-spacing: -3px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #a0a0a0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
    text-align: center;
}

.auth-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 56px;
    font-weight: 400;
    text-align: center;
    width: 100%;
    line-height: 1.4;
}

.auth-form-clean {
    display: flex;
    flex-direction: column;
    gap: 28px;
    width: 100%;
}

.clean-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.clean-input-group label {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 8px;
}

.clean-input-group input {
    background-color: var(--input-bg);
    border: 1px solid var(--divider-color);
    border-radius: 20px;
    padding: 18px 24px;
    color: var(--text-primary);
    font-size: 18px;
    outline: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.clean-input-group input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.15);
    background-color: var(--bg-surface-elevated);
}

.clean-button-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

button {
    font-family: inherit;
    transition: all 0.2s ease;
}

.btn-solid {
    background-color: var(--accent-blue);
    color: white;
    border: none;
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s;
}

.btn-solid:active {
    transform: scale(0.98);
}

.btn-solid:hover {
    background-color: var(--accent-blue-hover);
}

.btn-outline {
    background-color: transparent;
    color: var(--accent-blue);
    border: 2px solid var(--accent-blue);
    padding: 18px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-outline:hover {
    background-color: rgba(43, 166, 255, 0.1);
}

.error-msg {
    color: #ff453a;
    text-align: center;
    font-size: 15px;
    min-height: 20px;
    margin-top: -8px;
}

.accounts-subtitle {
    margin-bottom: 32px;
}

/* Account Picker Specifics */
.accounts-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 24px;
    justify-content: center;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    padding: 10px;
}

.account-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    background-color: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 24px;
    border-radius: 28px;
    width: 140px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.account-card:hover {
    transform: translateY(-8px) scale(1.02);
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--accent-blue);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
}

.account-card .avatar {
    width: 72px;
    height: 72px;
    font-size: 28px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.account-card .account-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.add-account-card {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.2);
    background-color: transparent;
}

.add-account-card:hover {
    background-color: rgba(10, 132, 255, 0.05);
    border-style: solid;
}

.add-avatar {
    background-color: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
}

.btn-text-only {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 8px 16px;
    border-radius: 12px;
}

.btn-text-only:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   CHAT VIEW (MESSENGER LAYOUT)
   ========================================================================== */
.messenger-layout {
    display: flex;
    width: 100%;
    height: 100%;
    flex-direction: row;
    /* Explicitly state row layout */
}

/* Sidebar */
.sidebar {
    flex: 0 0 380px;
    /* Increased from 320px */
    background-color: var(--bg-surface);
    border-right: 1px solid var(--divider-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    z-index: 10;
}

.sidebar-header {
    padding: 24px 20px 16px 20px;
}

.sidebar-header h2 {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.user-info {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#settings-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary); /* Fixed: ensures icon is not black */
    cursor: pointer;
    padding: 8px;
    opacity: 0.8;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

#settings-btn:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 20px; /* Align with sidebar padding */
}

.search-container::before {
    content: "";
    position: absolute;
    left: 14px;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.6;
    pointer-events: none;
}

.search-container input {
    width: 100%;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--divider-color);
    padding: 10px 16px 10px 40px;
    border-radius: var(--radius-ui);
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
    font-family: inherit;
}

.search-container input:focus {
    border-color: var(--accent-blue);
    background-color: var(--input-bg);
}

.chat-list-section {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 16px 12px 8px 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chat-list {
    flex: 1;
    /* Take remaining vertical space */
    overflow-y: auto;
    padding: 0 8px; /* Adjusted to align content (8px list + 12px preview padding = 20px) */
}

.chat-preview {
    display: flex;
    align-items: center;
    padding: 12px;
    gap: 14px;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.chat-preview:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.chat-preview.active {
    background-color: rgba(10, 132, 255, 0.12);
    position: relative;
}

.chat-preview.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 4px;
    background-color: var(--accent-blue);
    border-radius: 0 4px 4px 0;
}

.chat-preview.active .preview-info h3 {
    color: var(--text-primary);
}

.chat-preview.active .preview-info p {
    color: var(--accent-blue);
    opacity: 0.8;
}

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--bg-surface-elevated);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

.chat-preview .avatar {
    width: 52px;
    height: 52px;
    font-size: 19px;
}

.avatar.large {
    width: 100px;
    height: 100px;
    font-size: 40px;
}

.status-emoji-tag {
    margin-left: 6px;
    font-size: 0.9em;
}

.preview-info {
    flex: 1;
    overflow: hidden;
}

.preview-info h3 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.preview-info p {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.logout-btn {
    padding: 16px 20px;
    background: transparent;
    border: none;
    border-top: 1px solid var(--divider-color);
    color: var(--text-secondary);
    text-align: left;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.logout-btn:hover {
    color: #ff453a;
}

/* Main Chat Area */
.chat-main {
    flex: 1;
    /* Take all remaining horizontal space */
    min-width: 0;
    /* Important: prevents flexing beyond screen width if content is long */
    display: flex;
    flex-direction: column;
    background-color: var(--bg-base);
    height: 100%;
    position: relative;
}

.chat-header {
    flex: 0 0 76px;
    height: 76px;
    flex-shrink: 0;
    padding: 0 28px;
    display: flex;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid var(--divider-color);
    background-color: rgba(37, 37, 41, 0.85);
    /* Semi-transparent for blur */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 10;
}

.chat-header .avatar {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
}

.chat-header-info {
    display: flex;
    flex-direction: column;
}

.chat-header-info h3 {
    font-size: 19px;
    font-weight: 600;
}

.online-status {
    font-size: 13px;
    color: var(--accent-blue);
    /* Subtle blue for online */
}

/* Messages Area */
.messages-container {
    flex: 1;
    padding: 24px 0; /* Vertical padding only, let wrappers handle horizontal */
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Re-added gap for consistent spacing between message blocks */
    background-color: var(--bg-base);
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05)),
        url('images/chat_bg.png');
    background-repeat: repeat;
    background-attachment: fixed;
    background-size: 1000px;
    background-blend-mode: overlay; 
    width: 100%;
}

.message-main-wrapper, 
.date-divider {
    width: 100%;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.date-divider {
    text-align: center;
    margin: 8px auto; /* Reduced margin since we have parent gap */
}

.date-divider span {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
}

/* BUBBLES & GROUPING (THE CANDY) */

/* Structural layout with Avatar for Received messages */
.message-main-wrapper {
    display: flex;
    width: 100%;
    align-items: flex-end;
    /* Align avatar to bottom of message */
    gap: 10px;
}

.message-main-wrapper.sent {
    justify-content: flex-end;
}

.message-main-wrapper.received {
    justify-content: flex-start;
}

.message-avatar {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    font-size: 16px;
    margin-bottom: 2px;
    /* Align visually with bubble tail */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 42px);
    /* Account for avatar + gap */
}

.message-wrapper.sent {
    align-items: flex-end;
}

.message-wrapper.received {
    align-items: flex-start;
}

/* Top Meta Data (Name & Time) - Deprecated */
/* Replaced by embedded .bubble-meta and .internal-sender-name */

.sender-name {
    font-weight: 500;
}

/* The Bubble itself */
.message-bubble {
    padding: 10px 16px;
    /* Scaled up padding */
    font-size: 16px;
    /* Scaled up text */
    line-height: 1.45;
    max-width: 78%;
    /* Increased from 65% for better screen usage */
    width: fit-content;
    word-wrap: break-word;
    position: relative;
    transition: all 0.2s ease;
}

/* Media Attachments */
.message-bubble.media-attachment {
    padding: 0;
    overflow: hidden;
    /* Clips media to the bubble's rounded corners */
}

.message-media {
    max-width: 100%;
    max-height: 350px;
    display: block;
    margin-bottom: 0px;
    object-fit: cover;
    border-radius: 16px; /* Added radius to media */
    overflow: hidden;
}

.message-bubble.media-attachment .message-text {
    display: block;
    padding: 6px 14px;
}

.message-bubble.media-attachment .internal-sender-name {
    padding: 8px 14px 0 14px;
    margin-bottom: 4px;
}

/* No-Text Media (Media Only) */
.message-bubble.media-only {
    background-color: transparent !important;
}

.message-bubble.media-only .message-text {
    display: none;
    /* Hide empty text container */
}

.message-bubble.media-only .bubble-meta {
    background-color: rgba(0, 0, 0, 0.45);
    padding: 3px 6px;
    border-radius: 12px;
    bottom: 6px;
    right: 8px;
    color: #ffffff;
    font-size: 12px;
}

.message-bubble.media-only .delivery-status {
    color: #ffffff;
    /* Make ticks white inside dark pill */
}

.message-bubble.media-only .internal-sender-name {
    position: absolute;
    top: 6px;
    left: 8px;
    background-color: rgba(0, 0, 0, 0.45);
    padding: 2px 8px;
    border-radius: 10px;
    color: #ffffff !important;
    z-index: 2;
    font-size: 14px;
}

/* Inline spacer inside text to push text flow around the absolute positioned meta */
.meta-spacer {
    display: inline-block;
    height: 1px;
}

/* Telegram Style Embedded Meta */
.bubble-meta {
    position: absolute;
    bottom: 5px;
    right: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    /* Translucent white/grey */
    line-height: 1;
    user-select: none;
}

.message-wrapper.sent .bubble-meta {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
}

.message-wrapper.sent .delivery-status {
    color: rgba(255, 255, 255, 0.85);
}

/* Internal Sender Name */
.internal-sender-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    line-height: 1.2;
}

/* Default Received Bubble */
.message-wrapper.received .message-bubble {
    background-color: var(--bubble-received);
    color: var(--text-primary);
    border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-bubble) var(--radius-bubble-tight);
}

/* Received Tail */
.message-main-wrapper.received:not(.grouped) .message-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 20px;
    height: 10px;
    background-color: var(--bubble-received);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
    z-index: -1;
}

/* Default Sent Bubble */
.message-wrapper.sent .message-bubble {
    background-color: var(--bubble-sent);
    color: #ffffff;
    border-radius: var(--radius-bubble) var(--radius-bubble) var(--radius-bubble-tight) var(--radius-bubble);
}

/* Sent Tail */
.message-main-wrapper.sent:not(.grouped) .message-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 20px;
    height: 10px;
    background-color: var(--bubble-sent);
    clip-path: polygon(0 0, 0 100%, 100% 100%);
    z-index: -1;
}

/* --- GROUPING LOGIC --- */
/* When messages are grouped together chronologically from the same user */
.message-main-wrapper.grouped {
    margin-top: -6px;
    /* Pull them closer, counteracting the 8px container gap to 2px */
}

/* Hide meta for grouped messages */
.message-wrapper.grouped .message-meta,
.message-wrapper.grouped .internal-sender-name,
.message-wrapper.grouped .avatar,
.message-main-wrapper.grouped .avatar,
.message-main-wrapper.grouped .internal-sender-name {
    display: none !important;
}

.message-main-wrapper.grouped {
    margin-top: -4px; /* Pull grouped messages closer */
}

/* Inner borders become tighter for grouped messages */
.message-wrapper.received.grouped .message-bubble {
    border-radius: var(--radius-bubble-tight) var(--radius-bubble) var(--radius-bubble) var(--radius-bubble-tight);
}

.message-wrapper.sent.grouped .message-bubble {
    border-radius: var(--radius-bubble) var(--radius-bubble-tight) var(--radius-bubble-tight) var(--radius-bubble);
}

/* Removed external message-meta styling to avoid unused code, relying on embedded bubble-meta */

/* Delivery status specific styling inside bubble */
.delivery-status {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 4px;
    opacity: 0.85;
}

.delivery-status svg {
    display: block;
    stroke-width: 2.5; /* Slightly thicker for the book icon to be visible */
}

/* Input Area */
.input-area-container {
    flex: 0 0 auto;
    padding: 0;
    background-color: var(--bg-base);
    border-top: 1px solid var(--divider-color);
    position: relative;
}

.input-area {
    width: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    max-width: none;
}

.plus-btn {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 50%;
}

.plus-btn:hover {
    color: var(--accent-blue);
    background-color: rgba(10, 132, 255, 0.1);
}

.input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background-color: var(--input-bg);
    border: 1px solid var(--divider-color);
    border-radius: var(--radius-ui);
    padding: 6px 20px;
    min-height: 52px;
}

#message-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 17px;
    outline: none;
    padding: 10px 0;
}

.sticker-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.sticker-btn:hover {
    color: var(--accent-blue);
    background-color: rgba(10, 132, 255, 0.1);
}

.sticker-btn.active {
    color: var(--accent-blue);
    background-color: rgba(10, 132, 255, 0.15);
}

/* Settings Portal Modal (Overhaul) */
.settings-portal {
    background-color: var(--bg-surface) !important;
    border: 1px solid var(--divider-color);
    border-radius: 24px !important;
    padding: 0 !important;
    display: flex;
    overflow: hidden;
    max-width: 900px !important;
    width: 90% !important;
    height: 600px !important;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.settings-sidebar {
    width: 260px;
    background-color: var(--bg-base);
    border-right: 1px solid var(--divider-color);
    display: flex;
    flex-direction: column;
}

.settings-sidebar .sidebar-top {
    padding: 24px 20px 12px 20px;
}

.settings-sidebar h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.settings-nav {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: var(--radius-ui);
    margin: 2px 8px;
    position: relative;
}

.avatar-wrapper {
    position: relative;
    flex-shrink: 0;
    display: flex;
    width: fit-content;
    height: fit-content;
}

.online-indicator {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 16px;
    height: 16px;
    background-color: #2ecc71;
    border: 3px solid var(--bg-surface);
    border-radius: 50%;
    z-index: 2;
    transition: border-color 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Match indicator border to parent background for seamless cutout */
.chat-preview:hover .online-indicator {
    border-color: #2d2d31; 
}

.chat-preview.active .online-indicator {
    border-color: #232d39; 
}

.online-status.online {
    color: #2ecc71;
    font-weight: 500;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: rgba(10, 132, 255, 0.1);
    color: var(--accent-blue);
}

.settings-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-surface);
}

.settings-header {
    padding: 24px 32px 12px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-header h2 {
    font-size: 20px;
    margin: 0;
}

.settings-scroll-area {
    flex: 1;
    padding: 0 32px 32px 32px;
    overflow-y: auto;
}

.settings-section {
    display: none;
}

.settings-section.active {
    display: block;
    max-width: 600px;
}

/* Avatar Edit */
.avatar-edit-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
    padding: 20px 0;
}

.avatar-large-wrapper {
    position: relative;
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
}

.avatar.x-large {
    width: 120px;
    height: 120px;
    font-size: 48px;
    background-color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.avatar-large-wrapper:hover .avatar-overlay {
    opacity: 1;
}

.hint-text {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-top: 12px;
}

/* Form Styles */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-modern-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-modern-group label {
    font-size: 13px;
    font-weight: 500;
    color: #888;
    margin-left: 4px;
}

.input-modern-group input, 
.input-modern-group textarea {
    background-color: var(--bg-base);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: all 0.2s ease;
}

.input-modern-group textarea {
    height: 100px;
    resize: none;
}

.input-modern-group input:focus, 
.input-modern-group textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.15);
}

/* Footer Actions */
.settings-footer {
    padding: 16px 32px;
    border-top: 1px solid var(--divider-color);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    background-color: var(--bg-surface);
}

.settings-footer .btn-cancel {
    padding: 8px 16px;
    border-radius: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px !important; /* Force override of .close-modal font-size */
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-footer .btn-cancel:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.settings-footer .btn-save {
    padding: 10px 24px;
    border-radius: 10px;
    background-color: var(--accent-blue);
    border: none;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-save:hover {
    background-color: var(--accent-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.3);
}

.btn-save:active {
    transform: translateY(0);
}
.emoji-picker {
    display: none;
    position: absolute;
    bottom: 74px;
    /* Right above the input area */
    right: 76px;
    /* Align with the sticker button roughly */
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--divider-color);
    border-radius: var(--radius-ui);
    padding: 12px;
    width: 240px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    z-index: 100;
}

.emoji-picker.active {
    display: block;
    animation: popupFade 0.2s ease-out;
}

@keyframes popupFade {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.emoji-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Prevent horizontal scrollbar */
}

.emoji-list span {
    font-size: 24px;
    text-align: center;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.15s;
    user-select: none;
}

.emoji-list span:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.send-btn {
    background-color: var(--accent-blue);
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-btn svg {
    /* Visual centering correction for the paper-plane icon */
    transform: translate(-1px, 1px);
}

.send-btn:hover {
    background-color: var(--accent-blue-hover);
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

/* ==========================================================================
   CUSTOM OVERFLOWS (SCROLLBARS)
   ========================================================================== */
/* Apply to all scrollable areas */
.chat-list::-webkit-scrollbar,
.messages-container::-webkit-scrollbar,
.emoji-list::-webkit-scrollbar {
    width: 6px;
    /* Thin scrollbar */
    height: 6px;
}

.chat-list::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track,
.emoji-list::-webkit-scrollbar-track {
    background: transparent;
    /* Invisible track */
}

.chat-list::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb,
.emoji-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.chat-list::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover,
.emoji-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Firefox support */
.chat-list,
.messages-container,
.emoji-list {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* --- MODAL --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-surface-elevated);
    width: 100%;
    max-width: 420px;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
    animation: modalScale 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modalScale {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--divider-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 22px;
}

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

.modal-body {
    padding: 28px;
}

.profile-preview-large {
    text-align: center;
    margin-bottom: 32px;
}

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

.settings-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.settings-group input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--divider-color);
    padding: 14px 18px;
    border-radius: 14px;
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.2s;
}

.settings-group input:focus {
    border-color: var(--accent-blue);
    outline: none;
}

.modal-footer {
    padding: 20px 28px;
    background: rgba(255, 255, 255, 0.02);
    text-align: right;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--divider-color);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* --- Welcome Screen --- */
.welcome-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    padding: 20px;
    z-index: 100;
}

.welcome-screen.active {
    display: flex;
}

.welcome-card {
    background: rgba(40, 40, 40, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    padding: 40px;
    max-width: 320px;
    text-align: center;
    animation: fadeInWelcome 0.5s ease-out;
    pointer-events: auto;
}

@keyframes fadeInWelcome {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

#welcome-mascot {
    width: 140px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.2));
    animation: floatMascot 3s ease-in-out infinite;
}

@keyframes floatMascot {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.welcome-card h2 {
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 8px;
    color: white;
}

.welcome-card p {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}

/* Developer Badge */
.developer-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    color: var(--accent-blue);
    vertical-align: middle;
    filter: drop-shadow(0 0 2px rgba(0, 122, 255, 0.3));
}

.developer-badge svg {
    width: 100%;
    height: 100%;
}

/* User Profile Modal Styles */
/* --- User Profile Modal (Simplified) --- */
.profile-card-premium {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--divider-color);
    border-radius: 20px;
    width: 100%;
    max-width: 360px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
}


.close-modal-round {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-surface-elevated);
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.close-modal-round:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.profile-header {
    padding: 32px 24px 20px;
    text-align: center;
}

.avatar-wrapper-large {
    width: 90px;
    height: 90px;
    margin: 0 auto 16px;
}

.avatar-wrapper-large .avatar.large {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    font-size: 36px;
}

.profile-title-group h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 2px;
}

.profile-title-group p {
    font-size: 14px;
    color: var(--text-secondary);
}

.profile-content-scroll {
    padding: 0 24px 24px;
}

.info-grid-simple {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.info-block label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.info-status-text {
    font-size: 14px;
    color: var(--accent-blue);
}

.info-bio-text {
    font-size: 15px;
    color: var(--text-primary);
}

.profile-footer-actions {
    padding: 20px 24px 24px;
    border-top: 1px solid var(--divider-color);
}

.btn-simple-action {
    width: 100%;
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border: 1px solid var(--divider-color);
    padding: 12px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.btn-simple-action:hover {
    background: rgba(255, 255, 255, 0.05);
}

.full-width {
    width: 100%;
}
/* ==========================================================================
   MOBILE RESPONSIVENESS
   ========================================================================== */
.back-btn {
    display: none;
    /* Hidden by default on desktop */
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    margin-right: 8px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .sidebar {
        flex: 1 0 100% !important;
        max-width: 100% !important;
        border-right: none;
    }

    .chat-main {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100dvh;
        z-index: 1000;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .messenger-layout.mobile-chat-active .chat-main {
        transform: translateX(0);
    }

    .back-btn {
        display: flex;
    }

    /* Small Adjustments for Mobile UX */
    .chat-header {
        height: 60px;
        flex: 0 0 60px;
        padding: 0 12px;
    }

    body {
        font-size: 14px;
    }

    .messenger-layout {
        overflow: hidden;
    }

    .messages-container {
        padding: 12px;
    }

    .message-bubble {
        padding: 8px 12px;
        font-size: 14px;
        max-width: 85%;
    }

    .message-text {
        font-size: 14px;
    }

    .input-area-container {
        padding: 6px 10px;
        background-color: var(--bg-base);
        z-index: 1000;
        display: block; /* Change from flex center to standard block to contain input-area */
    }

    .input-area {
        padding: 0;
        gap: 6px;
        display: flex;
        align-items: center; 
        flex-wrap: nowrap; /* CRITICAL: Prevent send button from wrapping out of view */
    }

    .plus-btn {
        flex: 0 0 36px;
        width: 36px;
        height: 36px;
    }

    .input-wrapper {
        min-height: 38px;
        border-radius: 19px;
        padding: 0 12px;
        flex: 1;
        margin-right: 8px; /* MORE SEPARATION */
        background-color: var(--input-bg);
    }

    #message-input {
        font-size: 15px;
        padding: 8px 0;
    }

    .send-btn {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
        background-color: var(--accent-blue);
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
        margin-right: 2px;
    }

    .brand-huge {
        font-size: 52px;
    }

    .auth-content {
        padding: 0 24px;
    }

    .avatar.large {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }
}

/* Settings Mobile Layout (Full Screen Screen) */
@media (max-width: 768px) {
    #settings-modal {
        background: var(--bg-surface); /* Solid background on mobile */
        backdrop-filter: none;
    }

    #settings-modal .settings-portal {
        width: 100% !important;
        height: 100% !important;
        max-width: none !important;
        border-radius: 0 !important;
        border: none;
        flex-direction: column;
        position: relative;
    }

    .settings-sidebar {
        width: 100%;
        border-right: none;
        height: 100%;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .settings-main {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: var(--bg-surface);
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 5;
    }

    .settings-portal.section-active .settings-sidebar {
        transform: translateX(-20%);
    }

    .settings-portal.section-active .settings-main {
        transform: translateX(0);
    }

    .mobile-only {
        display: flex !important;
    }

    .settings-header {
        padding: 16px;
    }
    
    .settings-header .close-modal {
        display: none; /* Hide standard close button on mobile in main settings view? 
                          Actually, we need it in the sidebar to return to chat. */
    }

    .settings-sidebar .sidebar-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px 16px;
    }

    /* Show close button only in sidebar top for mobile */
    .settings-sidebar .sidebar-top::after {
        content: '\d7';
        font-size: 28px;
        color: var(--text-secondary);
        cursor: pointer;
    }

    .header-left {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .settings-scroll-area {
        padding: 0 16px 32px 16px;
    }
}

.mobile-only {
    display: none;
}

/* Status Media Styles */
.status-media-group {
    margin-top: 20px;
}

.status-media-ctrl {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
}


.btn-action-small {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-action-small:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

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

.status-preview-box {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background-color: #121212;
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #444;
    transition: all 0.3s;
    overflow: hidden; /* For video in preview */
}


.status-preview-box::after {
    content: 'GIF';
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
    opacity: 1;
    transition: opacity 0.2s;
}

.status-preview-box.has-image::after {
    opacity: 0;
}

/* Custom Video Player */
.custom-video-player {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    line-height: 0;
    cursor: pointer;
}

.video-controls-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
}

.custom-video-player:hover .video-controls-overlay {
    opacity: 1;
}

.video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 54px;
    height: 54px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 2;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.custom-video-player:hover .video-play-overlay {
    transform: translate(-50%, -50%) scale(1.1);
    background: rgba(0, 0, 0, 0.6);
}

/* Media Viewer Modal */
#media-viewer-modal {
    z-index: 3000;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(15px);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

#media-viewer-modal.active {
    display: flex;
}

.media-viewer-content {
    position: relative;
    width: 90%;
    max-width: 1200px;
    height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
}

#media-viewer-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#media-viewer-container img, 
#media-viewer-container video {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.close-media-viewer {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.close-media-viewer:hover {
    opacity: 1;
}

.v-btn {
    background: none;
    border: none;
    color: white;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.v-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.v-progress-container {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.v-progress-bar {
    width: 0;
    height: 100%;
    background: var(--accent-blue);
    transition: width 0.1s linear;
}

.status-gif {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px;
    min-height: 20px;
    border-radius: 6px;
    object-fit: cover;
    margin-left: 6px;
    vertical-align: middle;
    display: inline-block;
    flex-shrink: 0;
}

.preview-info h3 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.header-left .status-gif {
    width: 24px !important;
    height: 24px !important;
    margin-left: 10px;
}

.user-info-status .status-gif {
    width: 32px !important;
    height: 32px !important;
    margin-top: 8px;
    border-radius: 8px;
}

/* Settings Preview Section */
.settings-preview-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.preview-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 20px;
}

.mock-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.mock-label {
    font-size: 12px;
    color: #555;
    margin-bottom: 12px;
    font-weight: 500;
}

.mock-container .chat-preview {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    pointer-events: none;
    margin-bottom: 0;
}

.mock-container .message-main-wrapper {
    margin: 0;
    padding: 0;
}

.mock-container .message-bubble {
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.mock-avatar {
    flex-shrink: 0;
}

.mock-status-media .status-gif {
    margin-left: 4px;
    margin-top: 0;
    vertical-align: middle;
}
.readonly-notice {
    padding: 16px;
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    border-top: 1px solid var(--divider-color);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.nav-item[data-tab="admin"] {
    color: #ff3b30 !important;
}

.nav-item[data-tab="admin"].active {
    background-color: rgba(255, 59, 48, 0.1) !important;
    color: #ff3b30 !important;
}

.admin-user-search-wrapper {
    margin-top: 12px;
    margin-bottom: 12px;
}

.admin-user-list {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--divider-color);
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.admin-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--divider-color);
}

.admin-user-item:last-child {
    border-bottom: none;
}

.admin-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-item-info .avatar {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

.admin-item-details {
    display: flex;
    flex-direction: column;
}

.admin-item-details h5 {
    font-size: 15px;
    margin: 0;
    font-weight: 600;
}

.admin-item-details p {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

.admin-actions {
    display: flex;
    gap: 8px;
}

.admin-badge {
    font-size: 10px;
    background: var(--accent-blue);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 700;
    margin-left: 8px;
}

.admin-empty-state {
    padding: 32px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ==========================================================================
   CALL UI
   ========================================================================== */
.call-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.call-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.call-overlay .avatar.x-large {
    width: 160px;
    height: 160px;
    font-size: 64px;
    border: 4px solid var(--accent-blue);
    box-shadow: 0 0 50px rgba(10, 132, 255, 0.3);
}

.call-content h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.call-content p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.6);
}

.call-actions {
    display: flex;
    gap: 48px;
}

.call-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.call-btn:hover {
    transform: scale(1.1);
}

.call-btn:active {
    transform: scale(0.9);
}

.call-btn.accept {
    background-color: #34c759;
    box-shadow: 0 0 30px rgba(52, 199, 89, 0.4);
}

.call-btn.decline {
    background-color: #ff3b30;
    box-shadow: 0 0 30px rgba(255, 59, 48, 0.4);
}

.call-btn.mute {
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.call-btn.mute.active {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.call-btn.speaker {
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.call-btn.speaker.active {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.call-btn svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.header-action-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent-blue);
    transform: translateY(-1px);
}

.header-action-btn:active {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(0) scale(0.95);
}

.header-action-btn svg {
    transition: transform 0.2s ease;
}

.header-action-btn:hover svg {
    transform: scale(1.05);
}

.status-notification {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: white;
    padding: 12px 24px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 500;
    z-index: 5000;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.status-notification.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

