/* =========================
   RESET & BASE
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
    font-family: "Inter", "Segoe UI", Roboto, Arial, sans-serif;
    background: #0f172a;
    color: #e5e7eb;
    overflow: hidden;
}

@media (max-width: 768px) {
    body {
        overflow: hidden; /* keep locked */
    }
}

/* Prevent mobile zoom */
input, textarea {
    font-size: 16px;
}

/* =========================
   AUTH (LOGIN / REGISTER)
========================= */
form {
    background: #020617;
    width: 90%;
    max-width: 380px;
    margin: 12vh auto;
    padding: 28px;
    border-radius: 14px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

form h2 {
    text-align: center;
    margin-bottom: 22px;
    font-weight: 600;
}

form input {
    width: 100%;
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: 10px;
    border: 1px solid #1e293b;
    background: #020617;
    color: #e5e7eb;
    outline: none;
}

form button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #020617;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

form a {
    display: block;
    margin-top: 12px;
    text-align: center;
    font-size: 14px;
    color: #94a3b8;
    text-decoration: none;
}

.error-msg {
    background: #fee2e2;
    color: #991b1b;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    text-align: center;
}

/* Password toggle */
.password-box {
    position: relative;
}

.password-box input {
    padding-right: 40px;
}

.toggle-pass {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    font-size: 16px;
}

/* =========================
   CHAT LAYOUT
========================= */
.chat-app {
    display: flex;
    height: 100vh;
}

/* =========================
   SIDEBAR (USERS)
========================= */
.users-panel {
    width: 260px;
    background: #020617;
    border-right: 1px solid #1e293b;

    display: flex;
    flex-direction: column;

    height: 100vh;
    overflow: hidden;   /* VERY IMPORTANT */
}

.users {
    flex: 1;              /* takes remaining height */
    overflow-y: auto;     /* ONLY this scrolls */
}

/* TOP FIXED SECTION */
.users-top {
    flex-shrink: 0;
}

/* SCROLLABLE AREA */
.users-list {
    flex: 1;
    overflow-y: auto;
}

/* Smooth scrollbar */
.users-list::-webkit-scrollbar {
    width: 6px;
}

.users-list::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 10px;
}

@media (max-width: 768px) {
    .users-panel {
        width: 100%;
        max-width: 100%;
        left: -100%;
    }

    .users-panel.show {
        left: 0;
    }
}

@media (max-width: 768px) {

    .users-panel {
        height: 100%;
    }

    .users-list {
        height: calc(100vh - 180px);
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
    }

}

.users {
    background: #020617;
}

.user-search {
    padding: 10px;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;   /* prevents scrolling */
}

.user-search input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #1e293b;
    background: #020617;
    color: #e5e7eb;
    outline: none;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    cursor: pointer;
    color: #e5e7eb;
}

.user-item:hover {
    background: #1e293b;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot.online { background: #22c55e; }
.dot.offline { background: #64748b; }

.user-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 13px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =========================
   CHAT AREA
========================= */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* contain scroll inside */
    background: #0f172a;
}

/* =========================
   CHAT HEADER
========================= */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.chat-user {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;          /* 👈 CRITICAL */
    flex: 1;               /* 👈 allow text space */
}

.chat-username {
    font-weight: 600;
    font-size: 14px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.online { background: #22c55e; }
.status-dot.offline { background: #64748b; }

.logout-btn {
    font-size: 13px;
    color: #f87171;
    text-decoration: none;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    margin: 0;
    border-radius: 50%;
}

.icon-btn:hover {
    background: #1e293b;
    border-radius: 6px;
}

/* =========================
   MESSAGE SEARCH
========================= */
.msg-search {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #1e293b;
    background: #020617;
    color: #e5e7eb;
    font-size: 13px;
}

/* =========================
   MESSAGES
========================= */
#messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* 👈 iOS smooth scroll */
}

@media (max-width: 768px) {
    #messages {
        padding-bottom: 120px !important;
    }
}

@media (max-width: 768px) {
    .chat-app,
    .chat-area {
        height: 100vh; /* 👈 dynamic viewport height */
    }
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 75%;
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    background: #020617;
    word-wrap: break-word;
}

@media (max-width: 768px) {
    .message {
        max-width: 85%;
    }
}

.message strong {
    display: block;
    font-size: 12px;
    color: #38bdf8;
    margin-bottom: 4px;
}

.message img {
    max-width: 100%;
    border-radius: 10px;
    margin-top: 6px;
}

.message a {
    color: #38bdf8;
    text-decoration: none;
}

.message small {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 6px;
    text-align: right;
}

/* Message alignment */
.message.me {
    margin-left: auto;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-bottom-right-radius: 4px;
}

.message.me strong,
.message.me small {
    color: inherit;
}

.message.other {
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

/* Edit / delete */
.msg-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.message:hover .msg-actions {
    opacity: 1;
}

.msg-actions span {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    background: #020617;
    border: 1px solid #1e293b;
}

/* =========================
   INPUT AREA
========================= */
.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: #020617;
    border-top: 1px solid #1e293b;
}

.input-bubble {
    flex: 1;
    min-width: 0;   /* VERY IMPORTANT for flex overflow fix */
    display: flex;
    align-items: center;
    gap: 6px;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 999px;
    padding: 6px 12px;
    min-height: 42px;
}

.input-bubble input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: #e5e7eb;
    font-size: 14px;
}

@media (max-width: 768px) {

    .chat-input-wrapper {
        padding: 6px;
    }

    .input-bubble {
        padding: 6px 10px;
        min-height: 44px;
    }

    .input-bubble input {
        font-size: 14px; /* Prevent zoom */
    }

    .send-floating {
        width: 44px;
        height: 44px;
    }
}

.send-floating {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    font-size: 16px;
    cursor: pointer;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #020617;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-floating:hover {
    transform: scale(1.05);
}

.inside-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    color: #94a3b8;
}

