/* ==========================================================================
   1. COLOR VARIABLES & THEME DEFINITIONS
   ========================================================================== */
:root {
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --border-color: #cbd5e1;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --input-bg: #ffffff;
    --comment-bg: #f8fafc;
    --avatar-bg: #dbeafe;
    --avatar-text: #1d4ed8;
    --kebab-hover: #e2e8f0;
}

body.dark-mode,
body.dark-theme,
.dark-theme {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --border-color: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary-color: #3b82f6;
    --primary-hover: #60a5fa;
    --input-bg: #0f172a;
    --comment-bg: #0f172a;
    --avatar-bg: #1e3a8a;
    --avatar-text: #93c5fd;
    --kebab-hover: #334155;
}

/* ==========================================================================
   2. GLOBAL LAYOUT & CONTAINER FIXES
   ========================================================================== */
* {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    min-height: 100%;
    min-height: -webkit-fill-available;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
    width: 100% !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    position: relative !important;
}

.main-wrapper {
    flex: 1 1 auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 16px 20px 80px !important;
    box-sizing: border-box !important;
}

/* Post Message Textarea Auto-Expand & Hide Scrollbars */
#postMessage,
.comment-input-field,
.auto-expand-textarea {
    overflow-y: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    resize: none !important;
    transition: height 0.1s ease !important;
}

#postMessage::-webkit-scrollbar,
.comment-input-field::-webkit-scrollbar,
.auto-expand-textarea::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

input, textarea, button {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 15px;
}

.page-wrapper {
    background-color: var(--bg-color) !important;
    min-height: 100vh;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Fixes the white background issue by explicitly using --bg-color */
.container,
.timeline-container { 
    max-width: 680px; 
    margin: 0 auto; 
    background-color: transparent !important;
    width: 100%;
    box-sizing: border-box;
}

#timelineFeed {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.timeline-feed-header {
    padding: 14px 0;
    margin-bottom: 18px;
}

.timeline-user-subtext {
    font-size: 13px;
    color: var(--primary-blue, #1e5eff) !important;
    margin: 2px 0 0 0;
    font-weight: 600;
}

body.dark-theme .timeline-user-subtext,
body.dark-mode .timeline-user-subtext {
    color: #60a5fa !important;
}

/* Hide student-only navigation tabs for Staff/Teacher/Admin accounts */
.student-only-nav.hidden,
.kebab-item.student-only-nav.hidden,
.menu-btn.student-only-nav.hidden {
    display: none !important;
}

/* Bulletproof reinforcement for Mobile Menu Button */
#mobileTopbarKebabBtn.mobile-kebab-btn,
.mobile-kebab-container .mobile-kebab-btn {
    background: #1e5eff !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 10px !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 3px 10px rgba(30, 94, 255, 0.45) !important;
    padding: 0 !important;
    cursor: pointer !important;
}

#mobileTopbarKebabBtn.mobile-kebab-btn svg,
.mobile-kebab-container .mobile-kebab-btn svg {
    width: 20px !important;
    height: 20px !important;
    stroke: #ffffff !important;
    fill: none !important;
    stroke-width: 2.2 !important;
    color: #ffffff !important;
    pointer-events: none !important;
    display: block !important;
}

body.dark-theme #mobileTopbarKebabBtn.mobile-kebab-btn,
body.dark-mode #mobileTopbarKebabBtn.mobile-kebab-btn {
    background: #2563eb !important;
    border: 1px solid rgba(147, 197, 253, 0.6) !important;
    box-shadow: 0 0 14px rgba(37, 99, 235, 0.6) !important;
}

/* ==========================================================================
   3. POST CREATION AREA
   ========================================================================== */
.post-box { 
    background: var(--card-bg) !important; 
    padding: 22px 24px !important; 
    border-radius: 16px !important; 
    margin-bottom: 24px !important; 
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04) !important;
    box-sizing: border-box !important;
}

.composer-author-row {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 14px !important;
}

.composer-avatar-circle {
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: #1e5eff !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    flex-shrink: 0 !important;
}

