/* ── APPEND: New feature styles for messages page ──────────────────────────── */

/* ── Thread dropdown menu ──────────────────────────────────────────────────── */

.thread-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 200;
    min-width: 200px;
    background: #1a0a2e;
    border: 1px solid rgba(127,19,236,0.28);
    border-radius: 14px;
    padding: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45);
    animation: menuFadeIn 0.15s ease;
}

body.light-mode .thread-dropdown-menu {
    background: #fff;
    border-color: rgba(127,19,236,0.18);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

@keyframes menuFadeIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.85);
    font-size: 14px;
    font-weight: 600;
    font-family: "Manrope", sans-serif;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

body.light-mode .dropdown-item {
    color: rgba(0,0,0,0.8);
}

.dropdown-item:hover {
    background: rgba(255,255,255,0.07);
}

body.light-mode .dropdown-item:hover {
    background: rgba(0,0,0,0.05);
}

.dropdown-item.danger {
    color: #f87171;
}

body.light-mode .dropdown-item.danger {
    color: #dc2626;
}

.dropdown-item.danger:hover {
    background: rgba(248,113,113,0.1);
}

.dropdown-item .material-symbols-outlined {
    font-size: 18px;
    opacity: 0.75;
}

/* ── Chat search bar ───────────────────────────────────────────────────────── */

.chat-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(127,19,236,0.18);
    background: rgba(127,19,236,0.06);
    animation: slideDown 0.18s ease;
}

body.light-mode .chat-search-bar {
    background: rgba(127,19,236,0.04);
    border-bottom-color: rgba(127,19,236,0.12);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-search-bar .material-symbols-outlined {
    font-size: 18px;
    color: rgba(255,255,255,0.35);
    flex-shrink: 0;
}

body.light-mode .chat-search-bar .material-symbols-outlined {
    color: rgba(0,0,0,0.35);
}

#chat-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: white;
    font-family: "Manrope", sans-serif;
    font-size: 14px;
}

body.light-mode #chat-search-input {
    color: #111;
}

#chat-search-input::placeholder {
    color: rgba(255,255,255,0.28);
}

body.light-mode #chat-search-input::placeholder {
    color: rgba(0,0,0,0.28);
}

.chat-search-count {
    font-size: 12px;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    white-space: nowrap;
}

body.light-mode .chat-search-count {
    color: rgba(0,0,0,0.4);
}

.chat-search-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.45);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.chat-search-close:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

body.light-mode .chat-search-close {
    color: rgba(0,0,0,0.45);
}

body.light-mode .chat-search-close:hover {
    background: rgba(0,0,0,0.06);
    color: #111;
}

.chat-search-close .material-symbols-outlined {
    font-size: 18px;
}

.message-bubble.search-hidden {
    display: none;
}

.message-bubble.search-match {
    outline: 1.5px solid rgba(127,19,236,0.55);
    outline-offset: 2px;
}

/* ── Pinned banner ─────────────────────────────────────────────────────────── */

.pinned-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(127,19,236,0.18);
    background: rgba(127,19,236,0.08);
    cursor: pointer;
    animation: slideDown 0.18s ease;
}

body.light-mode .pinned-banner {
    background: rgba(127,19,236,0.05);
    border-bottom-color: rgba(127,19,236,0.12);
}

.pinned-icon {
    font-size: 16px;
    color: #c084fc;
    flex-shrink: 0;
}

.pinned-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pinned-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #c084fc;
}

