/* css/feed_style.css - Full version */

/* --- Variables --- */
:root {
    --bg-deep-charcoal: #1e1e1e;
    --bg-dark-grey: #2a2a2a;
    --bg-mid-grey: #3c3c3c;
    --bg-mid-grey-hover: #4f4f4f;
    --border-light-grey: #4a4a4a;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --accent-color-deep-blue: #3C79C2;
    --accent-color-deep-blue-hover: #2e609a;
    --danger-color: #e57373;
    --font-family-main: 'Roboto', Arial, sans-serif;
}

html, body {
    font-family: var(--font-family-main);
    background-color: var(--bg-deep-charcoal) !important;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Auth Area Styling --- */
#auth-area-feed {
    background-color: var(--bg-dark-grey); color: var(--text-primary); padding: 30px; border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3); text-align: center; position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%); width: 90%; max-width: 350px; z-index: 1001;
}
#auth-area-feed h3 { color: var(--text-primary); }
#auth-area-feed input[type="text"], #auth-area-feed input[type="password"] {
    background-color: var(--bg-mid-grey); color: var(--text-primary); border: 1px solid var(--border-light-grey);
    width: calc(100% - 22px); padding: 10px; margin-bottom: 10px; border-radius: 4px;
    box-sizing: border-box; font-size: 1em;
}
#auth-area-feed button {
    background-color: var(--accent-color-deep-blue);
    color: white; width: 100%; padding: 10px 20px;
    border: none; border-radius: 4px; cursor: pointer; font-size: 1em;
}
#auth-area-feed button:hover {
    background-color: var(--accent-color-deep-blue-hover);
}
#auth-area-feed p { color: var(--text-secondary); margin-top: 15px; font-size: 0.9em; }
#auth-area-feed a { color: var(--accent-color-deep-blue); text-decoration: none; }
#auth-area-feed a:hover { text-decoration: underline; }

/* --- Feed Container --- */
#feed-container {
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}

/* --- Header --- */
#feed-header {
    background-color: var(--bg-dark-grey); padding: 15px 20px; border-bottom: 1px solid var(--border-light-grey);
    margin-bottom: 20px; position: sticky; top: 0; z-index: 900;
}

#feed-header .header-top-line { 
    display: flex;
    align-items: center; 
    width: 100%; 
    margin-bottom: 10px;
}

#welcome-user {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-right: auto; 
    flex-shrink: 0; 
    white-space: nowrap; 
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px; 
}

.header-center-icons {
    display: flex;
    align-items: center;
    gap: 15px; 
    margin-left: auto; 
    margin-right: auto;
    padding: 0 10px; 
}

#logout-btn-feed {
    background-color: var(--bg-mid-grey);
    color: var(--text-primary);
    border: 1px solid var(--border-light-grey);
    padding: 8px 15px; border-radius: 6px; cursor: pointer; font-weight: 500; white-space: nowrap;
    flex-shrink: 0; 
}
#logout-btn-feed:hover { background-color: var(--bg-mid-grey-hover); }

/* Styles for Header Icons (Info, Dice, Messages, Notifications) */
#info-panel-icon, 
#header-dice-roller-icon, 
#open-messages-modal-btn,
#notifications-icon { 
    background: none; border: none; color: var(--text-secondary); 
    font-size: 1.4em; cursor: pointer; padding: 5px; 
    outline: none; margin-left: 0; margin-right: 0;
}
#info-panel-icon:hover, #info-panel-icon:focus,
#header-dice-roller-icon:hover, #header-dice-roller-icon:focus,
#open-messages-modal-btn:hover, #open-messages-modal-btn:focus,
#notifications-icon:hover, #notifications-icon:focus {
    color: var(--text-primary);
}
#notifications-container { position: relative; display: flex; align-items: center; }


/* --- Search Area Styles --- */
#search-area { display: flex; gap: 8px; align-items: center; padding: 8px 0; margin-bottom:10px; }
#search-input { flex-grow: 1; padding: 9px 12px; border: 1px solid var(--border-light-grey); border-radius: 6px; background-color: var(--bg-deep-charcoal); color: var(--text-primary); font-size: 0.95em; }
#search-input::placeholder { color: var(--text-secondary); }
#search-area button { padding: 9px 15px; border: none; border-radius: 6px; color: white; cursor: pointer; font-weight: 500; font-size: 0.9em; transition: background-color 0.2s; white-space: nowrap; }
#search-button { background-color: var(--accent-color-deep-blue); }
#search-button:hover { background-color: var(--accent-color-deep-blue-hover); }
#clear-search-button { background-color: var(--bg-mid-grey); color: var(--text-primary); border: 1px solid var(--border-light-grey); display: none; }
#clear-search-button:hover { background-color: var(--bg-mid-grey-hover); }