.composer-input-wrapper {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.post-box textarea,
#postMessage { 
    width: 100% !important; 
    padding: 14px 16px !important; 
    margin: 6px 0 14px 0 !important; 
    background-color: var(--input-bg, #f8fafc) !important;
    color: var(--text-main) !important;
    border: 1.5px solid var(--border-color, #cbd5e1) !important; 
    border-radius: 12px !important; 
    font-size: 15.5px !important;
    line-height: 1.55 !important;
    resize: none !important; 
    min-height: 95px !important; 
    outline: none !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease !important;
}

.post-box textarea:focus,
#postMessage:focus {
    background-color: var(--card-bg, #ffffff) !important;
    border-color: var(--primary-color, #2563eb) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
}

.post-options-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-top: 4px !important;
    padding-top: 12px !important;
    border-top: 1px solid var(--border-color) !important;
    gap: 12px !important;
}

.target-selector-wrapper select,
#postTargetClass {
    padding: 8px 14px !important;
    border-radius: 10px !important;
    border: 1px solid var(--border-color) !important;
    background: var(--input-bg, #f8fafc) !important;
    color: var(--text-main) !important;
    font-size: 13.5px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
}

#submitPostBtn { 
    background: var(--primary-color, #1e5eff) !important; 
    color: #ffffff !important; 
    border: none !important; 
    padding: 9px 24px !important; 
    border-radius: 20px !important; 
    cursor: pointer !important; 
    font-weight: 700 !important; 
    font-size: 14px !important;
    min-height: 38px !important;
    width: auto !important; 
    box-shadow: 0 2px 8px rgba(30, 94, 255, 0.25) !important;
    transition: all 0.2s ease !important;
}

#submitPostBtn:hover {
    background: var(--primary-hover, #113f9f) !important;
    transform: translateY(-1px) !important;
}

/* ==========================================================================
   4. TIMELINE POST CARDS & SENDER HEADER
   ========================================================================== */
.timeline-post { 
    background: var(--card-bg); 
    padding: 20px; 
    border-radius: 16px; 
    margin-bottom: 16px; 
    border: 1px solid var(--border-color); 
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03); 
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.post:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.post-header,
.post-sender-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    margin-bottom: 12px !important;
    position: relative !important;
}

.sender-info-wrapper {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    flex: 1 !important;
    min-width: 0 !important;
}

.avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--avatar-bg);
    color: var(--avatar-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.sender-details {
    display: flex;
    flex-direction: column;
}

.sender-name-line {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sender-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-main);
}

.post-time {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.staff-badge { 
    display: inline-flex; 
    align-items: center;
    justify-content: center;
    background: #10b981; 
    color: white; 
    width: 18px;
    height: 18px;
    border-radius: 50%; 
    font-size: 11px; 
    font-weight: 700;
    line-height: 1;
}

.post-body { 
    font-size: 18px;
    font-weight: 400;
    color: var(--text-main); 
    margin-bottom: 8px;
    white-space: pre-wrap; 
    line-height: 1.6;
    padding-left: 56px;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ==========================================================================
   5. KEBAB DROPDOWN MENU
   ========================================================================== */
.kebab-wrapper {
    position: relative !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
}

.kebab-btn {
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-radius: 50% !important;
    outline: none !important;
    box-shadow: none !important;
    color: var(--text-muted) !important;
    font-size: 20px !important;
    font-weight: bold !important;
    padding: 0 !important;
    cursor: pointer !important;
    line-height: 1 !important;
    width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s, color 0.2s !important;
    transform: none !important;
    margin: 0 !important;
}

.kebab-btn:hover,
.kebab-btn:focus {
    background: var(--kebab-hover, rgba(0, 0, 0, 0.06)) !important;
    color: var(--text-main) !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.kebab-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    z-index: 100;
    min-width: 140px;
    overflow: hidden;
}

.kebab-dropdown.hidden { display: none !important; }

.kebab-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.kebab-item:hover {
    background: var(--comment-bg);
}

.kebab-item.danger {
    color: #ef4444;
}

/* ==========================================================================
   6. ACTIONS & COMMENTARY SECTION
   ========================================================================== */
.post-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 4px; /* Reduced top padding */
    border-top: none; /* REMOVED: Divider border line between post text and button */
    margin-top: 4px;  /* Reduced top margin */
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 13px; /* Reduced from 14px to make button font smaller */
    font-weight: 500; /* Slightly lighter weight to reduce distraction */
    cursor: pointer;
    padding: 4px 8px; /* Compact padding */
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 32px; /* Reduced min-height */
    transition: background 0.2s, color 0.2s;
}

.action-btn:hover {
    background: var(--comment-bg);
    color: var(--primary-color);
}

.comments-wrapper {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--border-color);
}

