:root {
    /* Default Blue Theme */
    --theme-primary: #0088cc;
    --theme-primary-dark: #006699;
    --theme-primary-light: #e3f2fd;
    --theme-secondary: #f0f2f5;
    --theme-text: #111b21;
    --theme-text-secondary: #667781;
    --theme-border: #d1d7db;
    --theme-hover: #f5f6f6;
    --theme-outgoing-background: #e3f2fd;
    --theme-incoming-background: #ffffff;
}

/* Green Theme */
[data-theme="green"] {
    --theme-primary: #00a884;
    --theme-primary-dark: #008f72;
    --theme-primary-light: #e7f8f5;
    --theme-secondary: #f0f2f5;
    --theme-text: #111b21;
    --theme-text-secondary: #667781;
    --theme-border: #d1d7db;
    --theme-hover: #f5f6f6;
    --theme-outgoing-background: #d9fdd3;
    --theme-incoming-background: #ffffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    height: 100vh;
    margin: 0;
    background-color: #f0f2f5;
    overflow: hidden;
}

.container-fluid {
    height: 100vh;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.row {
    height: 100%;
    margin: 0;
    flex: 1;
}

.chat-container {
    display: flex;
    height: 100vh;
    background-color: #f0f2f5;
}

.chat-list-container {
    background-color: white;
    border-right: 1px solid #d1d7db;
    padding: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.chat-list-header {
    padding: 10px 16px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #f8f9fa;
    height: 60px;
}

.chat-list-header .header-content {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 100%;
    width: 100%;
}

.chat-list-header .left-section {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: max-content;
}

.chat-list-header h5 {
    margin: 0;
    font-size: 16px;
    line-height: 36px;
    color: #111b21;
    height: 36px;
    display: flex;
    align-items: center;
}

.chat-item-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.contact-name {
    font-weight: 500;
    color: #111b21;
    margin-bottom: 2px;
}

.contact-number {
    font-size: 13px;
    color: #667781;
    font-weight: normal;
}

.chat-time {
    font-size: 12px;
    color: #667781;
    min-width: 55px;
    text-align: right;
}

.chat-list-header h2 {
    margin: 0;
    font-size: 20px;
    color: #111b21;
}

.chat-list-header .btn-primary {
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
    padding: 8px 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-list-header .btn-primary svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.chat-list-header .btn-primary:hover {
    background-color: var(--theme-primary-dark);
    border-color: var(--theme-primary-dark);
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.chat-header {
    background-color: #f0f2f5;
    padding: 10px 16px;
    border-bottom: 1px solid #d1d7db;
    display: flex;
    align-items: center;
    height: 60px;
}

.chat-header .chat-avatar {
    min-width: 40px;
    height: 40px;
    font-size: 13px;
    border-radius: 20px;
    background-color: #667781;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 15px;
    padding: 0 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item {
    padding: 10px;
    border-bottom: 1px solid #e9edef;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.chat-item:hover {
    background-color: #f5f5f5;
}

.chat-avatar {
    min-width: 36px;
    height: 36px;
    background-color: #00a884;
    border-radius: 18px;
    margin-right: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
    font-weight: 500;
    padding: 0 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-info {
    flex-grow: 1;
    min-width: 0;
}

.chat-name {
    font-size: 16px;
    color: #111b21;
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-number {
    font-size: 13px;
    color: #667781;
    margin-bottom: 2px;
}

.chat-last-message {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #667781;
    font-size: 14px;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.message-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: #e5ddd5;
}

.message {
    display: flex;
    margin: 8px 0;
    padding: 6px 12px;
    max-width: 70%;
    position: relative;
}

.incoming-message {
    align-self: flex-start;
    background-color: #f0f2f5;
    border-radius: 0 8px 8px 8px;
    margin-left: 8px;
}

.outgoing-message {
    align-self: flex-end;
    background-color: #d9fdd3;
    border-radius: 8px 0 8px 8px;
    margin-right: 8px;
}

.message-content {
    flex-grow: 1;
    min-width: 0;
    position: relative;
}

.message-text {
    word-wrap: break-word;
    white-space: pre-wrap;
    color: #111b21;
    font-size: 14px;
    line-height: 1.4;
}

.message-time-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: 4px;
    font-size: 11px;
    color: #667781;
}

.message-time {
    margin-right: 4px;
}

.message-status {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
    color: #667781;
}

.message-status.delivered {
    color: #667781;
}

.message-status.read {
    color: #53bdeb;
}

.message-status svg {
    width: 16px;
    height: 11px;
}

.message-image {
    max-width: 300px;
    max-height: 200px;
    border-radius: 8px;
    object-fit: contain;
    margin-bottom: 5px;
}

.pdf-message {
    max-width: 300px;
    background: white;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.message.sent .pdf-message {
    background: #dcf8c6;
}

.media-preview {
    max-width: 300px;
    max-height: 200px;
    border-radius: 8px;
    margin-bottom: 15px;
    object-fit: contain;
}

.upload-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.message-time {
    font-size: 11px;
    color: #667781;
    margin-top: 4px;
    text-align: right;
}

.pdf-preview {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin: 5px 0;
    width: 250px;
}

.pdf-icon {
    font-size: 32px;
    color: #dc3545;
    margin-bottom: 8px;
}

.pdf-name {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    word-break: break-word;
}

.pdf-download {
    display: inline-block;
    background-color: #00a884;
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    text-decoration: none;
    font-size: 13px;
    margin-top: 5px;
}

.pdf-download:hover {
    background-color: #008069;
}

.caption {
    font-size: 13px;
    color: #667781;
    margin-top: 5px;
}

.input-container {
    padding: 10px;
    background-color: #f0f2f5;
    display: flex;
    align-items: center;
    gap: 10px;
}

.message-input-container {
    background-color: #f0f2f5;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid #d1d7db;
}

.message-input {
    flex-grow: 1;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    outline: none;
    font-size: 15px;
}

.message-input-container .btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0;
    position: relative;
}

.message-input-container .btn-primary .send-icon,
.message-input-container .btn-primary .loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.message-input-container .btn-primary .loading-spinner {
    display: none;
}

.message-input-container .btn-primary.loading .send-icon {
    display: none;
}

.message-input-container .btn-primary.loading .loading-spinner {
    display: block;
}

.message-input-container .btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.message-input-container .btn-primary svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.send-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #008069;
}

.media-upload {
    display: none;
}

.upload-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: #008069;
}

.header {
    background-color: #f0f2f5;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #e9edef;
}

.search-container {
    position: relative;
    flex: 1;
    height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#chatSearch {
    border-radius: 8px;
    height: 36px;
    padding: 0 12px;
    background-color: #f0f2f5;
    border: none;
    font-size: 14px;
    min-width: 200px;
    width: 100%;
    max-width: 100%;
}

#chatSearch:focus {
    outline: none;
    background-color: #fff;
    border: 1px solid #00a884;
}

.chat-item.active {
    background-color: #f0f2f5;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #00a884;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.sidebar {
    width: 30%;
    background-color: white;
    border-right: 1px solid #e9edef;
    display: flex;
    flex-direction: column;
}

.chat-container {
    width: 70%;
    background-color: #e5ddd5;
    display: flex;
    flex-direction: column;
}

.new-chat-button {
    background-color: var(--theme-primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin: 10px;
}

.new-chat-button:hover {
    background-color: var(--theme-primary-dark);
}

.video-message {
    max-width: 300px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 5px;
}

.video-message video {
    width: 100%;
    max-height: 300px;
    border-radius: 8px;
    background-color: #000;
}

.video-preview {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.video-preview video {
    width: 100%;
    max-height: 300px;
    background-color: #000;
}

.message-status {
    display: inline-flex;
    align-items: center;
    margin-left: 4px;
}

.message.sent .message-status {
    color: #667781;
}

.message.sent .message-status.delivered {
    color: #53bdeb;
}

.message.sent .message-status.read {
    color: #53bdeb;
}

.message-time-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
    font-size: 11px;
    color: #667781;
}

.media-preview-modal .modal-content {
    background-color: #f8f9fa;
    border-radius: 12px;
}

.media-preview-modal .modal-header {
    border-bottom: 1px solid #dee2e6;
    padding: 15px 20px;
}

.media-preview-modal .modal-body {
    padding: 20px;
}

.btn-group {
    display: flex;
    gap: 8px;
}

/* Chat window styles */
.chat-window {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
    background-color: #efeae2;
}

/* Chat contact styles */
.chat-contact {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Media message styles */
.message-media {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    object-fit: contain;
}

.media-container {
    margin: 8px 0;
    position: relative;
}

.message-caption {
    margin-top: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-size: 0.9em;
}

.document-container {
    max-width: 300px;
    margin: 5px 0;
}

.document-preview {
    background: #f0f2f5;
    border-radius: 8px;
    padding: 12px;
    transition: background-color 0.2s;
}

.document-preview:hover {
    background: #e4e6e9;
}

.document-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
}

.document-icon {
    font-size: 24px;
    margin-right: 12px;
    color: #54656f;
}

.document-info {
    display: flex;
    flex-direction: column;
}

.document-name {
    font-weight: 500;
    color: #111b21;
    margin-bottom: 2px;
}

.document-type {
    font-size: 0.85em;
    color: #667781;
}

/* Adjust for dark mode */
.dark-mode .document-preview {
    background: #2a3942;
}

.dark-mode .document-preview:hover {
    background: #374045;
}

.dark-mode .document-name {
    color: #e9edef;
}

.dark-mode .document-type {
    color: #8696a0;
}

.message.outgoing-message .media-container {
    background: #dcf8c6;
    padding: 8px;
    border-radius: 8px;
}

.message.incoming-message .media-container {
    background: #fff;
    padding: 8px;
    border-radius: 8px;
}

.message.outgoing-message .document-preview {
    background: #dcf8c6;
}

.message.incoming-message .document-preview {
    background: #fff;
}

/* Remove background colors from incoming and outgoing message captions */
.incoming-message .message-caption {
    color: #333;
}

.outgoing-message .message-caption {
    color: #333;
}

/* Ensure media container has proper spacing */
.media-container {
    position: relative;
    margin-bottom: 8px;
}

/* Ensure media elements are properly aligned */
.message-media {
    max-width: 100%;
    border-radius: 8px;
}

/* Document preview styles */
.document-preview {
    padding: 12px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
}

.document-link {
    display: flex;
    align-items: center;
    color: #111b21;
    text-decoration: none;
}

.document-link i {
    margin-right: 8px;
    font-size: 20px;
    color: #25D366;
}

/* Message container styles */
#messageContainer {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    background-color: #e5ddd5;
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%239C92AC' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.document-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.document-buttons .btn {
    display: flex;
    align-items: center;
    gap: 4px;
}

.document-buttons .btn i {
    font-size: 0.9em;
}

/* Ensure document captions display on next line */
.document-preview + .message-caption {
    display: block;
    margin-top: 8px;
    padding: 4px 0;
    font-size: 0.9em;
    color: #333;
}

/* Ensure all captions are consistent */
.message-caption {
    display: block;
    margin-top: 8px;
    padding: 4px 0;
    font-size: 0.9em;
    color: #333;
    word-wrap: break-word;
}

/* Screen Blocker Loader */
.screen-blocker {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loader-content {
    text-align: center;
}

.loader-content .spinner-border {
    width: 4rem;
    height: 4rem;
}

.screen-blocker .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Disable interaction when loading */
.screen-blocker-active {
    pointer-events: none;
    user-select: none;
}

/* Ensure modal stays on top of screen blocker */
.modal {
    z-index: 1100 !important;
}

/* Media form should appear above screen blocker */
.media-form,
.modal-dialog {
    z-index: 1200;
    position: relative;
}

/* Keep modal backdrop below modal but above screen blocker */
.modal-backdrop {
    z-index: 1050 !important;
}

/* When screen blocker is active, don't hide modals */
.screen-blocker-active .modal.show {
    display: block !important;
}

/* Disable modal backdrop when screen blocker is active */
.screen-blocker-active .modal-backdrop {
    display: none !important;
}

.unread-badge {
    background-color: var(--theme-primary) !important;
    color: white;
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
    min-width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-item-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.last-message {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #667781;
    font-size: 14px;
}

/* Context Menu Styles */
.context-menu {
    position: fixed;
    background-color: white;
    border: 1px solid #d1d7db;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    padding: 4px 0;
    min-width: 150px;
    z-index: 1000;
    display: none;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #111b21;
}

.context-menu-item:hover {
    background-color: #f5f5f5;
}

.chat-item.highlighted {
    font-weight: bold;
    background-color: #f0f7ff;
    order: -1;
}

#chatList {
    display: flex;
    flex-direction: column;
}

#newChatButton {
    height: 34px;
    padding: 0 16px;
    font-size: 14px;
    display: flex;
    align-items: center;
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
    border-radius: 8px;
    white-space: nowrap;
    min-width: max-content;
}

#newChatButton:hover {
    background-color: var(--theme-primary-dark);
    border-color: var(--theme-primary-dark);
}

.gap-3 {
    gap: 1rem;
}

/* Update all color references to use CSS variables */
.chat-avatar {
    background-color: var(--theme-primary);
    color: white;
}

.chat-list-header .btn-primary {
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
}

.chat-list-header .btn-primary:hover {
    background-color: var(--theme-primary-dark);
    border-color: var(--theme-primary-dark);
}

.chat-item:hover {
    background-color: var(--theme-hover);
}

.chat-item.active {
    background-color: var(--theme-secondary);
}

.contact-name {
    color: var(--theme-text);
}

.contact-number {
    color: var(--theme-text-secondary);
}

.chat-time {
    color: var(--theme-text-secondary);
}

.last-message {
    color: var(--theme-text-secondary);
}

.incoming-message {
    background-color: var(--theme-incoming-background);
}

.outgoing-message {
    background-color: var(--theme-outgoing-background);
}

.unread-badge {
    background-color: var(--theme-primary);
    color: white;
}

#chatSearch:focus {
    border-color: var(--theme-primary);
}

/* Theme Switcher Button */
.theme-switcher {
    display: flex;
    position: static;
    padding: 8px;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    background-color: var(--theme-primary);
    color: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: transform 0.2s;
    margin-right: 8px;
}

.theme-switcher:hover {
    transform: scale(1.1);
    background-color: var(--theme-primary-dark);
}

/* Media Containers */
.media-container {
    margin-bottom: 8px;
}

.message-image {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.message-image:hover {
    transform: scale(1.02);
}

.message-video,
.message-audio {
    max-width: 300px;
    border-radius: 8px;
    margin-bottom: 4px;
}

.media-link,
.document-link {
    display: inline-flex;
    align-items: center;
    padding: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    text-decoration: none;
    color: #2196F3;
    margin-top: 4px;
}

.document-icon {
    font-size: 24px;
    margin-right: 8px;
}

.download-icon {
    margin-right: 8px;
}

.document-name {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Media Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
}

.modal-content {
    position: relative;
    margin: auto;
    padding: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.modal .close {
    position: absolute;
    right: 20px;
    top: 10px;
    color: #fff;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-media {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.download-button {
    margin-top: 10px;
    padding: 8px 16px;
    background-color: #4CAF50;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

.download-button:hover {
    background-color: #45a049;
}

/* Video Overlay Styles */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.play-icon {
    font-size: 48px;
    color: white;
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}

.message-video {
    width: 100%;
    max-width: 300px;
    position: relative;
    cursor: pointer;
}

/* Ensure media containers in messages have proper spacing */
.message .media-container {
    margin-bottom: 4px;
}

/* Adjust media container in different message directions */
.message.incoming .media-container,
.message.outgoing .media-container {
    max-width: 300px;
}

/* Make sure media fits in message bubbles */
.message.incoming .media-container img,
.message.incoming .media-container video,
.message.incoming .media-container audio,
.message.outgoing .media-container img,
.message.outgoing .media-container video,
.message.outgoing .media-container audio {
    border-radius: 8px;
    max-width: 100%;
}

/* Media Viewer Modal */
.media-viewer-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.media-viewer-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.media-viewer-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 5px 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
}

.close-button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Custom context menu for chat list */
.custom-context-menu {
    position: fixed;
    z-index: 99999;
    background: #fff;
    border: 1px solid #d1d1d1;
    border-radius: 6px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
    min-width: 160px;
    padding: 4px 0;
    font-size: 15px;
    color: #222;
    user-select: none;
}

.context-menu-item {
    padding: 10px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.context-menu-item:hover {
    background: #f0f0f0;
}

.custom-context-menu {
    animation: fadeInMenu 0.15s;
}

@keyframes fadeInMenu {
    from { opacity: 0; transform: scale(0.98);}
    to   { opacity: 1; transform: scale(1);}
}

/* Chat footer layout for reply and input */
.chat-footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding: 0;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    transition: min-height 0.2s;
}

.reply-bar {
    width: 100%;
    box-sizing: border-box;
    background: #f0f2f5;
    border-left: 4px solid #1a73e8;
    padding: 8px 12px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 6px 6px 0 0;
    min-height: 36px;
}

.reply-label {
    font-weight: bold;
    color: #1a73e8;
}
.reply-content {
    flex: 1;
    color: #333;
    font-style: italic;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.reply-cancel-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: #888;
    cursor: pointer;
    margin-left: 8px;
}
.reply-cancel-btn:hover {
    color: #e53935;
}

/* Make the message input full width */
#messageInput {
    width: 100%;
    box-sizing: border-box;
    min-height: 40px;
    padding: 10px 12px;
    border-radius: 0 0 6px 6px;
    border: 1px solid #e0e0e0;
    font-size: 16px;
    resize: none;
}

/* When reply bar is present, increase footer min-height */
.chat-footer.has-reply {
    min-height: 90px;
}

/* Account menu styles */
.account-menu {
    position: absolute;
    top: 10px;
    right: 24px;
    z-index: 100;
    display: flex;
    align-items: center;
}
.user-icon {
    font-size: 22px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 50%;
    background: #f0f2f5;
    transition: background 0.2s;
}
.user-icon:hover {
    background: #e0e0e0;
}
.account-dropdown {
    position: absolute;
    top: 36px;
    right: 0;
    background: #fff;
    border: 1px solid #d1d1d1;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
    min-width: 200px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 15px;
    color: #222;
}
.account-client-id {
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
    word-break: break-all;
}
.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    color: #e53935;
    border: 1px solid #e53935;
    border-radius: 4px;
    padding: 4px 14px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border 0.2s;
    box-shadow: none;
    outline: none;
    min-width: 0;
}
.logout-btn:hover {
    background: #e53935;
    color: #fff;
    border: 1px solid #e53935;
}
.logout-btn svg {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    fill: currentColor;
} 