.inside-btn:hover {
    color: #22c55e;
}

.input-container {
    flex: 1;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 20px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    min-height: 36px; 
}

.input-container input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: #e5e7eb;
    font-size: 14px;
    padding: 6px 0;
}

.send-btn {
    width: 34px;
    height: 34px;
    font-size: 14px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    color: #020617;
    cursor: pointer;
}

/* File input hidden spacing fix */
input[type="file"] {
    display: none;
}

/* =========================
   EMOJI PANEL
========================= */
/* =========================
   EMOJI PANEL (MOBILE FIX)
========================= */

.emoji-panel {
    display: none;
    position: fixed;               /* 👈 important */
    bottom: 70px;                  /* above input bar */
    left: 0;
    width: 100%;
    max-height: 220px;
    background: #020617;
    border-top: 1px solid #1e293b;
    z-index: 2000;                 /* 👈 higher than input */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px;
}

.emoji-panel.show {
    display: block;
}

.emoji-panel span {
    font-size: 22px;
    padding: 6px;
    cursor: pointer;
    display: inline-block;
}

/* =========================
   OVERLAY (MOBILE)
========================= */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 998;
    display: none;
}

.users-panel.show ~ .overlay {
    display: block;
}

/* =========================
   MOBILE
========================= */
@media (max-width: 768px) {

    .chat-app {
        flex-direction: column;
    }

    .users-panel {
        position: fixed;
        top: 0;
        left: -100%;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        background: #020617;
        z-index: 999;
        transition: left 0.3s ease;

        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .users-panel.show {
        left: 0;
    }

    .users {
        overflow-y: auto;
        flex: 1;
    }

    .msg-search {
        display: none;
    }

    #messages {
        padding-bottom: 90px;
    }

    .chat-input-wrapper {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 999;
    }
    .input-container {
        min-height: 40px;
    }

    .send-btn {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 768px) {
    .chat-input-wrapper {
        left: 0;
        right: 0;
        width: 100%;
        padding-left: 8px;
        padding-right: 8px;
    }
}


/* Touch friendly */
button, .icon-btn, .user-item {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* =========================
   MOBILE SCROLL FIX
========================= */

.chat-area {
    overflow: hidden;
}

#messages {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.users-panel {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .chat-app,
    .chat-area {
        height: 100vh;
    }

    #messages {
        padding-bottom: 100px;
    }
}

/* =========================
   IMAGE DOWNLOAD BUTTON
========================= */

.image-wrapper {
    position: relative;
    display: inline-block;
    max-width: 220px;      /* 👈 desktop default */
    width: 100%;
}

.image-wrapper img {
    display: block;
    max-width: 100%;
    width: 100%;
    height: auto;
    border-radius: 10px;
    object-fit: cover;
}

/* Mobile: slightly bigger but controlled */
@media (max-width: 768px) {
    .image-wrapper {
        max-width: 180px;
    }
}