.comments-wrapper.hidden { display: none !important; }

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.comment-item { 
    background: var(--comment-bg); 
    padding: 12px 16px; 
    border-radius: 8px; 
    font-size: 14px; 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start;
    border: 1px solid var(--border-color);
}

.comment-content {
    color: var(--text-main);
    line-height: 1.5;

    /* Prevent overflow in replies as well */
    overflow-wrap: break-word;
    word-break: break-word;
}

.comment-content strong { 
    color: var(--primary-color); 
    margin-right: 6px;
}

.reply-box { 
    display: flex !important; 
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important; 
    margin-top: 12px !important; 
    width: 100% !important;
    box-sizing: border-box !important;
}

.reply-box input,
.reply-box input[type="text"],
.reply-box .reply-input { 
    flex: 1 1 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 10px 16px !important; 
    background: var(--input-bg) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important; 
    border-radius: 20px !important; 
    font-size: 14px !important; 
    height: 42px !important;
    min-height: 42px !important;
    outline: none !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.reply-box input:focus,
.reply-box input[type="text"]:focus,
.reply-box .reply-input:focus {
    border-color: var(--primary-color) !important;
}

.reply-box button,
.reply-box .reply-submit-btn { 
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    width: auto !important;
    background: #10b981 !important; 
    color: #ffffff !important; 
    border: none !important; 
    border-radius: 20px !important; 
    padding: 0 20px !important; 
    cursor: pointer !important; 
    font-size: 14px !important; 
    font-weight: 700 !important;
    height: 42px !important;
    min-height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: none !important;
    transform: none !important;
    margin: 0 !important;
    white-space: nowrap !important;
}

.reply-box button:hover,
.reply-box .reply-submit-btn:hover {
    background: #059669 !important;
    color: #ffffff !important;
    border: none !important;
    transform: none !important;
}

.hidden { display: none !important; }

/* ==========================================================================
   7. NAVIGATION & LOGIN SCREEN
   ========================================================================== */
.top-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.nav-controls { display: flex; gap: 10px; align-items: center; }

.theme-toggle-btn {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    min-height: 40px;
}

.login-box { 
    max-width: 420px; 
    margin: 40px auto; 
    background: var(--card-bg); 
    padding: 32px; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); 
    text-align: center; 
    border: 1px solid var(--border-color);
}

.login-box input { 
    width: 100%; 
    padding: 12px; 
    margin: 8px 0 16px 0; 
    background: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color); 
    border-radius: 8px; 
    min-height: 44px;
}

.login-box button { 
    width: 100%; 
    padding: 12px; 
    background: var(--primary-color); 
    color: white; 
    border: none; 
    border-radius: 8px; 
    font-weight: bold; 
    font-size: 16px;
    min-height: 44px;
    cursor: pointer; 
}

/* ==========================================================================
   CLASS TARGETING & AUDIENCE BADGES
   ========================================================================== */
.post-options-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.target-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.target-selector-wrapper label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
}

.target-selector-wrapper select,
#postTargetClass {
    padding: 6px 24px 6px 10px !important;
    background-color: var(--input-bg, #ffffff) !important;
    color: var(--text-main, #0f172a) !important;
    border: 1px solid var(--border-color, #cbd5e1) !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    height: 36px !important;
    line-height: normal !important;
    box-sizing: border-box !important;
    outline: none;
    cursor: pointer;
    display: inline-block !important;
    vertical-align: middle !important;
}

body.dark-mode .target-selector-wrapper select,
body.dark-theme .target-selector-wrapper select,
body.dark-mode #postTargetClass,
body.dark-theme #postTargetClass {
    background-color: #1e293b !important;
    color: #f8fafc !important;
    border-color: #334155 !important;
}

body.dark-mode .target-selector-wrapper select option,
body.dark-theme .target-selector-wrapper select option,
body.dark-mode #postTargetClass option,
body.dark-theme #postTargetClass option {
    background-color: #1e293b !important;
    color: #f8fafc !important;
}

