.server-card { background: transparent; border: 1px solid transparent; padding: 10px; text-align: center; cursor: pointer; transition: 0.3s; display: flex; flex-direction: column; align-items: flex-start; position: relative; }
.server-card:hover { background: #1a1c23; border-radius: 8px; border: 1px solid #333; }
.server-icon { width: 100%; height: 120px; border-radius: 8px; object-fit: cover; margin-bottom: 10px; border: 1px solid #333; }
.server-title { font-size: 1rem; color: #fff; font-weight: bold; margin-bottom: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; width: 100%; }

.server-card.highlighted { border: 2px solid #e60000; box-shadow: 0 0 15px rgba(230, 0, 0, 0.4); background: rgba(230, 0, 0, 0.05); border-radius: 8px; }
.server-highlight-badge { position: absolute; top: -10px; left: -10px; background: #e60000; color: #fff; padding: 3px 10px; border-radius: 12px; font-size: 0.7rem; font-weight: bold; z-index: 10; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.server-admin-actions { position: absolute; top: 15px; right: 15px; display: flex; gap: 5px; z-index: 100; }

.community-layout { display: flex; height: 100%; }
.comm-sidebar { width: 280px; background: #0f1015; border-right: 1px solid #2a2d38; display: flex; flex-direction: column; overflow-y: auto; }
.active-server-info { display: flex; align-items: center; gap: 15px; padding: 20px; border-bottom: 1px solid #2a2d38; background: #16181e; }
.active-server-info img { width: 50px; height: 50px; border-radius: 12px; object-fit: cover; }
.active-server-info h4 { font-size: 1rem; color: #fff; font-weight: bold; }
.comm-sidebar h3 { font-size: 0.75rem; color: #888; padding: 0 20px; margin-bottom: 15px; letter-spacing: 1px; font-weight: 600; }
.channel-list { list-style: none; padding: 0 10px; }
.channel-list li { padding: 8px 10px; color: #aaa; cursor: pointer; font-weight: 500; font-size: 0.95rem; display: flex; align-items: center; gap: 10px; border-radius: 4px; margin-bottom: 2px; }
.channel-list li:hover { background: #1a1c23; color: #fff; }
.channel-list li.active { background: #1f222b; color: #fff; }

.comm-main { flex: 1; display: flex; flex-direction: column; background: #111217; position: relative; }
.chat-header { padding: 15px 20px; border-bottom: 1px solid #2a2d38; background: #16181e; z-index: 2; }
.chat-header h2 { font-size: 1.1rem; color: #fff; display: flex; align-items: center; gap: 10px; }
.chat-history { flex: 1; padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.chat-welcome-msg { text-align: center; margin-top: auto; margin-bottom: 40px; color: #888; }

.chat-message-wrapper { display: flex; flex-direction: column; position: relative; padding: 5px 15px; margin-top: 10px; }
.chat-message-wrapper:hover { background: #1a1c23; }
.chat-message-content { display: flex; align-items: flex-start; gap: 15px; }
.chat-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; margin-top: 2px; cursor: pointer; background: #2a2d38; border: 1px solid #333; }
.chat-content { flex: 1; }
.chat-username { font-weight: 500; color: #fff; font-size: 1rem; margin-bottom: 2px; display: inline-block; cursor: pointer; }
.chat-username:hover { text-decoration: underline; }
.chat-time { font-size: 0.75rem; color: #888; font-weight: normal; margin-left: 5px; }
.chat-text { color: #ddd; font-size: 0.95rem; line-height: 1.4; }
.chat-attached-img { max-width: 300px; border-radius: 8px; margin-top: 5px; }

.replied-to-block { position: relative; display: flex; align-items: center; font-size: 0.85rem; color: #aaa; margin-bottom: 4px; padding-left: 45px; cursor: pointer; }
.replied-to-block::before { content: ""; position: absolute; left: 20px; top: 50%; width: 15px; height: 12px; border-left: 2px solid #555; border-top: 2px solid #555; border-top-left-radius: 6px; transform: translateY(-50%); }
.chat-actions { position: absolute; right: 15px; top: -15px; background: #16181e; border: 1px solid #2a2d38; border-radius: 4px; padding: 2px; display: none; }
.chat-message-wrapper:hover .chat-actions { display: flex; }
.reply-btn { background: none; border: none; color: #aaa; padding: 5px 8px; cursor: pointer; transition: 0.2s; font-size: 1rem; }
.reply-btn:hover { color: #fff; background: #2a2d38; border-radius: 3px; }
.chat-reactions-list { display: flex; gap: 5px; padding-left: 55px; margin-top: 5px; }
.chat-reaction { background: #16181e; border: 1px solid #2a2d38; border-radius: 6px; padding: 2px 6px; font-size: 0.85rem; color: #ddd; cursor: pointer; display: flex; align-items: center; gap: 5px; }
.chat-reaction:hover, .chat-reaction.reacted { background: #2a2d38; border-color: #ff3333; }

.chat-input-area { padding: 0 20px 20px 20px; background: #111217; position: relative; }
.chat-input-wrapper { display: flex; align-items: center; background: #1a1c23; border-radius: 8px; padding: 10px 15px; gap: 15px; border: 1px solid #2a2d38; }
.chat-icon-btn { background: none; border: none; color: #888; font-size: 1.2rem; cursor: pointer; transition: 0.2s; }
.chat-icon-btn:hover { color: #fff; }
#chatInput { flex: 1; background: transparent; border: none; color: #fff; font-size: 0.95rem; outline: none; font-family: 'Montserrat', sans-serif; }

.emoji-picker-container { position: fixed; bottom: 80px; right: 20px; width: 300px; background: #16181e; border: 1px solid #2a2d38; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 10000; overflow: hidden; display: flex; flex-direction: column; }
.emoji-picker-header { padding: 10px 15px; background: #0f1015; color: #888; font-size: 0.8rem; font-weight: bold; text-transform: uppercase; }
.emoji-list { padding: 10px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; max-height: 200px; overflow-y: auto; }
.emoji-item { font-size: 1.5rem; text-align: center; cursor: pointer; padding: 5px; border-radius: 4px; transition: 0.2s; }
.emoji-item:hover { background: #2a2d38; }

.members-sidebar { width: 240px; background: #0f1015; border-left: 1px solid #2a2d38; display: flex; flex-direction: column; overflow-y: auto; padding: 20px 0; }
.members-sidebar h3 { font-size: 0.75rem; color: #888; padding: 0 20px; margin-bottom: 10px; letter-spacing: 1px; font-weight: 700; text-transform: uppercase; }
.members-list { list-style: none; padding: 0 10px; }
.member-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; cursor: pointer; transition: 0.2s; border-radius: 4px; margin-bottom: 2px; }
.member-item:hover { background: #1a1c23; }
.member-avatar-wrapper { position: relative; display: flex; }
.member-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.status-dot { position: absolute; bottom: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #0f1015; }
.status-online { background-color: #23a559; } 
.status-offline { background-color: #80848e; } 
.member-name { font-size: 0.95rem; color: #aaa; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }

.dm-box-container { position: fixed; bottom: 0; right: 80px; width: 330px; height: 430px; background: #1a1c23; border: 1px solid #333; border-radius: 8px 8px 0 0; box-shadow: 0 5px 25px rgba(0,0,0,0.5); z-index: 9999; display: flex; flex-direction: column; overflow: hidden; font-family: 'Montserrat', sans-serif; transition: height 0.3s; }
.dm-box-container.minimized { height: 48px; }
.dm-box-header { background: #1f222b; padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #333; cursor: pointer; }
.dm-box-header:hover { background: #2a2d38; }
.dm-user-info { display: flex; align-items: center; gap: 8px; }
.dm-user-info img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.dm-user-info h4 { font-size: 0.9rem; color: #fff; margin: 0; font-weight: 600; }
.dm-status { font-size: 0.7rem; color: #888; }
.dm-controls { display: flex; gap: 12px; color: #e60000; font-size: 1.1rem; align-items: center; }
.dm-controls i { cursor: pointer; transition: 0.2s; }
.dm-controls i:hover { color: #ff3333; }

.dm-box-body { flex: 1; display: flex; flex-direction: column; background: #111; min-height: 0; }
.dm-messages { flex: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.dm-msg-row { display: flex; flex-direction: column; max-width: 75%; }
.dm-msg-row.mine { align-self: flex-end; }
.dm-msg-row.theirs { align-self: flex-start; align-items: flex-start; }
.dm-bubble { padding: 8px 12px; border-radius: 18px; font-size: 0.9rem; line-height: 1.3; word-wrap: break-word; }
.dm-msg-row.mine .dm-bubble { background: #e60000; color: #fff; border-bottom-right-radius: 4px; }
.dm-msg-row.theirs .dm-bubble { background: #2a2d38; color: #fff; border-bottom-left-radius: 4px; }
.dm-img-attachment { max-width: 200px; border-radius: 12px; margin-top: 2px; border: 1px solid #333; }

.dm-input-area { padding: 10px; display: flex; align-items: center; gap: 10px; border-top: 1px solid #333; background: #1f222b; }
.dm-action-icons { display: flex; gap: 10px; color: #e60000; font-size: 1.2rem; }
.dm-action-icons i { cursor: pointer; }
.dm-input-field { flex: 1; background: #111; border: 1px solid #333; border-radius: 20px; padding: 8px 12px; font-family: 'Montserrat'; outline: none; color: #fff; }
.dm-like-btn { color: #e60000; font-size: 1.3rem; cursor: pointer; }

.user-info-popup { position: fixed; z-index: 1000; background: #1a1c23; border-radius: 8px; width: 300px; box-shadow: 0 10px 30px rgba(0,0,0,0.8); overflow: hidden; display: none; border: 1px solid #333; }
.popup-banner { height: 60px; background: #e60000; background-size: cover; background-position: center; border-radius: 8px 8px 0 0; }
.popup-header-overlay { position: relative; margin-top: -30px; margin-left: 20px; display: flex; align-items: flex-end; }
.popup-header-overlay img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 5px solid #1a1c23; background: #1a1c23; }
.status-dot-large { position: absolute; bottom: 5px; right: 5px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid #1a1c23; }
.popup-body { padding: 15px 20px 20px 20px; background: #1a1c23; }
.popup-body h4 { font-size: 1.1rem; color: #fff; margin-bottom: 5px; }
.popup-bio { font-size: 0.85rem; color: #aaa; line-height: 1.4; margin-bottom: 15px; }
.popup-details { display: flex; flex-direction: column; gap: 8px; font-size: 0.85rem; color: #888; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #333; }
.btn-blurple { width: 100%; background: #e60000; color: #fff; border: none; padding: 10px; border-radius: 4px; font-weight: 600; cursor: pointer; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-blurple:hover { background: #ff1a1a; }

.notif-list { max-height: 350px; overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 12px 15px; border-bottom: 1px solid #2a2d38; align-items: flex-start; transition: 0.2s; cursor: pointer; }
.notif-item:hover { background: #2a2d38; }
.notif-item.unread { background: rgba(230, 0, 0, 0.1); }
.notif-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.notif-content { flex: 1; font-size: 0.85rem; color: #ccc; }
.notif-content strong { color: #fff; }
.notif-actions { display: flex; gap: 5px; margin-top: 8px; }
.notif-btn { padding: 6px 12px; border: none; border-radius: 4px; cursor: pointer; font-size: 0.8rem; font-weight: bold; }
.btn-accept { background: #e60000; color: #fff; }
.btn-decline { background: #333; color: #fff; }

.typing-indicator { font-size: 0.8rem; color: #888; font-style: italic; min-height: 16px; }

/* MOBILE ONLY BUTTONS */
.mobile-only-btn { display: none; }

@media (max-width: 768px) {
    .community-layout { flex-direction: column; height: 100%; min-height: 0; }
    
    .mobile-only-btn { display: inline-block !important; }

    /* 1. FULLSCREEN DM BOX (Inbox UI) */
    .dm-box-container {
        position: fixed; top: 0; left: 0; right: 0; bottom: 0;
        width: 100% !important; 
        height: 100% !important; /* Fallback para sa mga lumang browser */
        height: 100dvh !important; /* Saktong susunod sa dynamic height kahit may address bar */
        border-radius: 0; z-index: 100000;
    }
    .dm-box-container.minimized { display: none !important; }
    #dmMinimizeBtn { display: none !important; }
    #dmMobileBackBtn { display: inline-block !important; font-size: 1.2rem; cursor: pointer; }
    
    .notif-dropdown {
        position: absolute !important; 
        top: 60px !important; 
        left: 50% !important; 
        transform: translateX(-50%) !important;
        width: 95vw !important;
        height: auto !important; 
        max-height: 80vh !important;
        border-radius: 12px !important; 
        z-index: 99999 !important;
        box-shadow: 0 10px 40px rgba(0,0,0,0.9) !important;
    }
    .notif-list { flex: 1; max-height: none; overflow-y: auto; padding-bottom: 20px; }
    #notifDropdown::before, #notifDropdown::after, #inboxDropdown::before, #inboxDropdown::after { display: none !important; }
    
    /* 3. CLEAN MOBILE COMMUNITY CHAT */
    .members-sidebar { display: none !important; } /* Hide members on mobile */
    .comm-sidebar { 
        width: 100%; height: auto; flex-direction: row; 
        border-right: none; border-bottom: 1px solid #2a2d38; 
        align-items: center; overflow-x: auto; padding-bottom: 10px;
    }
    .active-server-info, .comm-sidebar h3 { display: none !important; } /* Clean header */
    .channel-list { 
        display: flex; flex-direction: row; width: 100%; padding: 0 10px; margin: 0; gap: 10px;
    }
    .channel-list li { margin: 0; white-space: nowrap; padding: 8px 15px; border-radius: 20px; background: #1a1c23; border: 1px solid #333; }
    .channel-list li.active { background: #e60000; color: #fff; border-color: #e60000; }
    #btnBackToServers { margin: 10px 5px 10px 15px; font-size: 0.75rem; padding: 6px 12px; white-space: nowrap; border-radius: 20px; }
    
    .chat-history { padding: 10px; }
    .chat-message-wrapper { padding: 5px 10px; }
    .chat-header h2 { font-size: 1rem; }
    .comm-main { height: auto; flex: 1; min-height: 0; }
    .emoji-picker-container { right: 10px !important; bottom: 70px !important; width: 300px; }
}

/* DM REACTIONS & SEEN STATUS STYLES */
.dm-msg-row { position: relative; }

.dm-reaction-trigger {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: #2a2d38; color: #aaa; border: 1px solid #444; border-radius: 50%;
    width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; opacity: 0; transition: 0.2s; font-size: 0.8rem; z-index: 5;
}
.dm-msg-row.mine .dm-reaction-trigger { left: -35px; }
.dm-msg-row.theirs .dm-reaction-trigger { right: -35px; }
.dm-msg-row:hover .dm-reaction-trigger { opacity: 1; }
.dm-reaction-trigger:hover { background: #3f4454; color: #fff; transform: translateY(-50%) scale(1.2); }

.dm-reactions-display {
    display: flex; gap: 2px; margin-top: -8px; z-index: 2; position: relative;
    padding: 0 5px;
}
.dm-msg-row.mine .dm-reactions-display { justify-content: flex-end; }
.dm-reaction-bubble {
    background: #1a1c23; border: 1px solid #333; border-radius: 12px;
    padding: 2px 6px; font-size: 0.75rem; box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.dm-seen-status {
    font-size: 0.65rem; color: #888; text-align: right; margin-top: 2px; margin-right: 5px;
    display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-style: italic;
}

.mini-reaction-picker {
    position: fixed; background: #1a1c23; border: 1px solid #333; border-radius: 25px;
    display: flex; gap: 8px; padding: 6px 12px; box-shadow: 0 5px 20px rgba(0,0,0,0.8); z-index: 100000;
}
.mini-reaction-picker span { cursor: pointer; font-size: 1.3rem; transition: transform 0.2s; }
.mini-reaction-picker span:hover { transform: scale(1.4) translateY(-2px); }