/* Download button */
.img-download-btn {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-download-btn:hover {
    background: rgba(0,0,0,0.8);
}

/* =========================
   USER PROFILE (CENTERED)
========================= */

.user-profile {
    padding: 16px;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;

    display: flex;
    flex-direction: column;
    align-items: center;      /* 👈 CENTER EVERYTHING */
    text-align: center;
}

.profile-avatar {
    width: 56px;                /* 👈 bigger looks better */
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #020617;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
    cursor: pointer;
    overflow: hidden;
    margin-bottom: 8px;      /* spacing below image */
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    display: flex;
    flex-direction: column;
    align-items: center;      /* 👈 CENTER TEXT */
    gap: 2px;
    width: 100%;
}

.profile-name {
    font-size: 15px;
    font-weight: 600;
    color: #e5e7eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.profile-email,
.profile-mobile {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

@media (max-width: 768px) {
    .profile-avatar {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .profile-name {
        font-size: 14px;
    }
}

/* =========================
   EMOJI CATEGORIES
========================= */

.emoji-tabs {
    display: flex;
    border-bottom: 1px solid #1e293b;
    margin-bottom: 8px;
}

.emoji-tabs button {
    flex: 1;
    background: none;
    border: none;
    font-size: 20px;
    padding: 8px 0;
    cursor: pointer;
    color: #94a3b8;
}

.emoji-tabs button.active {
    color: #22c55e;
    border-bottom: 2px solid #22c55e;
}

.emoji-content {
    max-height: 180px;
    overflow-y: auto;
}

.emoji-group {
    display: none;
}

.emoji-group.active {
    display: block;
}

.emoji-group span {
    font-size: 22px;
    padding: 6px;
    cursor: pointer;
    display: inline-block;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #020617;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
/* =========================
   MESSAGE TICKS
========================= */

.ticks {
    display: inline-flex !important;
    align-items: center;
    font-size: 12px !important;
    line-height: 1;
}

.ticks.delivered {
    color: #94a3b8 !important;
}

.ticks.seen {
    color: #3b82f6 !important; /* BLUE */
}

/* =========================
   FILE / IMAGE MENU
========================= */

.image-wrapper,
.file-box {
    position: relative;
    display: inline-block;
}

.file-menu-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,0.6);
    border: none;
    color: #fff;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
}

.file-menu {
    position: absolute;
    top: 28px;
    right: 6px;
    background: #020617;
    border: 1px solid #1e293b;
    border-radius: 8px;
    display: none;
    z-index: 3000;
    min-width: 120px;
}

.file-menu a {
    display: block;
    padding: 8px 12px;
    color: #e5e7eb;
    text-decoration: none;
    font-size: 13px;
}

.file-menu a:hover {
    background: #1e293b;
}
.typing-indicator {
    padding: 6px 14px;
    font-size: 13px;
    color: #94a3b8;
    font-style: italic;
}
.typing-indicator::after {
    content: "...";
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0% { content: "."; }
    33% { content: ".."; }
    66% { content: "..."; }
}

.icon-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 6px;
}

.icon-btn:hover {
    background: #1e293b;
    border-radius: 50%;
}

.users-panel {
    touch-action: pan-y; /* allow swipe */
}

.users-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.user-item.group {
    background: #1e293b;
    font-weight: 600;
    position: relative;
}

.user-item.group:hover {
    background: #334155;
}

/* 👥 Group icon indicator */
.user-item.group::before {
    content: "👥";
    margin-right: 6px;
    font-size: 14px;
}
/* =========================
   CREATE GROUP BUTTON
========================= */
.create-group {
    padding: 10px;
    border-bottom: 1px solid #1e293b;
}

.create-group button {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: #020617;
    font-weight: 600;
    cursor: pointer;
}

.create-group button:hover {
    filter: brightness(1.1);
}
.group-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    z-index: 3000;
}

.group-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-box {
    background: #4759a6;
    padding: 20px;
    width: 90%;
    max-width: 360px;
    border-radius: 14px;
}

.group-box h3 {
    margin-bottom: 12px;
}

.group-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

.group-actions button {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
}
/* =========================
   GROUP USER SELECTION
========================= */
.group-users {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 6px;
}

.group-user-search {
    width: 100%;
    padding: 8px 10px;
    margin: 10px 0;
    border-radius: 8px;
    border: 1px solid #1e293b;
    background: #020617;
    color: #e5e7eb;
    outline: none;
}

.group-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
    cursor: pointer;
}

.group-user input {
    accent-color: #22c55e;
}

.group-seen-count {
    font-size: 12px;
    color: #38bdf8;
    margin-left: 6px;
    white-space: nowrap;
}
.msg-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
}
.group-delete-btn {
    background: none;
    border: none;
    color: #f87171;
    font-size: 14px;
    cursor: pointer;
    margin-left: auto;
}

.group-delete-btn:hover {
    color: #ef4444;
}

.group-edit-btn,
.group-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #94a3b8;
}

.group-edit-btn:hover {
    color: #22c55e;
}