/* --- Styles for Collapsible Header Sections (Announcement & Members) --- */
#announcement-toggle-section,
#member-list-section {
    padding: 10px;
    background-color: var(--bg-dark-grey); 
    border-radius: 6px; 
}
#announcement-toggle-section {
    border-bottom: 1px solid var(--border-light-grey); 
    margin-bottom: 0; 
}
.new-badge { 
    margin-left: 8px; background-color: var(--danger-color); color: white; 
    font-size: 0.7em; padding: 2px 5px; border-radius: 3px; font-weight: bold; 
}
#member-list-section {
    margin-top: 15px;
    margin-bottom: 15px;
    border-top: 1px solid var(--border-light-grey); 
    border-bottom: 1px solid var(--border-light-grey);
}
#member-list-toggle,
#announcement-list-toggle {
    color: var(--text-secondary); font-size: 1.1em; font-weight: 500;
    margin: 0 0 5px 0; user-select: none; display: flex;
    align-items: center; cursor: pointer; padding: 0; 
}
#member-list-toggle:hover,
#announcement-list-toggle:hover { color: var(--text-primary); }
#member-list-toggle .toggle-arrow,
#announcement-list-toggle .toggle-arrow {
    margin-right: 8px; font-size: 0.8em; display: inline-block;
    transition: transform 0.2s ease-in-out; line-height: 1; 
}
#announcement-display-area .post { 
    border: 2px solid var(--bg-deep-charcoal);
    background-color: var(--bg-mid-grey); 
}
#member-list-content { padding: 5px 0 5px 10px; color: var(--text-primary); }
#member-list-content p { margin: 0; }
.member-name-item { cursor: pointer; color: var(--accent-color-deep-blue); text-decoration: none; }
.member-name-item:hover { text-decoration: underline; color: var(--accent-color-deep-blue-hover); }
.member-name-item.current-user-in-list { font-weight: bold; }


/* --- Create Post Area --- */
#create-post-section { background-color: var(--bg-dark-grey); padding: 20px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.2); margin-bottom: 25px; }
#create-post-section h2 { margin-top: 0; margin-bottom: 15px; font-size: 1.2em; color: var(--text-secondary); font-weight: 500; }
#create-post-area textarea#post-content-input { width: 100%; box-sizing: border-box; padding: 10px; background-color: var(--bg-mid-grey); color: var(--text-primary); border: 1px solid var(--border-light-grey); border-radius: 6px; font-family: inherit; font-size: 1em; margin-bottom: 10px; resize: vertical; min-height: 70px; display: block; }
#create-post-area textarea#post-content-input::placeholder { color: #888; }
#create-post-area textarea#post-content-input:focus {
    outline: none; /* Remove default browser outline */
    border-color: var(--accent-color-deep-blue); /* Optional: change border color on focus */
    box-shadow: 0 0 0 2px rgba(60, 121, 194, 0.3); /* Optional: add a soft glow */
}
#create-post-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 15px; }
.file-upload-button { display: inline-block; padding: 8px 15px; background-color: var(--accent-color-deep-blue); color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; font-size: 0.9em; transition: background-color 0.2s; text-align: center; }
.file-upload-button:hover { background-color: var(--accent-color-deep-blue-hover); }
#file-name-display { font-size: 0.85em; color: var(--text-secondary); font-style: italic; display: block; min-height: 1.2em; margin-bottom: 10px; margin-left: 5px; }
#image-preview-area img { max-width: 100%; max-height: 200px; border-radius: 4px; border: 1px solid var(--border-light-grey); margin-top: 10px; object-fit: cover; }
.secondary-action-button { padding: 8px 15px; background-color: var(--bg-mid-grey); color: var(--text-primary); border: 1px solid var(--border-light-grey); border-radius: 6px; cursor: pointer; font-weight: 500; font-size: 0.9em; transition: background-color 0.2s; white-space: nowrap; }
.secondary-action-button:hover { background-color: var(--bg-mid-grey-hover); }
.visibility-controls { margin-bottom:15px;padding:10px 0;display:flex;align-items:center;flex-wrap:wrap;gap:10px; }
.visibility-controls label { margin-right:5px;font-weight:500;font-size:.9em;color:var(--text-secondary);flex-shrink:0; }
.visibility-controls select { padding:6px 10px;border-radius:4px;background-color:var(--bg-deep-charcoal);color:var(--text-primary);border:1px solid var(--border-light-grey);font-size:.9em; }
.visibility-controls button#select-users-btn { padding:6px 12px;font-size:.9em;background-color:#4a4a4a;color:var(--text-primary);border:1px solid #5c5c5c;border-radius:4px;cursor:pointer;margin-left:0; }
.visibility-controls button#select-users-btn:hover { background-color:#555; }
#selected-users-display { font-size:.85em;color:var(--text-secondary);margin-top:0;flex-grow:1;text-align:right; }
#create-post-area button#submit-post-btn { background-color: var(--accent-color-deep-blue); color: white; border: none; padding: 10px 20px; border-radius: 6px; cursor: pointer; font-weight: bold; font-size: 1em; width: 100%; box-sizing: border-box; transition: background-color 0.2s; margin-top: 10px; display: block; }
#create-post-area button#submit-post-btn:hover { background-color: var(--accent-color-deep-blue-hover); }
.error-message { color: var(--danger-color); font-size: 0.9em; margin-top: 8px; }