.target-selector-wrapper select:focus,
#postTargetClass:focus {
    border-color: var(--primary-color) !important;
}

.target-class-badge {
    display: inline-flex;
    align-items: center;
    background: var(--avatar-bg, #dbeafe);
    color: var(--avatar-text, #1d4ed8);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
    border: 1px solid var(--border-color, #cbd5e1);
}

body.dark-mode .target-class-badge,
body.dark-theme .target-class-badge {
    background: rgba(37, 99, 235, 0.2) !important;
    color: #93c5fd !important;
    border-color: rgba(147, 197, 253, 0.3) !important;
}

@media (max-width: 480px) {
    .post-options-row {
        flex-direction: column;
        align-items: stretch;
    }
    .target-selector-wrapper select {
        width: 100%;
    }
}

/* Notifications & Mentions */
.notif-wrapper { position: relative; }
#notifToggleBtn.notif-btn,
.notif-btn { 
    background: #ffffff !important; 
    color: #1e293b !important; 
    border: 1.5px solid #cbd5e1 !important; 
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    max-width: 36px !important;
    max-height: 36px !important;
    padding: 0 !important; 
    border-radius: 50% !important; 
    cursor: pointer !important; 
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08) !important;
}
#notifToggleBtn.notif-btn:hover,
.notif-btn:hover {
    background: #f1f5f9 !important;
    border-color: #94a3b8 !important;
    transform: scale(1.06) !important;
}
#notifToggleBtn.notif-btn svg,
.notif-btn svg {
    width: 18px !important;
    height: 18px !important;
    stroke: #1e293b !important;
    fill: none !important;
    stroke-width: 2.2 !important;
    color: #1e293b !important;
    display: block !important;
    pointer-events: none !important;
}
.notif-badge { 
    position: absolute !important; 
    top: -4px !important; 
    right: -4px !important; 
    background: #ef4444 !important; 
    color: #ffffff !important; 
    font-size: 10px !important; 
    padding: 1px 5px !important; 
    border-radius: 10px !important; 
    font-weight: 800 !important; 
    display: none; 
}
body.dark-theme #notifToggleBtn.notif-btn,
body.dark-mode #notifToggleBtn.notif-btn,
body.dark-theme .notif-btn,
body.dark-mode .notif-btn {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}
body.dark-theme #notifToggleBtn.notif-btn svg,
body.dark-mode #notifToggleBtn.notif-btn svg,
body.dark-theme .notif-btn svg,
body.dark-mode .notif-btn svg {
    stroke: #f8fafc !important;
    color: #f8fafc !important;
}
.notif-dropdown { display: none; position: absolute; top: 45px; right: 0; width: 300px; max-height: 320px; overflow-y: auto; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15); z-index: 100; }
.notif-item { padding: 12px 14px; border-bottom: 1px solid var(--border-color); font-size: 14px; cursor: pointer; color: var(--text-main); }
.notif-item:hover { background: var(--comment-bg); }
.notif-item.unread { font-weight: bold; background: var(--avatar-bg); border-left: 3px solid var(--primary-color); }

.mention-popup { position: absolute; background: var(--card-bg); border: 1px solid var(--border-color); max-height: 200px; overflow-y: auto; z-index: 1000; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15); border-radius: 8px; }
.mention-item { padding: 12px 14px; font-size: 14px; cursor: pointer; color: var(--text-main); border-bottom: 1px solid var(--border-color); }
.mention-item:last-child { border-bottom: none; }
.mention-item:hover { background: var(--avatar-bg); color: var(--primary-color); font-weight: bold; }