.group-delete-btn:hover {
    color: #ef4444;
}
.admin-badge {
    background: #22c55e;
    color: #020617;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    margin-left: 6px;
}

@media (max-width: 768px) {

    .admin-badge {
        font-size: 10px;
        padding: 1px 5px;
    }

    .group-count {
        font-size: 11px;
        white-space: nowrap;
    }
}

.you-badge {
    font-size: 11px;
    color: #94a3b8;
    margin-left: 4px;
}
.section-header {
    padding: 10px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    background: #020617;
    border-bottom: 1px solid #1e293b;
}

.section-content {
    max-height: 300px;
    overflow-y: auto;
}
#groupList {
    max-height: 220px;
    overflow-y: auto;
}
/* Groups section collapsed by default */
#groupList {
    display: none;
}

@media (max-width: 768px) {

    .chat-username {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 13px;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }

    .group-title {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* =========================
   MOBILE FULL-WIDTH FIX
========================= */
@media (max-width: 768px) {

    html, body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .chat-app,
    .chat-area,
    .users-panel {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }
}

/* Back button hidden by default */
.back-btn {
    display: none;
}

/* Mobile: show back button */
@media (max-width: 768px) {
    .back-btn {
        display: inline-flex;
        font-size: 20px;
        margin-right: 4px;
    }
}

.group-count {
    font-size: 12px;
    color: #94a3b8;
    margin-left: 6px;
}

.clickable {
    cursor: pointer;
}

.group-member-item {
    padding: 8px 6px;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================
   IDLE WARNING MODAL
========================= */

.idle-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.idle-box {
    background: #020617;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

.idle-box h3 {
    margin-bottom: 8px;
}

.idle-box p {
    font-size: 14px;
    color: #94a3b8;
}

.idle-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.idle-actions button {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
}

.idle-actions button:first-child {
    background: #22c55e;
    color: #020617;
}

.idle-actions button:last-child {
    background: #ef4444;
    color: #fff;
}

.danger-btn {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 10px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.danger-btn:hover {
    background: #dc2626;
}
.file-delete-btn {
    width: 100%;
    background: none;
    border: none;
    padding: 8px 12px;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
    color: #ef4444;
}

.file-delete-btn:hover {
    background: #1e293b;
}

/* =========================
   UNDO DELETE BAR
========================= */
.undo-bar {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: #020617;
    color: #e5e7eb;
    padding: 10px 14px;
    border-radius: 10px;
    display: flex;
    gap: 12px;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 9999;
}

.undo-bar button {
    background: none;
    border: none;
    color: #22c55e;
    font-weight: 600;
    cursor: pointer;
}

/* =========================
   UPLOAD PROGRESS BAR
========================= */
.upload-progress {
    width: 100%;
    height: 6px;
    background: #1e293b;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    margin: 4px 0;
}

.upload-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    transition: width 0.2s ease;
}

.upload-progress span {
    position: absolute;
    right: 6px;
    top: -18px;
    font-size: 11px;
    color: #94a3b8;
}

/* =========================
   RECORDING TIMER
========================= */
.record-timer {
    font-size: 13px;
    color: #ef4444; /* red */
    font-weight: 600;
    margin: 0 6px;
    min-width: 40px;
    text-align: center;
}

/* =========================
   FIX AUDIO PLAY BUTTON
========================= */
.message audio {
    display: block;
    width: 100%;
    min-height: 42px;       /* 👈 forces controls visible */
    margin-top: 8px;
}

.message.me audio {
    background: rgba(0,0,0,0.05);
}

.message.other audio {
    background: rgba(0,0,0,0.1);
}

.file-forward-btn {
    width: 100%;
    background: none;
    border: none;
    padding: 8px 12px;
    text-align: left;
    color: #e5e7eb;
    cursor: pointer;
}

.file-forward-btn:hover {
    background: #1e293b;
}

/* =========================
   MAIN DROPDOWN MENU
========================= */
.main-menu {
    position: absolute;
    top: 56px;
    right: 12px;
    width: 220px;
    background: #020617;
    border: 1px solid #1e293b;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: none;
    flex-direction: column;
    z-index: 5000;
}

.main-menu button {
    background: none;
    border: none;
    color: #e5e7eb;
    padding: 12px 14px;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
}

.main-menu button:hover {
    background: #1e293b;
}

.main-menu hr {
    border: none;
    border-top: 1px solid #1e293b;
    margin: 4px 0;
}

.main-menu .danger {
    color: #f87171;
}

.hidden {
    display: none;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #1e293b;
}

.profile-title {
    font-weight: 600;
    font-size: 15px;
}
