/* ReChat - WhatsApp Web Theme */
/* Default: Preset 1 - WhatsApp Dark */
:root, [data-theme="whatsapp-dark"] {
    --bg-app: #0b141a;
    --bg-chat: #0b141a;
    --bg-header: #202c33;
    --bg-input-bar: #202c33;
    --bg-input-field: #2a3942;
    --bg-card: #111b21;
    --bubble-sent: #005c4b;
    --bubble-received: #202c33;
    --text-primary: #e9edef;
    --text-secondary: #8696a0;
    --emerald-accent: #00a884;
    --emerald-hover: #02906f;
    --border-color: #222e35;
    --blue-check: #53bdeb;
    --mention-bg: rgba(0, 168, 132, 0.2);
    --mention-text: #00a884;
    --wallpaper-opacity: 0.06;
}

/* Preset 2: WhatsApp Light */
[data-theme="whatsapp-light"] {
    --bg-app: #efeae2;
    --bg-chat: #efeae2;
    --bg-header: #ffffff;
    --bg-input-bar: #f0f2f5;
    --bg-input-field: #ffffff;
    --bg-card: #ffffff;
    --bubble-sent: #d9fdd3;
    --bubble-received: #ffffff;
    --text-primary: #111b21;
    --text-secondary: #667781;
    --emerald-accent: #008069;
    --emerald-hover: #017560;
    --border-color: #e9edef;
    --blue-check: #53bdeb;
    --mention-bg: rgba(0, 128, 105, 0.15);
    --mention-text: #008069;
    --wallpaper-opacity: 0.12;
}

/* Preset 3: Discord Midnight */
[data-theme="discord-midnight"] {
    --bg-app: #1e1f22;
    --bg-chat: #313338;
    --bg-header: #2b2d31;
    --bg-input-bar: #2b2d31;
    --bg-input-field: #383a40;
    --bg-card: #2b2d31;
    --bubble-sent: #383a40;
    --bubble-received: #2b2d31;
    --text-primary: #f2f3f5;
    --text-secondary: #949ba4;
    --emerald-accent: #5865f2;
    --emerald-hover: #4752c4;
    --border-color: #1f2023;
    --blue-check: #5865f2;
    --mention-bg: rgba(88, 101, 242, 0.25);
    --mention-text: #c9cdfb;
    --wallpaper-opacity: 0.03;
}

/* Preset 4: Cyberpunk Neon */
[data-theme="cyberpunk-neon"] {
    --bg-app: #0a0a12;
    --bg-chat: #0d0d1a;
    --bg-header: #131325;
    --bg-input-bar: #131325;
    --bg-input-field: #1e1b38;
    --bg-card: #15142b;
    --bubble-sent: #2a164d;
    --bubble-received: #171530;
    --text-primary: #e0f2fe;
    --text-secondary: #93c5fd;
    --emerald-accent: #00f0ff;
    --emerald-hover: #38bdf8;
    --border-color: #272250;
    --blue-check: #00f0ff;
    --mention-bg: rgba(0, 240, 255, 0.2);
    --mention-text: #00f0ff;
    --wallpaper-opacity: 0.08;
}

/* Preset 5: Nord Frost */
[data-theme="nord-frost"] {
    --bg-app: #242933;
    --bg-chat: #2e3440;
    --bg-header: #3b4252;
    --bg-input-bar: #3b4252;
    --bg-input-field: #434c5e;
    --bg-card: #3b4252;
    --bubble-sent: #434c5e;
    --bubble-received: #383f4f;
    --text-primary: #eceff4;
    --text-secondary: #d8dee9;
    --emerald-accent: #88c0d0;
    --emerald-hover: #81a1c1;
    --border-color: #4c566a;
    --blue-check: #88c0d0;
    --mention-bg: rgba(136, 192, 208, 0.22);
    --mention-text: #88c0d0;
    --wallpaper-opacity: 0.04;
}

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

html, body {
    height: 100%;
    height: 100dvh;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    user-select: text;
}