/* --- Modal Styles (General) --- */
.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.6); padding-top: 40px; box-sizing: border-box; }
.modal-content { background-color: var(--bg-dark-grey); color: var(--text-primary); margin: 2% auto; padding: 20px; border: 1px solid var(--border-light-grey); width: 90%; max-width: 500px; border-radius: 8px; position: relative; box-shadow: 0 5px 15px rgba(0,0,0,0.5); }
.modal-content h3 { margin-top: 0; color: var(--text-primary); font-weight: 500; font-size: 1.4em; margin-bottom: 15px;}
.close-modal-btn { color: #aaa; font-size: 28px; font-weight: bold; position: absolute; top: 8px; right: 15px; line-height: 1; z-index: 10; }
.close-modal-btn:hover, .close-modal-btn:focus { color: var(--text-primary); text-decoration: none; cursor: pointer; }
/* User Selection Modal Specifics */
#user-selection-modal .modal-content {} 
#user-selection-modal #user-search-input { width: calc(100% - 24px); padding: 10px; margin-bottom: 15px; border: 1px solid var(--border-light-grey); border-radius: 4px; box-sizing: border-box; background-color: var(--bg-mid-grey); color: var(--text-primary); }
#user-selection-modal #user-search-input::placeholder { color: #888; }
#user-selection-modal #user-list-container { max-height: 250px; overflow-y: auto; border: 1px solid var(--border-light-grey); padding: 10px; border-radius: 4px; background-color: var(--bg-mid-grey); }
#user-selection-modal #user-list-container .user-select-item { display: flex; align-items: center; padding: 8px 5px; border-bottom: 1px solid var(--border-light-grey); }
#user-selection-modal #user-list-container .user-select-item:last-child { border-bottom: none; }
#user-selection-modal #user-list-container .user-select-item input[type="checkbox"] { margin-right: 12px; cursor: pointer; }
#user-selection-modal #user-list-container .user-select-item label { cursor: pointer; flex-grow: 1; color: var(--text-primary); }
#user-selection-modal button#confirm-user-selection-btn { background-color: var(--accent-color-deep-blue); color: white; padding: 10px 15px; margin-top: 20px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; }
#user-selection-modal button#confirm-user-selection-btn:hover { background-color: var(--accent-color-deep-blue-hover); }
/* Likers Modal Specifics */
#likers-modal .modal-content {} 
#likers-modal .modal-content ul { list-style-type: none; padding-left: 0; margin-top:0; }
#likers-modal .modal-content li { padding: 5px 0; border-bottom: 1px solid var(--border-light-grey); }
#likers-modal .modal-content li:last-child { border-bottom: none; }
/* User Profile Popover Styles */
#user-profile-popover .user-profile-modal-content { max-width: 450px; }
#user-profile-popover-body h3 { margin-top: 0; margin-bottom: 15px; color: var(--text-primary); font-size: 1.5em; border-bottom: 1px solid var(--border-light-grey); padding-bottom: 10px; }
#user-profile-popover-body .profile-field { margin-bottom: 12px; }
#user-profile-popover-body .profile-field strong { display: block; color: var(--text-secondary); margin-bottom: 4px; font-size: 0.9em; }
#user-profile-popover-body .profile-field span, #user-profile-popover-body .profile-field p { color: var(--text-primary); line-height: 1.5; white-space: pre-wrap; word-break: break-word; margin: 0; }
#user-profile-popover-body .profile-field .notes-content { background-color: var(--bg-deep-charcoal); border: 1px solid var(--border-light-grey); padding: 8px; border-radius: 4px; max-height: 150px; overflow-y: auto; overflow-x: hidden; min-height: 60px; white-space: pre-wrap; word-break: break-word; }
#user-profile-popover-body .profile-field input[type="text"], #user-profile-popover-body .profile-field textarea, #user-profile-popover-body .profile-field select { padding: 8px 10px; border-radius: 4px; background-color: var(--bg-deep-charcoal); color: var(--text-primary); border: 1px solid var(--border-light-grey); font-size: 1em; width: calc(100% - 20px); box-sizing: border-box; }
#user-profile-popover-body .profile-field select { width: auto; min-width: 80px; } 
#user-profile-popover-body .profile-field textarea { resize: vertical; }
.profile-action-btn { font-size: 0.9em; padding: 6px 12px; background-color: var(--accent-color-deep-blue); color: white; border: none; border-radius: 4px; cursor: pointer; }
.profile-action-btn:hover { background-color: var(--accent-color-deep-blue-hover); }
.profile-action-btn#cancel-profile-edit-btn { background-color: var(--bg-mid-grey); } 
.profile-action-btn#cancel-profile-edit-btn:hover { background-color: var(--bg-mid-grey-hover); }

/* --- Dice Roller Modal Styles --- */
#dice-roller-modal .dice-roller-modal-content { max-width: 550px; }
#dice-roller-modal .modal-content h3 { display: inline-block; margin-bottom:10px; } 
#dice-roller-modal #clear-dice-log-btn { margin-bottom:10px; } 
.modal-chat-area { height: 200px; overflow-y: auto; border: 1px solid var(--border-light-grey); padding: 10px; margin-bottom: 15px; background-color: var(--bg-deep-charcoal); border-radius: 4px; font-family: 'Courier New', Courier, monospace; font-size: 0.9em; line-height: 1.5; color: var(--text-primary); white-space: pre-wrap; word-break: break-word; }
.modal-chat-area p, .modal-chat-area div { margin-bottom: 5px; }
.modal-chat-area .dice-roll-own-message strong { color: var(--accent-color-deep-blue); }
.modal-chat-area .dice-roll-system-message { color: var(--text-secondary); font-style: italic; }
#dice-menu-options-container.modal-chat-area { height: 150px; font-family: var(--font-family-main); font-size: 0.9em; }
#dice-roller-body .dice-roll-input-sections { margin-top:15px; }
#dice-roller-body .dice-roll-option { margin-bottom: 15px; padding-bottom: 15px; }
#dice-roller-body .dice-roll-option:last-of-type { margin-bottom: 0; padding-bottom: 0; }
#dice-roller-body h4 { margin-top: 0; margin-bottom: 10px; color: var(--text-secondary); font-size: 1.1em; font-weight: 500; }
#dice-roller-body input[type="text"] { width: calc(100% - 22px); box-sizing: border-box; padding: 8px 10px; margin-bottom: 10px; border: 1px solid var(--border-light-grey); background-color: var(--bg-deep-charcoal); color: var(--text-primary); border-radius: 4px; font-size: 0.95em; }
#dice-roller-body input[type="text"]:focus,
.comment-input-area textarea:focus { /* Remove focus outline from dice and comment inputs */
    outline: none;
    border-color: var(--accent-color-deep-blue);
    box-shadow: 0 0 0 2px rgba(60, 121, 194, 0.3);
}


/* --- Notification System Styles --- */
.notifications-badge { position: absolute; top: 0px; right: 0px; background-color: var(--danger-color); color: white; border-radius: 50%; padding: 2px 5px; font-size: 0.65em; font-weight: bold; min-width: 10px; height: 10px; line-height: 10px; text-align: center; display: flex; align-items: center; justify-content: center; box-sizing: content-box;}
#notifications-dropdown { position: absolute; top: 100%; right: 0; background-color: var(--bg-dark-grey); border: 1px solid var(--border-light-grey); border-radius: 6px; box-shadow: 0 3px 10px rgba(0,0,0,0.3); width: 320px; max-height: 400px; overflow-y: auto; z-index: 1100; color: var(--text-primary); }
#notifications-dropdown::-webkit-scrollbar { width: 6px; }
#notifications-dropdown::-webkit-scrollbar-thumb { background: var(--bg-mid-grey); border-radius: 3px;}
#notifications-dropdown::-webkit-scrollbar-track { background: var(--bg-deep-charcoal); }
.notifications-header { padding: 10px 12px; border-bottom: 1px solid var(--border-light-grey); display: flex; justify-content: space-between; align-items: center; font-weight: 500; }
.notifications-header span { font-size: 1.05em; }
#notifications-mark-all-read { background: none; border: none; color: var(--accent-color-deep-blue); font-size: 0.85em; cursor: pointer; padding: 3px 6px; }
#notifications-mark-all-read:hover { text-decoration: underline; }
#notifications-list { padding: 0; }
#notifications-list .no-notifications, #notifications-list .notifications-loading { padding: 15px; text-align: center; color: var(--text-secondary); font-style: italic; }
.notification-item { display: flex; align-items: flex-start; padding: 10px 12px; border-bottom: 1px solid var(--border-light-grey); cursor: pointer; transition: background-color 0.2s; }
.notification-item:last-child { border-bottom: none; }
.notification-item:hover { background-color: var(--bg-mid-grey); }
.notification-item.unread { background-color: var(--bg-mid-grey-hover); }
.notification-item-icon { margin-right: 12px; font-size: 1.1em; color: var(--text-secondary); padding-top: 2px; width: 20px; text-align: center; }
.notification-item.unread .notification-item-icon { color: var(--accent-color-deep-blue); }
.notification-item-content { flex-grow: 1; }
.notification-item-content .notification-text { margin: 0 0 4px 0; font-size: 0.9em; line-height: 1.4; color: var(--text-primary); word-break: break-word; }
.notification-item-content .notification-text strong { font-weight: 500; color: var(--text-primary); }
.notification-item-content .notification-time { font-size: 0.75em; color: var(--text-secondary); }
#notifications-load-more { display: block; width: calc(100% - 20px); margin: 10px; padding: 8px; background-color: var(--bg-mid-grey); color: var(--text-primary); border: 1px solid var(--border-light-grey); border-radius: 4px; cursor: pointer; text-align: center; font-size: 0.9em; }
#notifications-load-more:hover { background-color: var(--bg-mid-grey-hover); }
.highlighted-for-notification { transition: background-color 0.5s ease-out; background-color: var(--accent-color-deep-blue-hover) !important; animation: fadeHighlight 3s forwards; }
@keyframes fadeHighlight { 0% { background-color: var(--accent-color-deep-blue-hover) !important; } 70% { background-color: var(--accent-color-deep-blue-hover) !important; } 100% { background-color: transparent !important; } }

/* --- Info Panel Styles --- */
#info-panel-modal .info-panel-modal-content { max-width: 700px; }
#info-panel-body { max-height: 60vh; overflow-y: auto; padding-right: 10px; }
#info-panel-body::-webkit-scrollbar { width: 6px; }
#info-panel-body::-webkit-scrollbar-thumb { background: var(--bg-mid-grey); border-radius: 3px;}
#info-panel-body::-webkit-scrollbar-track { background: var(--bg-deep-charcoal); }
.info-panel-section { margin-bottom: 20px; }
.info-panel-section h4 { color: var(--text-primary); border-bottom: 1px solid var(--border-light-grey); padding-bottom: 8px; margin-top: 0; margin-bottom: 10px; font-size: 1.2em; font-weight: 500; }
.info-panel-content { color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; font-size: 0.95em; }
.info-panel-section-edit { margin-bottom: 25px; }
.info-panel-section-edit label { display: block; margin-bottom: 5px; font-weight: 500; color: var(--text-secondary); font-size: 0.9em; }
.info-panel-title-input { width: calc(100% - 22px); padding: 10px; margin-bottom: 15px; border: 1px solid var(--border-light-grey); background-color: var(--bg-deep-charcoal); color: var(--text-primary); border-radius: 4px; font-family: inherit; font-size: 1em; }
.info-panel-content-textarea { width: calc(100% - 22px); padding: 10px; margin-bottom: 10px; border: 1px solid var(--border-light-grey); background-color: var(--bg-deep-charcoal); color: var(--text-primary); border-radius: 4px; font-family: inherit; font-size: 1em; resize: vertical; min-height: 100px; }
#info-panel-admin-actions button#cancel-info-edit-btn { margin-left: 10px; background-color: var(--bg-mid-grey); }
#info-panel-admin-actions button#cancel-info-edit-btn:hover { background-color: var(--bg-mid-grey-hover); }

/* --- Private Messaging Modal Styles --- */
#private-messages-modal .private-messages-modal-content { max-width: 800px; min-height: 70vh; max-height: 85vh; display: flex; flex-direction: column; padding-top:15px; overflow: hidden; }
#active-chat-pane-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--border-light-grey); margin-bottom: 10px; padding-right: 40px; position:relative; flex-shrink: 0; }
#active-chat-pane-header h3 { margin: 0; font-size: 1.3em; }
#active-chat-pane-header #active-chat-mute-btn { font-size: 0.8em; padding: 5px 10px; }
.pm-layout-container { display: flex; flex-grow: 1; overflow: hidden; gap: 15px; min-height: 0; }
#conversations-list-pane { width: 250px; flex-shrink: 0; border-right: 1px solid var(--border-light-grey); padding-right: 10px; overflow-y: auto; display: flex; flex-direction: column; }
#conversations-list-pane::-webkit-scrollbar { width: 5px; }
#conversations-list-pane::-webkit-scrollbar-thumb { background: var(--bg-mid-grey); }
#conversations-list-pane .info-message, #conversations-list-pane .loading-message { margin: auto; }
#active-chat-pane { flex-grow: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#chat-messages-area.pm-chat-area { flex-grow: 1; overflow-y: auto; height: auto; min-height: 100px; margin-bottom: 10px; font-family: var(--font-family-main); padding: 10px 5px; }
#chat-messages-area.pm-chat-area::-webkit-scrollbar { width: 6px; }
#chat-messages-area.pm-chat-area::-webkit-scrollbar-thumb { background: var(--bg-mid-grey); border-radius: 3px;}
#chat-messages-area.pm-chat-area::-webkit-scrollbar-track { background: var(--bg-deep-charcoal); }
#chat-input-form { display: flex; padding: 10px 0px; border-top: 1px solid var(--border-light-grey); gap: 8px; flex-shrink: 0; align-items: flex-end; background-color: var(--bg-dark-grey); }
#private-message-input { flex-grow: 1; resize: none; padding: 10px 15px; background-color: var(--bg-deep-charcoal); color: var(--text-primary); border: 1px solid var(--border-light-grey); border-radius: 20px; font-family: inherit; font-size: 0.95em; line-height: 1.4; max-height: 100px; overflow-y: auto; }
#private-message-input:focus { /* Remove focus outline from PM input */
    outline: none;
    border-color: var(--accent-color-deep-blue); /* Optional: change border color on focus */
    box-shadow: 0 0 0 2px rgba(60, 121, 194, 0.3); /* Optional: add a soft glow */
}
#send-private-message-btn { padding: 10px 18px !important; align-self: center; height: 40px; box-sizing: border-box; }
.conversation-list-item { padding: 10px 8px; cursor: pointer; border-bottom: 1px solid var(--border-light-grey); margin-bottom: 2px; transition: background-color 0.15s ease-in-out; display: flex; flex-direction: column; }
.conversation-list-item:last-child { border-bottom: none; }
.conversation-list-item:hover { background-color: var(--bg-mid-grey-hover); }
.conversation-list-item.active { background-color: var(--accent-color-deep-blue); color: white; }
.conversation-list-item.active .conversation-item-snippet, .conversation-list-item.active .conversation-item-time, .conversation-list-item.active .muted-icon { color: #e0e0e0; }
.conversation-list-item.unread .conversation-item-title-text { font-weight: bold; }
.conversation-item-main-line { display: flex; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 2px; }
.conversation-item-title { font-size: 0.95em; display: flex; align-items: center; flex-grow: 1; overflow: hidden; }
.conversation-item-title-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-item-time { font-size: 0.7em; color: var(--text-secondary); flex-shrink: 0; margin-left: 5px; }
.conversation-item-snippet { font-size: 0.8em; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.muted-icon { margin-right: 5px; color: var(--text-secondary); font-size: 0.9em; }
.unread-dot { color: var(--accent-color-deep-blue); font-size: 1.5em; margin-left: auto; padding-left: 5px; line-height: 0.5; vertical-align: middle;}
.conversation-list-item.active .unread-dot { color: white; }
.chat-message-item { margin-bottom: 8px; display: flex; flex-direction: column; }
.chat-message-item.sent { align-items: flex-end; }
.chat-message-item.received { align-items: flex-start; }
.message-bubble { max-width: 75%; padding: 8px 14px; border-radius: 18px; word-wrap: break-word; display: flex; flex-direction: column; }
.chat-message-item.sent .message-bubble { background-color: var(--accent-color-deep-blue); color: white; border-bottom-right-radius: 4px; }
.chat-message-item.received .message-bubble { background-color: var(--bg-mid-grey); color: var(--text-primary); border-bottom-left-radius: 4px; }
.message-sender { font-size: 0.8em; font-weight: 500; margin-bottom: 3px; color: var(--text-secondary); line-height: 1; }
.chat-message-item.sent .message-sender { text-align: right; color: rgba(255,255,255,0.7); }
.message-text { margin: 0; padding: 0; font-size: 0.95em; line-height: 1.45; white-space: pre-wrap; }
.message-text .edited-marker { font-size: 0.8em; opacity: 0.7; margin-left: 5px;}
.message-time { font-size: 0.7em; margin-top: 4px; align-self: flex-end; line-height: 1; } 
.chat-message-item.sent .message-time { color: rgba(255,255,255,0.6); }
.chat-message-item.received .message-time { color: var(--text-secondary); }
.info-message, .loading-message { text-align: center; color: var(--text-secondary); font-style: italic; padding: 20px; }

/* Add to feed_style.css */

/* Styles for inline PM editing */
.message-header { /* New wrapper for sender and edit button */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.edit-pm-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8em;
    padding: 2px 4px;
    opacity: 0.7;
}
.edit-pm-btn:hover {
    opacity: 1;
    color: var(--text-primary);
}
.chat-message-item.sent .edit-pm-btn { /* Edit button more visible on sent messages */
    color: rgba(255,255,255,0.6);
}
.chat-message-item.sent .edit-pm-btn:hover {
    color: white;
}


.pm-edit-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px;
    border: 1px solid var(--border-light-grey);
    background-color: var(--bg-deep-charcoal);
    color: var(--text-primary);
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    font-size: 0.9em; /* Match message text */
    margin-bottom: 5px;
    min-height: 50px;
}
.pm-edit-textarea:focus {
    outline: none;
    border-color: var(--accent-color-deep-blue);
    box-shadow: 0 0 0 2px rgba(60, 121, 194, 0.3);
}

.pm-edit-actions {
    text-align: right;
    margin-top: 5px;
}
.pm-edit-actions .profile-action-btn, /* Save */
.pm-edit-actions .secondary-action-button { /* Cancel */
    font-size: 0.85em;
    padding: 4px 8px;
    margin-left: 5px;
}
.pm-edit-error {
    font-size: 0.8em;
    text-align: left;
    margin-top: 5px;
}

/* --- Posts Feed & Individual Post/Comment Styles --- */
#feed-status-message { padding: 10px; font-style: italic; color: var(--text-secondary); background-color: var(--bg-dark-grey); border-radius: 6px; margin-bottom: 15px; border: 1px solid var(--border-light-grey); }
.post { background-color: var(--bg-dark-grey); border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.2); margin-bottom: 25px; padding: 20px; }
.post-header { display: flex; align-items: center; margin-bottom: 12px; gap: 10px; }
.post-username { font-weight: bold; color: var(--text-primary); font-size: 1.05em; }
.visibility-icon { font-size: 0.9em; color: var(--text-secondary); cursor: default; line-height: 1; }
.post-timestamp { font-size: 0.8em; color: var(--text-secondary); margin-left: auto; } 
.edited-marker { font-style: italic; color: var(--text-secondary); font-size: 0.9em; }
.post-content { margin-bottom: 15px; line-height: 1.6; white-space: pre-wrap; color: var(--text-primary); }
.post-content p { margin: 0 0 10px 0; } 
.post-image { display: block; max-width: 100%; height: auto; max-height: 500px; object-fit: contain; border-radius: 6px; margin: 10px auto; border: 1px solid var(--border-light-grey); }
.post-footer { display: flex; justify-content: space-around; flex-wrap: wrap; border-top: 1px solid var(--border-light-grey); padding-top: 12px; gap: 5px; }
.post-footer button, .post-action-btn { background: none; border: none; color: var(--text-secondary); font-weight: 500; cursor: pointer; padding: 8px 10px; border-radius: 4px; font-size: 0.9em; transition: background-color 0.2s, color 0.2s; flex-basis: auto; flex-grow: 0; }
.post-footer button:hover, .post-action-btn:hover { background-color: var(--bg-mid-grey); color: var(--text-primary); }
.post-footer button.liked { color: var(--accent-color-deep-blue); font-weight: bold; }
.post-action-btn { background-color: var(--bg-mid-grey); } 
.post-action-btn:hover { background-color: var(--bg-mid-grey-hover); }
.edit-post-textarea { width:100%; box-sizing:border-box; margin-bottom:10px; padding: 8px; border: 1px solid var(--border-light-grey); background-color: var(--bg-deep-charcoal); color: var(--text-primary); border-radius: 4px; resize: vertical; font-family: inherit; }
.edit-post-actions { text-align:right; }
.edit-post-actions .cancel-post-edit-btn { margin-left:5px; background-color:var(--bg-mid-grey); }
.edit-post-actions .cancel-post-edit-btn:hover { background-color:var(--bg-mid-grey-hover); }
.comments-section { border-top: 1px solid var(--border-light-grey); margin-top: 15px; padding-top: 15px; }
.comment { background-color: var(--bg-mid-grey); padding: 10px 15px; border-radius: 18px; margin-bottom: 10px; font-size: 0.9em; }
.comment-header { display: flex; align-items: center; margin-bottom: 4px; gap: 8px; }
.comment-username { font-weight: bold; color: var(--text-primary); }
.comment-timestamp { font-size: 0.75em; color: var(--text-secondary); }
.comment-content { line-height: 1.5; padding-left: 5px; color: var(--text-primary); }
.comment-footer { margin-top: 8px; text-align: right; padding-right: 5px; }
.comment-footer .like-comment-btn, .comment-footer .delete-comment-btn { font-size: 0.8em; background: none; border: none; color: var(--text-secondary); cursor: pointer; margin-left: 12px; padding: 4px 8px; transition: color 0.2s; }
.comment-footer .like-comment-btn:hover, .comment-footer .delete-comment-btn:hover { color: var(--text-primary); }
.comment-footer .like-comment-btn.liked { color: var(--accent-color-deep-blue); font-weight: bold; }
.comment-footer .delete-comment-btn:hover { color: var(--danger-color); }
.comment-input-area { display: flex; margin-top: 10px; margin-bottom: 15px; gap: 8px; }
.comment-input-area textarea { flex-grow: 1; padding: 8px 12px; background-color: var(--bg-deep-charcoal); color: var(--text-primary); border: 1px solid var(--border-light-grey); border-radius: 18px; font-family: inherit; font-size: 0.9em; resize: none; min-height: 20px; line-height: 1.4; }
.comment-input-area textarea::placeholder { color: #777; }
.comment-input-area button { background-color: var(--accent-color-deep-blue); color: white; border: none; padding: 8px 15px; border-radius: 18px; cursor: pointer; font-weight: bold; font-size: 0.9em; white-space: nowrap; }
.comment-input-area button:hover { background-color: var(--accent-color-deep-blue-hover); }
#load-more-posts-btn { display: block; width: 100%; padding: 12px; background-color: var(--bg-mid-grey); color: var(--text-primary); border: 1px solid var(--border-light-grey); border-radius: 6px; cursor: pointer; font-weight: 500; margin-top: 25px; margin-bottom: 30px; transition: background-color 0.2s; }
#load-more-posts-btn:hover { background-color: var(--bg-mid-grey-hover); }
.mention-in-post, .mention-in-comment { font-weight: 500; color: var(--accent-color-deep-blue); }


/* Responsive adjustments */
@media (max-width: 600px) {
    .modal-content { width: 95%; padding: 15px; margin-top: 20px; }
    #feed-container { padding: 0 5px; }
    #feed-header { padding: 10px; }
    #feed-header .header-top-line { flex-direction: row; flex-wrap: nowrap; justify-content: space-between; }
    #welcome-user { min-width: 50px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 5px;}
    .header-center-icons { margin-left: 5px; margin-right: 5px; gap: 5px; }
    #logout-btn-feed { padding: 6px 10px; font-size: 0.85em; margin-left: 5px;}
    #search-area { flex-direction: column; padding: 10px 0; }
    #search-input { width: 100%; box-sizing: border-box; }
    #search-area button { width: 100%; box-sizing: border-box; margin-top: 5px; }
    #feed-status-message { font-size: 0.9em;}
    #announcement-toggle-section, #member-list-section { margin-left: 0; margin-right: 0; border-radius: 0; padding:10px 5px; }
    #create-post-toolbar { flex-direction: column; align-items: stretch; }
    #create-post-toolbar .file-input-container { width: 100%; margin-bottom: 10px; }
    .file-upload-button { display: block; text-align: center; }
    .visibility-controls { padding: 10px; flex-direction: column; align-items: stretch; }
    .visibility-controls > * { margin-bottom: 8px; }
    .visibility-controls label { margin-bottom: 5px; text-align: left; margin-right:0;}
    .visibility-controls select, .visibility-controls button#select-users-btn { width: 100%; margin-left:0; }
    #selected-users-display { text-align: left; width: 100%; }
    #create-post-area textarea#post-content-input { font-size: 1em; }
    #create-post-area button#submit-post-btn { padding: 12px; font-size: 1em; }
    .post-footer { justify-content: space-between; }
    .post-footer button, .post-action-btn { padding: 6px 8px; font-size:0.85em; }
    .comment-input-area textarea { font-size: 0.95em; }
    .comment-input-area button { font-size: 0.9em; padding: 8px 12px; }
    #dice-roller-modal .modal-content { max-width: 95%; }
    #dice-modal-input-area { flex-direction: column; }
    #dice-modal-input-area input[type="text"] { width: 100%; box-sizing: border-box; } 
    #dice-modal-input-area button { width: 100%; margin-top: 5px; box-sizing: border-box; }
    #notifications-dropdown { width: calc(100vw - 20px); left: 10px; right: 10px; transform: translateX(0); } 
    #info-panel-modal .info-panel-modal-content { max-width: 95%;} 
    #private-messages-modal .private-messages-modal-content { max-width: 95%; min-height: 80vh; }
    .pm-layout-container { flex-direction: column; }
    #conversations-list-pane { width: 100%; max-height: 180px; border-right: none; border-bottom: 1px solid var(--border-light-grey); padding-right: 0; margin-bottom:10px; }
    #active-chat-pane-header h3 { font-size: 1.2em; }
    #active-chat-pane-header #active-chat-mute-btn { font-size: 0.75em; padding: 4px 8px;}
}

/* --- Styles for Comment Editing (NEW) --- */
.comment-content {
    white-space: pre-wrap;
    word-break: break-word;
}
.edit-comment-textarea {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
    padding: 8px;
    border: 1px solid var(--border-light-grey);
    background-color: var(--bg-deep-charcoal);
    color: var(--text-primary);
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    font-size: 1em;
    min-height: 40px;
}
.edit-comment-actions {
    text-align: right;
    margin-bottom: 5px;
}
.edit-comment-actions .post-action-btn { /* Re-use post action button style */
    font-size: 0.8em;
    padding: 4px 8px;
    margin-left: 5px;
}
.comment-footer .edit-comment-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8em;
    padding: 4px 8px;
    margin-left: 10px;
}
.comment-footer .edit-comment-btn:hover {
    color: var(--text-primary);
}
.comment-timestamp .edited-marker {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.8em;
    margin-left: 4px;
}