.pinned-text {
    font-size: 13px;
    color: rgba(255,255,255,0.72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.light-mode .pinned-text {
    color: rgba(0,0,0,0.65);
}

.pinned-scroll-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: #c084fc;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.pinned-scroll-btn:hover {
    background: rgba(127,19,236,0.14);
}

.pinned-scroll-btn .material-symbols-outlined {
    font-size: 18px;
}

.message-bubble.pinned-highlight {
    outline: 2px solid #c084fc;
    outline-offset: 3px;
    transition: outline 0.3s;
}

/* ── Message action menu (delete / pin popup) ──────────────────────────────── */

.message-bubble {
    position: relative;
}

.msg-action-menu {
    position: absolute;
    top: -8px;
    z-index: 100;
    display: flex;
    gap: 4px;
    background: #1a0a2e;
    border: 1px solid rgba(127,19,236,0.28);
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
    animation: menuFadeIn 0.12s ease;
}

body.light-mode .msg-action-menu {
    background: #fff;
    border-color: rgba(127,19,236,0.18);
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
}

.msg-action-menu.mine  { right: 0; }
.msg-action-menu.theirs { left: 0; }

.msg-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.82);
    font-size: 13px;
    font-weight: 600;
    font-family: "Manrope", sans-serif;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

body.light-mode .msg-action-btn {
    color: rgba(0,0,0,0.78);
}

.msg-action-btn:hover {
    background: rgba(255,255,255,0.08);
}

body.light-mode .msg-action-btn:hover {
    background: rgba(0,0,0,0.05);
}

.msg-action-btn.danger {
    color: #f87171;
}

body.light-mode .msg-action-btn.danger {
    color: #dc2626;
}

.msg-action-btn.danger:hover {
    background: rgba(248,113,113,0.1);
}

.msg-action-btn .material-symbols-outlined {
    font-size: 16px;
}

/* ── Confirm dialog ────────────────────────────────────────────────────────── */

.msg-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: overlayFadeIn 0.15s ease;
}

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

.msg-confirm-box {
    background: #1a0a2e;
    border: 1px solid rgba(127,19,236,0.3);
    border-radius: 20px;
    padding: 28px 24px 20px;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    animation: menuFadeIn 0.18s ease;
}

body.light-mode .msg-confirm-box {
    background: #fff;
    border-color: rgba(127,19,236,0.18);
    box-shadow: 0 20px 48px rgba(0,0,0,0.15);
}

.msg-confirm-box h3 {
    margin: 0 0 10px;
    font-size: 17px;
    font-weight: 800;
    color: white;
    letter-spacing: -0.02em;
}

body.light-mode .msg-confirm-box h3 {
    color: #111;
}

.msg-confirm-box p {
    margin: 0 0 22px;
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    line-height: 1.6;
}

body.light-mode .msg-confirm-box p {
    color: rgba(0,0,0,0.55);
}

.msg-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.msg-confirm-cancel,
.msg-confirm-ok {
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    font-family: "Manrope", sans-serif;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s;
}

.msg-confirm-cancel {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.75);
    border-color: rgba(255,255,255,0.1);
}

.msg-confirm-cancel:hover {
    background: rgba(255,255,255,0.12);
}

body.light-mode .msg-confirm-cancel {
    background: rgba(0,0,0,0.05);
    color: rgba(0,0,0,0.65);
    border-color: rgba(0,0,0,0.1);
}

body.light-mode .msg-confirm-cancel:hover {
    background: rgba(0,0,0,0.08);
}

.msg-confirm-ok.danger {
    background: rgba(220,38,38,0.18);
    color: #f87171;
    border-color: rgba(220,38,38,0.3);
}

.msg-confirm-ok.danger:hover {
    background: rgba(220,38,38,0.28);
}

body.light-mode .msg-confirm-ok.danger {
    background: rgba(220,38,38,0.1);
    color: #dc2626;
    border-color: rgba(220,38,38,0.25);
}

/* ── Toast notification ────────────────────────────────────────────────────── */

.msg-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    z-index: 2000;
    background: #1a0a2e;
    border: 1px solid rgba(127,19,236,0.3);
    border-radius: 999px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.88);
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    white-space: nowrap;
    pointer-events: none;
}

body.light-mode .msg-toast {
    background: #fff;
    border-color: rgba(127,19,236,0.2);
    color: rgba(0,0,0,0.78);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
}

.msg-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
    .msg-toast {
        bottom: 80px;
        font-size: 12px;
        padding: 9px 16px;
    }

    .msg-confirm-box {
        padding: 22px 18px 18px;
    }

    .thread-dropdown-menu {
        min-width: 180px;
    }
}