/* ==========================================================================
   8. RESPONSIVE DESIGN (MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 768px) {
    body { padding: 0 !important; margin: 0 !important; }
    .app-container { width: 100% !important; padding: 0 !important; margin: 0 !important; }
    .sidebar, .student-sidebar { width: 100% !important; border-radius: 0 !important; padding: 0 12px !important; }
    .main-wrapper { padding: 8px 14px 24px !important; }
    .timeline-container { width: 100% !important; }
    .post-body { padding-left: 0; }
    .top-nav { flex-direction: row; gap: 10px; }
}

@media (max-width: 480px) {
    body { font-size: 15px; padding: 0 !important; margin: 0 !important; }
    .main-wrapper { padding: 6px 12px 24px !important; }
    .timeline-post, .post-box { padding: 16px; margin-bottom: 14px; }
    .reply-box { flex-direction: column; }
    .reply-box button { width: 100%; }
    .avatar-circle { width: 38px; height: 38px; font-size: 16px; }
    .sender-name { font-size: 15px; }
    .post-body { 
        font-size: 16px; /* Responsive size for mobile screens */
        padding-left: 0;}
}

/* --- ICON & LOGO UTILITY CLASSES --- */
.brand-badge-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.stat-icon-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.btn-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 6px;
    object-fit: contain;
}

/* ==========================================================================
   9. DIRECT MESSAGING (DM) FLOATING WIDGET & CHAT DRAWER
   ========================================================================== */
.dm-floating-btn {
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    z-index: 1000 !important;
    background: #1e5eff !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 30px !important;
    padding: 10px 18px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    box-shadow: 0 6px 20px rgba(30, 94, 255, 0.35) !important;
    cursor: pointer !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    margin: 0 !important;
    height: 42px !important;
    min-height: 42px !important;
    width: auto !important;
}

.dm-floating-btn:hover {
    background: #113f9f !important;
    color: #ffffff !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(30, 94, 255, 0.45) !important;
}

.dm-unread-badge {
    background: #ef4444 !important;
    color: #ffffff !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    padding: 2px 7px !important;
    border-radius: 12px !important;
    line-height: 1 !important;
}

.dm-popup-widget {
    position: fixed !important;
    bottom: 76px !important;
    right: 24px !important;
    width: 360px !important;
    height: 480px !important;
    max-width: calc(100vw - 32px) !important;
    max-height: calc(100vh - 90px) !important;
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2) !important;
    z-index: 1001 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    transition: all 0.25s ease !important;
}

.dm-popup-widget.hidden {
    display: none !important;
}

#dmPopupWidget button {
    box-sizing: border-box !important;
    line-height: 1 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    margin: 0 !important;
    transform: none !important;
    box-shadow: none !important;
}

.dm-widget-header {
    background: #0b1437 !important;
    color: #ffffff !important;
    padding: 10px 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.dm-user-info {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.dm-status-dot {
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: #10b981 !important;
    box-shadow: 0 0 6px #10b981 !important;
}

.dm-user-name {
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
    color: #ffffff !important;
}

.dm-subtitle {
    font-size: 11px !important;
    opacity: 0.75 !important;
    color: #a0aec0 !important;
}

.dm-header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
}

#dmPopupWidget .dm-new-chat-btn {
    background: #1e5eff !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 5px 12px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    height: 28px !important;
    min-height: 28px !important;
    width: auto !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
}

#dmPopupWidget .dm-new-chat-btn:hover {
    background: #113f9f !important;
    color: #ffffff !important;
}

#dmPopupWidget .dm-icon-btn {
    background: transparent !important;
    color: #ffffff !important;
    border: none !important;
    font-size: 18px !important;
    width: 28px !important;
    height: 28px !important;
    min-height: 28px !important;
    padding: 0 !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#dmPopupWidget .dm-icon-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

.dm-view-section {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: var(--card-bg) !important;
}

.dm-view-section.hidden {
    display: none !important;
}

/* THREADS & CONTACTS LISTS */
.dm-threads-list,
.dm-contacts-list {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 4px 0 !important;
}

.dm-thread-item,
.dm-contact-item {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 10px 14px !important;
    border-bottom: 1px solid var(--border-color) !important;
    cursor: pointer !important;
    transition: background 0.15s !important;
}

.dm-thread-item:hover,
.dm-contact-item:hover {
    background: var(--comment-bg) !important;
}

.dm-contact-avatar {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    background: var(--avatar-bg) !important;
    color: var(--avatar-text) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    flex-shrink: 0 !important;
}

.dm-contact-info {
    flex: 1 !important;
    margin: 0 10px !important;
    overflow: hidden !important;
}