.app-root {
    height: 100%;
    height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ==========================================================================
   Chat Layout & Header
   ========================================================================== */
.chat-layout {
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.chat-header {
    height: 60px;
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 20;
    flex-shrink: 0;
}

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

.room-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #111b21;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.room-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.room-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.typing-text {
    color: var(--emerald-accent);
    font-weight: 500;
    animation: pulse 1.5s infinite;
}

.online-dot {
    width: 8px;
    height: 8px;
    background-color: var(--emerald-accent);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 6px var(--emerald-accent);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-copy-link {
    background-color: #111b21;
    color: var(--emerald-accent);
    border: 1px solid var(--emerald-accent);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-copy-link:hover {
    background-color: var(--emerald-accent);
    color: #ffffff;
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s;
}

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

/* ==========================================================================
   Chat View & Wallpaper
   ========================================================================== */
.chat-container {
    flex: 1 1 0%;
    min-height: 0; /* CRITICAL for flex child scrolling! */
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 16px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    background-color: var(--bg-chat);
    display: flex;
    flex-direction: column;
}

.chat-wallpaper {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: var(--wallpaper-opacity, 0.06);
    pointer-events: none;
    background-image: radial-gradient(#ffffff 0.75px, transparent 0.75px), radial-gradient(#ffffff 0.75px, var(--bg-chat) 0.75px);
    background-size: 30px 30px;
    background-position: 0 0, 15px 15px;
}

.messages-list {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 100%;
}

.messages-spacer {
    flex: 1 1 auto;
    min-height: 8px;
}

.date-badge-container {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

.date-badge {
    background-color: #182229;
    color: var(--text-secondary);
    font-size: 0.72rem;
    padding: 4px 12px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.empty-chat-placeholder {
    margin: auto;
    text-align: center;
    color: var(--text-secondary);
    padding: 24px;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.empty-chat-placeholder h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 4px;
}

/* ==========================================================================
   Message Bubbles
   ========================================================================== */
.message-row {
    display: flex;
    width: 100%;
}

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

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

.bubble-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    max-width: 75%;
}

@media (min-width: 768px) {
    .bubble-wrapper {
        max-width: 540px;
    }
}

.message-bubble {
    padding: 6px 9px 6px 9px;
    border-radius: 8px;
    font-size: 0.93rem;
    line-height: 1.35;
    position: relative;
    word-break: break-word;
    box-shadow: 0 1px 0.5px rgba(11,20,26,0.18);
}

.message-row.sent .message-bubble {
    background-color: var(--bubble-sent);
    border-top-right-radius: 0;
    color: var(--text-primary);
}

.message-row.received .message-bubble {
    background-color: var(--bubble-received);
    border-top-left-radius: 0;
    color: var(--text-primary);
}

.message-sender {
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.bubble-reply-quote {
    background-color: rgba(0, 0, 0, 0.22);
    border-left: 4px solid var(--emerald-accent);
    border-radius: 4px;
    padding: 4px 8px;
    margin-bottom: 6px;
    font-size: 0.8rem;
}

.reply-author {
    font-weight: 600;
    margin-bottom: 2px;
}

.reply-snippet {
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 320px;
}

.message-text {
    margin-bottom: 2px;
}

.message-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    float: right;
    margin-left: 12px;
    margin-top: 4px;
    font-size: 0.68rem;
    color: var(--text-secondary);
}

.message-check {
    color: var(--blue-check);
    font-weight: bold;
    letter-spacing: -2px;
}

.bubble-reply-btn {
    opacity: 0;
    background: var(--bg-header);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    margin: 0 6px;
    transition: opacity 0.15s, background 0.15s;
}

.bubble-wrapper:hover .bubble-reply-btn {
    opacity: 1;
}

.bubble-reply-btn:hover {
    background: var(--bg-input-field);
    color: var(--text-primary);
}

/* ==========================================================================
   Media Attachments in Bubbles
   ========================================================================== */
.media-image-box {
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 4px;
    max-width: 320px;
    max-height: 320px;
}

.media-img {
    width: 100%;
    height: auto;
    max-height: 320px;
    display: block;
    object-fit: cover;
    transition: transform 0.2s;
}

.media-img:hover {
    transform: scale(1.02);
}

.media-video-box {
    max-width: 360px;
    margin-bottom: 4px;
    border-radius: 6px;
    overflow: hidden;
}

.media-video {
    width: 100%;
    max-height: 280px;
    display: block;
    background: #000;
}

.media-audio-box {
    width: 270px;
    margin-bottom: 4px;
}

.media-audio {
    width: 100%;
    height: 36px;
}

.media-doc-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 4px;
    min-width: 220px;
}

.doc-icon {
    font-size: 1.8rem;
}

.doc-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.doc-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-size {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.doc-download-btn {
    background-color: var(--emerald-accent);
    color: #fff;
    text-decoration: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: background 0.15s;
}

.doc-download-btn:hover {
    background-color: var(--emerald-hover);
}

/* ==========================================================================
   Chat Input Bar & Attachments
   ========================================================================== */
.chat-input-bar {
    background-color: var(--bg-input-bar);
    border-top: 1px solid var(--border-color);
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    z-index: 10;
    flex-shrink: 0; /* NEVER collapse input bar! */
}

.input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.chat-text-input {
    flex: 1;
    background-color: var(--bg-input-field);
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: background 0.15s;
}

.chat-text-input:focus {
    background-color: #32434d;
}

.chat-text-input::placeholder {
    color: var(--text-secondary);
}

.btn-send {
    background-color: var(--emerald-accent);
    color: #ffffff;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
    background-color: var(--emerald-hover);
    transform: scale(1.05);
}

.btn-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Reply Banner */
.reply-banner {
    background-color: #111b21;
    border-radius: 6px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    border-left: 4px solid var(--emerald-accent);
}

.reply-banner-content {
    flex: 1;
    overflow: hidden;
}

.reply-banner-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--emerald-accent);
}

.reply-banner-text {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-cancel-reply {
    font-size: 0.9rem;
    width: 24px;
    height: 24px;
}

/* Staged Attachment Banner */
.staged-attachment-banner {
    background-color: #111b21;
    border-radius: 6px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--border-color);
}

.staged-icon {
    font-size: 1.4rem;
}

.staged-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.staged-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.staged-size {
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.upload-progress-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--emerald-accent);
    padding: 4px 8px;
}

/* Attachment Popup Menu */
.attach-wrapper {
    position: relative;
}

.attach-popup-menu {
    position: absolute;
    bottom: 52px;
    left: 0;
    background-color: #233138;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    min-width: 180px;
    z-index: 30;
}

.attach-item {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background 0.15s;
}

.attach-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.attach-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.img-bg { background-color: #ac44cf; }
.video-bg { background-color: #007bfc; }
.audio-bg { background-color: #ff3b30; }
.doc-bg { background-color: #5f66cd; }

/* ==========================================================================
   Lobby / Home View
   ========================================================================== */
.lobby-container {
    flex: 1;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background-color: var(--bg-app);
}

.lobby-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 32px 28px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.4);
}

.lobby-brand {
    text-align: center;
    margin-bottom: 24px;
}

.brand-icon {
    margin-bottom: 8px;
}

.lobby-brand h2 {
    font-size: 1.8rem;
    color: var(--emerald-accent);
    margin-bottom: 4px;
}

.brand-tagline {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.user-profile-box {
    background-color: #182229;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.profile-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.profile-display-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile-name {
    font-weight: 600;
    color: var(--emerald-accent);
    font-size: 0.95rem;
}

.btn-icon-sm {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 2px 4px;
}

.profile-edit-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.profile-input {
    background-color: var(--bg-input-field);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
}

.lobby-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.lobby-section {
    background-color: #182229;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
}

.lobby-section h4 {
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.lobby-input {
    width: 100%;
    background-color: var(--bg-input-field);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}

.lobby-input:focus {
    border-color: var(--emerald-accent);
}

.slug-input-wrapper {
    display: flex;
    align-items: center;
    background-color: var(--bg-input-field);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.slug-prefix {
    padding: 0 10px;
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 0.9rem;
}

.slug-field {
    border: none !important;
    background: transparent !important;
}

.btn-create-room {
    width: 100%;
    background-color: var(--emerald-accent);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.btn-create-room:hover {
    background-color: var(--emerald-hover);
    transform: translateY(-1px);
}

.join-row {
    display: flex;
    gap: 8px;
}

.btn-join {
    background-color: #2a3942;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0 18px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-join:hover {
    background-color: #3b4e5a;
}

.recent-rooms-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.recent-room-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.recent-room-item:hover {
    background-color: #233138;
    transform: translateX(3px);
}

.recent-icon {
    font-size: 1.3rem;
}

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

.recent-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-slug {
    font-size: 0.75rem;
    color: var(--emerald-accent);
    font-family: monospace;
}

.recent-arrow {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ==========================================================================
   Modals & Lightbox
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(11, 20, 26, 0.82);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 16px;
    animation: fadeIn 0.2s ease;
}

.modal-card,
.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 24px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.25s ease;
}

.modal-header {
    text-align: center;
    margin-bottom: 20px;
}

.modal-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #182229;
    border: 2px solid var(--emerald-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 12px;
}

.modal-header h3 {
    color: var(--text-primary);
    font-size: 1.25rem;
    margin-bottom: 6px;
}

.modal-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.modal-input {
    width: 100%;
    background-color: var(--bg-input-field);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    margin-bottom: 12px;
}

.modal-input:focus {
    border-color: var(--emerald-accent);
}

.modal-error {
    color: #ff6b6b;
    font-size: 0.8rem;
    margin-bottom: 12px;
}

.btn-emerald {
    width: 100%;
    background-color: var(--emerald-accent);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

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

.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
    width: auto;
}

/* Users Modal */
.users-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.online-indicator-pill {
    font-size: 0.8rem;
    color: var(--emerald-accent);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.online-indicator-pill .dot {
    width: 6px;
    height: 6px;
    background-color: var(--emerald-accent);
    border-radius: 50%;
}

.users-list {
    max-height: 320px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px;
    border-radius: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.95rem;
}

.user-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.badge-me {
    background-color: rgba(0, 168, 132, 0.2);
    color: var(--emerald-accent);
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(11, 20, 26, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: none;
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    object-fit: contain;
}

/* Toast */
.toast-notification {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #00a884;
    color: #ffffff;
    padding: 10px 20px;
    border-radius: 30px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    z-index: 300;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: dropIn 0.25s ease;
}

.toast-icon {
    font-weight: bold;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes dropIn {
    from { transform: translate(-50%, -20px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 168, 132, 0.3);
    border-top-color: var(--emerald-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   UX Enhancements & New Features
   ========================================================================== */

/* Floating Scroll to Bottom button */
.btn-scroll-bottom {
    position: absolute;
    bottom: 24px;
    right: 28px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--bg-header);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    cursor: pointer;
    z-index: 25;
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-scroll-bottom:hover {
    transform: translateY(-2px) scale(1.08);
    background-color: var(--emerald-accent);
    color: #ffffff;
    border-color: var(--emerald-accent);
}

.btn-scroll-bottom:active {
    transform: translateY(0) scale(0.96);
}

/* Message animations */
.message-row {
    animation: messagePopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes messagePopIn {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.6);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes traySlideUp {
    0% {
        opacity: 0;
        transform: translateY(12px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.93) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Mentions */
.chat-mention {
    background-color: var(--mention-bg);
    color: var(--mention-text);
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    display: inline-block;
    margin: 0 1px;
}

.chat-mention.mention-self {
    border: 1px solid var(--emerald-accent);
    font-weight: 700;
}

/* Mentioned bubble glow */
.message-bubble.bubble-mentioned {
    border: 1px solid var(--emerald-accent) !important;
    box-shadow: 0 0 12px rgba(0, 168, 132, 0.35) !important;
}

/* Mention autocomplete popup */
.mention-autocomplete-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 16px;
    right: 16px;
    max-width: 400px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    z-index: 50;
    animation: traySlideUp 0.18s ease-out;
}

.mention-popup-header {
    padding: 8px 12px;
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.mention-list {
    max-height: 200px;
    overflow-y: auto;
}

.mention-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background-color 0.12s;
}

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

.mention-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--bg-input-field);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.mention-user-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

/* GIF button in input bar */
.btn-gif-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.gif-btn-badge {
    font-size: 0.75rem;
    font-weight: 800;
    background-color: var(--bg-input-field);
    border: 1px solid var(--border-color);
    color: var(--emerald-accent);
    padding: 3px 6px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    transition: all 0.15s;
}

.btn-gif-trigger:hover .gif-btn-badge {
    background-color: var(--emerald-accent);
    color: #ffffff;
}

/* GIF Modal */
.gif-modal-content {
    max-width: 620px;
    width: 92%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: modalFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-title-with-icon {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gif-badge-icon {
    font-size: 0.75rem;
    font-weight: 800;
    background-color: var(--emerald-accent);
    color: #ffffff;
    padding: 2px 7px;
    border-radius: 5px;
}

.gif-direct-input {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.gif-url-field {
    flex: 1;
}

.gif-url-send-btn {
    white-space: nowrap;
    padding: 8px 14px;
}

.gif-search-container {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.gif-search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.gif-search-input {
    width: 100%;
    padding-left: 36px !important;
    padding-right: 36px !important;
}

.gif-clear-search {
    position: absolute;
    right: 6px;
    font-size: 0.85rem;
    width: 28px;
    height: 28px;
}

.gif-categories-bar {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.gif-cat-chip {
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    background-color: var(--bg-input-field);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.15s;
}

.gif-cat-chip:hover {
    color: var(--text-primary);
    border-color: var(--emerald-accent);
}

.gif-cat-chip.active {
    background-color: var(--emerald-accent);
    color: #ffffff;
    border-color: var(--emerald-accent);
}

.gif-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    overflow-y: auto;
    max-height: 380px;
    padding: 2px;
}

.gif-grid-item {
    position: relative;
    height: 110px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    background-color: var(--bg-input-field);
    transition: transform 0.15s, box-shadow 0.15s;
    border: 1px solid var(--border-color);
}

.gif-grid-item:hover {
    transform: scale(1.04);
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border-color: var(--emerald-accent);
}

.gif-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gif-item-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
    color: #ffffff;
    font-size: 0.7rem;
    padding: 6px 6px 3px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gif-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* In-chat GIF Rendering */
.gif-box {
    position: relative;
    max-width: 320px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.gif-media-img {
    display: block;
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    border-radius: 8px;
}

.gif-tag-label {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background-color: rgba(0, 0, 0, 0.65);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Staged thumbnail image in input tray */
.staged-thumb-img {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

/* Drag and drop overlay */
.drag-drop-overlay {
    position: absolute;
    top: -200px;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(11, 20, 26, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border: 2px dashed var(--emerald-accent);
    border-radius: 12px;
    margin: 8px;
    animation: fadeIn 0.15s ease-out;
    pointer-events: none;
}

.drag-drop-card {
    text-align: center;
    color: var(--text-primary);
    padding: 24px;
    background-color: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.drag-drop-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 8px;
    animation: pulse 1s infinite;
}

.drag-drop-card h4 {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.drag-drop-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Theme Modal */
.theme-modal-content {
    max-width: 540px;
    width: 90%;
    animation: modalFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-modal-desc {
    color: var(--text-secondary);
    font-size: 0.86rem;
    margin-bottom: 16px;
    line-height: 1.4;
}

.theme-badge-icon {
    font-size: 1.2rem;
}

.theme-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.theme-card {
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    background-color: var(--bg-card);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-card:hover {
    border-color: var(--emerald-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.theme-card.active {
    border-color: var(--emerald-accent);
    box-shadow: 0 0 0 2px var(--emerald-accent);
}

.theme-card-preview {
    height: 70px;
    border-radius: 6px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-bottom: 8px;
    overflow: hidden;
}

.preview-mini-header {
    height: 14px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 6px;
}

.preview-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.theme-card-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.theme-card-name {
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-name-text {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.theme-active-tag {
    background-color: var(--emerald-accent);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
}

/* Smooth Button Spring Feel */
button {
    transition: transform 0.1s ease, background-color 0.15s ease, opacity 0.15s ease;
}

button:active {
    transform: scale(0.95);
}

/* ==========================================================================
   Mobile Responsive Styles (<= 640px)
   ========================================================================== */
@media (max-width: 640px) {
    /* Header */
    .chat-header {
        height: 54px;
        padding: 0 8px;
    }

    .header-left {
        gap: 8px;
        min-width: 0;
        flex: 1 1 auto;
    }

    .header-right {
        gap: 4px;
        flex-shrink: 0;
    }

    .room-avatar {
        width: 34px;
        height: 34px;
        font-size: 1rem;
        flex-shrink: 0;
    }

    .room-info {
        min-width: 0;
    }

    .room-title {
        font-size: 0.92rem;
        max-width: 130px;
    }

    .btn-copy-link {
        padding: 6px 8px;
        gap: 0;
        height: 34px;
        min-width: 34px;
        justify-content: center;
        border-radius: 50%;
    }

    .btn-copy-link .text {
        display: none;
    }

    .btn-icon {
        width: 34px;
        height: 34px;
        font-size: 1.05rem;
        flex-shrink: 0;
    }

    /* Chat Messages */
    .chat-container {
        padding: 8px 10px;
    }

    .bubble-wrapper {
        max-width: 88%;
    }

    .message-bubble {
        font-size: 0.9rem;
    }

    /* Input Bar */
    .chat-input-bar {
        padding: 6px 8px;
        padding-bottom: max(8px, env(safe-area-inset-bottom));
    }

    .input-row {
        gap: 6px;
    }

    .chat-text-input,
    .input-field {
        font-size: 16px; /* Prevent mobile zoom! */
        min-height: 36px;
        padding: 8px 10px;
    }

    .chat-input-bar .btn-attach,
    .chat-input-bar .btn-gif-trigger,
    .chat-input-bar .btn-icon,
    .chat-input-bar .btn-send {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    /* Modals & Lobby */
    .modal-card,
    .modal-content,
    .gif-modal-content,
    .theme-modal-content {
        width: 94vw;
        max-height: 85dvh;
        padding: 16px 14px;
        border-radius: 16px;
    }

    .gif-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .theme-card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lobby-card {
        width: 92%;
        padding: 20px 16px;
    }
}

@media (max-width: 360px) {
    .room-title {
        max-width: 90px;
    }

    .theme-card-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   GIF Skeleton Loader & Enhancements
   ========================================================================== */
.gif-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    width: 100%;
}

.gif-skeleton-item {
    height: 110px;
    border-radius: 8px;
    background: linear-gradient(90deg, var(--bg-input-field) 25%, rgba(255, 255, 255, 0.08) 50%, var(--bg-input-field) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==========================================================================
   Voice Note Recorder & Player (WhatsApp Style)
   ========================================================================== */
.btn-mic {
    background-color: var(--emerald-accent) !important;
    color: #fff !important;
    font-size: 1.15rem;
}

.btn-video-note-trigger {
    font-size: 1.15rem;
}

.voice-recorder-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background-color: var(--bg-input-field);
    border-radius: 24px;
    padding: 6px 12px;
    animation: fade-in 0.2s ease-out;
}

.voice-recorder-live {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.voice-rec-dot {
    width: 12px;
    height: 12px;
    background-color: #ef4444;
    border-radius: 50%;
    animation: pulse-red 1s infinite;
}

@keyframes pulse-red {
    0% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
    70% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.9); opacity: 0.8; box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.voice-rec-timer {
    font-family: monospace;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.voice-waveform-visual {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
    margin-left: 8px;
}

.wave-bar {
    width: 3px;
    background-color: var(--emerald-accent);
    border-radius: 2px;
    animation: wave-anim 1s ease-in-out infinite alternate;
}

.bar-1 { height: 6px; animation-delay: 0.1s; }
.bar-2 { height: 16px; animation-delay: 0.25s; }
.bar-3 { height: 22px; animation-delay: 0.4s; }
.bar-4 { height: 12px; animation-delay: 0.15s; }
.bar-5 { height: 20px; animation-delay: 0.3s; }
.bar-6 { height: 8px; animation-delay: 0.5s; }
.bar-7 { height: 18px; animation-delay: 0.2s; }
.bar-8 { height: 10px; animation-delay: 0.35s; }

@keyframes wave-anim {
    0% { transform: scaleY(0.3); }
    100% { transform: scaleY(1.2); }
}

.voice-recorder-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon-circle {
    border: none;
    background-color: transparent;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: background 0.15s, transform 0.1s;
}

.btn-icon-circle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.voice-cancel-btn:hover {
    background-color: rgba(239, 68, 68, 0.2);
}

/* In-chat Voice Note Player Bubble */
.voice-note-player {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    min-width: 240px;
    max-width: 320px;
}

.voice-note-header-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.voice-note-mic-icon {
    font-size: 0.95rem;
}

.voice-note-label {
    font-weight: 600;
    color: var(--emerald-accent);
}

.voice-note-size {
    margin-left: auto;
    font-size: 0.7rem;
    opacity: 0.8;
}

.voice-audio-element {
    width: 100%;
    height: 36px;
    outline: none;
}

/* ==========================================================================
   Video Note Feature (Circular Video Bubble & Modal)
   ========================================================================== */
.video-note-bubble-container {
    position: relative;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    border: 3px solid var(--emerald-accent);
    background-color: #000;
    margin: 4px auto;
}

.video-note-bubble-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.video-note-badge-tag {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    pointer-events: none;
    white-space: nowrap;
}

/* Video Note Modal */
.video-note-modal {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 20px;
    max-width: 360px;
    width: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
    animation: modal-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.video-note-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.video-note-badge {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.video-note-circle-container {
    position: relative;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    overflow: hidden;
    background-color: #000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    border: 4px solid var(--emerald-accent);
}

.video-note-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* mirror selfie view */
}

.video-note-recording-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid #ef4444;
    animation: pulse-ring 1.5s infinite;
    pointer-events: none;
}

@keyframes pulse-ring {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.video-note-status {
    min-height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-note-timer-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-note-time {
    font-family: monospace;
    font-weight: 700;
    font-size: 1.1rem;
    color: #ef4444;
}

.video-note-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.video-note-controls {
    display: flex;
    align-items: center;
    gap: 24px;
}

.btn-cancel-vnote {
    width: 44px;
    height: 44px;
    background-color: rgba(255, 255, 255, 0.08);
    font-size: 1.25rem;
}

.btn-cancel-vnote:hover {
    background-color: rgba(239, 68, 68, 0.25);
}

.btn-vnote-record {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background-color: rgba(239, 68, 68, 0.2);
    border: 3px solid #ef4444;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, background 0.15s;
}

.btn-vnote-record:hover:not(:disabled) {
    transform: scale(1.08);
    background-color: rgba(239, 68, 68, 0.35);
}

.record-inner-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: #ef4444;
}

.btn-vnote-send {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background-color: var(--emerald-accent);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, background 0.15s;
    box-shadow: 0 4px 14px rgba(0, 168, 132, 0.4);
}

.btn-vnote-send:hover {
    transform: scale(1.08);
    background-color: var(--emerald-hover);
}

/* ==========================================================================
   Discord-Style Rich Embed Link Preview Card
   ========================================================================== */
.discord-embed-card {
    margin-top: 8px;
    background-color: rgba(0, 0, 0, 0.22);
    border-left: 4px solid var(--emerald-accent);
    border-radius: 6px;
    overflow: hidden;
    max-width: 440px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: background-color 0.15s;
}

.discord-embed-card:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

.embed-inner {
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.embed-site {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.embed-favicon {
    width: 14px;
    height: 14px;
    border-radius: 2px;
    object-fit: contain;
}

.embed-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #53bdeb;
    text-decoration: none;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.embed-title:hover {
    text-decoration: underline;
}

.embed-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.35;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.embed-image-box {
    margin-top: 6px;
    border-radius: 6px;
    overflow: hidden;
    max-height: 240px;
}

.embed-image {
    width: 100%;
    height: auto;
    max-height: 240px;
    object-fit: cover;
    display: block;
}

/* ==========================================================================
   Privacy Mode (WA Web Plus Style Blur)
   ========================================================================== */
.btn-privacy-active {
    color: #00f0ff !important;
    background-color: rgba(0, 240, 255, 0.15) !important;
}

.privacy-mode-blur .message-text,
.privacy-mode-blur .media-img,
.privacy-mode-blur .media-video,
.privacy-mode-blur .video-note-bubble-container,
.privacy-mode-blur .voice-note-player,
.privacy-mode-blur .bubble-reply-quote,
.privacy-mode-blur .discord-embed-card {
    filter: blur(8px);
    transition: filter 0.2s ease;
    user-select: none;
}

.privacy-mode-blur .message-bubble:hover .message-text,
.privacy-mode-blur .message-bubble:hover .media-img,
.privacy-mode-blur .message-bubble:hover .media-video,
.privacy-mode-blur .message-bubble:hover .video-note-bubble-container,
.privacy-mode-blur .message-bubble:hover .voice-note-player,
.privacy-mode-blur .message-bubble:hover .bubble-reply-quote,
.privacy-mode-blur .message-bubble:hover .discord-embed-card,
.privacy-mode-blur .message-bubble:active * {
    filter: blur(0px) !important;
    user-select: text;
}

/* Double click hint / hover feedback on message bubble */
.message-bubble {
    cursor: pointer;
    user-select: text;
}

.message-bubble:active {
    transform: scale(0.99);
}