.dm-contact-name {
    font-size: 13.5px !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

.dm-preview-text {
    font-size: 11.5px !important;
    color: var(--text-muted) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin-top: 2px !important;
}

#dmContactsList .dm-new-chat-btn,
.dm-contact-item .dm-new-chat-btn {
    background: #1e5eff !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 12px !important;
    padding: 4px 10px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    height: 26px !important;
    min-height: 26px !important;
    width: auto !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
}

.dm-search-bar {
    padding: 8px 12px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    border-bottom: 1px solid var(--border-color) !important;
    background: var(--card-bg) !important;
}

.dm-search-bar input {
    flex: 1 !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
    border-radius: 14px !important;
    border: 1px solid var(--border-color) !important;
    background: var(--input-bg) !important;
    color: var(--text-main) !important;
    outline: none !important;
    height: 32px !important;
    min-height: 32px !important;
    margin: 0 !important;
}

#dmPopupWidget .dm-back-btn {
    background: transparent !important;
    border: none !important;
    color: #1e5eff !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    padding: 4px 8px !important;
    height: 28px !important;
    min-height: 28px !important;
    width: auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
}

#dmPopupWidget .dm-back-btn:hover {
    background: var(--comment-bg) !important;
}

/* CHATROOM STREAM */
.dm-chatroom-bar {
    padding: 8px 12px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    background: var(--comment-bg) !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.dm-partner-info { flex: 1 !important; }

.dm-partner-name {
    font-size: 13.5px !important;
    font-weight: 700 !important;
    color: var(--text-main) !important;
}

.dm-partner-role {
    font-size: 11px !important;
    color: var(--text-muted) !important;
}

#dmPopupWidget .kebab-dropdown {
    position: absolute !important;
    top: 32px !important;
    right: 0 !important;
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
    z-index: 1005 !important;
    min-width: 130px !important;
    padding: 4px 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

#dmPopupWidget .kebab-dropdown.hidden {
    display: none !important;
}

#dmPopupWidget .kebab-item {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
    padding: 8px 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--text-main) !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    cursor: pointer !important;
    text-align: left !important;
}

#dmPopupWidget .kebab-item:hover {
    background: var(--comment-bg) !important;
}

.dm-messages-stream {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 12px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
}

.dm-message-bubble {
    max-width: 80% !important;
    padding: 8px 12px !important;
    border-radius: 14px !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    word-break: break-word !important;
}

.dm-msg-sent {
    align-self: flex-end !important;
    background: #1e5eff !important;
    color: #ffffff !important;
    border-bottom-right-radius: 3px !important;
}

.dm-msg-received {
    align-self: flex-start !important;
    background: var(--comment-bg) !important;
    color: var(--text-main) !important;
    border: 1px solid var(--border-color) !important;
    border-bottom-left-radius: 3px !important;
}

.dm-msg-time {
    font-size: 9.5px !important;
    opacity: 0.75 !important;
    margin-top: 3px !important;
    text-align: right !important;
}

.dm-message-input-bar {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 12px !important;
    border-top: 1px solid var(--border-color) !important;
    background: var(--card-bg) !important;
}

.dm-message-input-bar input {
    flex: 1 !important;
    padding: 6px 12px !important;
    font-size: 13px !important;
    border-radius: 18px !important;
    border: 1px solid var(--border-color) !important;
    background: var(--input-bg) !important;
    color: var(--text-main) !important;
    outline: none !important;
    height: 34px !important;
    min-height: 34px !important;
    margin: 0 !important;
}

.dm-message-input-bar button {
    background: #1e5eff !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 18px !important;
    padding: 0 14px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    height: 34px !important;
    min-height: 34px !important;
    width: auto !important;
    cursor: pointer !important;
}

.dm-empty-state {
    padding: 20px 14px !important;
    text-align: center !important;
    font-size: 12.5px !important;
    color: var(--text-muted) !important;
}

.action-icon {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    margin-right: 4px;
    object-fit: contain;
}

.staff-badge-img {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin-left: 4px;
    object-fit: contain;
}

/* Custom Font for Timeline Heading */
.timeline-heading {
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: var(--primary-color);
    margin: 0 0 6px 0;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}