/* UNIQUE_LOG: messaging.css LOADED - MESSAGING_CSS_007 */
/* ===========================
   WHATSAPP WEB MESSAGING
   =========================== */

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 8%;
    background: #efeae2;
    overflow-y: auto;
    height: 500px;
    font-family: "Segoe UI", Helvetica, Arial, sans-serif;
}

body.dark-theme .chat-messages {
    background: #0b141a;
}

.chat-messages li.chat-message {
    padding: 6px 7px 8px 9px;
    margin-bottom: 2px;
    background: #ffffff;
    border-radius: 7.5px;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
    font-size: 14px;
    line-height: 19px;
    word-wrap: break-word;
    max-width: 75%;
    animation: messageSlideIn 0.15s ease;
    position: relative;
    list-style: none;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Your messages - RIGHT SIDE */
.chat-messages li.my-message {
    background: #d9fdd3;
    align-self: flex-end;
    margin-left: auto;
    margin-right: 0;
    color: #111b21;
    border-radius: 7.5px;
}

body.dark-theme .chat-messages li.my-message {
    background: #005c4b;
    color: #e9edef;
}

/* Your name in your messages */
.chat-messages li.my-message strong,
.chat-messages li.my-message .message-sender {
    color: #0056b3;
}

body.dark-theme .chat-messages li.my-message strong,
body.dark-theme .chat-messages li.my-message .message-sender {
    color: #53bdeb;
}

/* Other people's messages - LEFT SIDE */
.chat-messages li.other-message {
    background: #ffffff;
    align-self: flex-start;
    margin-right: auto;
    margin-left: 0;
    color: #111b21;
    border-radius: 7.5px;
}

body.dark-theme .chat-messages li.other-message {
    background: #202c33;
    color: #e9edef;
}

/* Sender name - randomized colors */
.chat-messages li strong {
    font-weight: 500;
    font-size: 13px;
    margin-right: 4px;
    display: inline-block;
}

.message-sender-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.24);
    font-weight: 700;
    letter-spacing: 0.03em;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
}

body.dark-theme .message-sender-badge {
    background: rgba(255, 255, 255, 0.24);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}

/* Define color palette for senders - HYPER CONTRAST */
:root {
    --sender-color-0: #00695c;
    --sender-color-1: #b71c1c;
    --sender-color-2: #4a148c;
    --sender-color-3: #bf360c;
    --sender-color-4: #01579b;
}

body.dark-theme {
    --sender-color-0: #26ffd4;
    --sender-color-1: #ff5252;
    --sender-color-2: #e1bee7;
    --sender-color-3: #ffab40;
    --sender-color-4: #82b1ff;
}

/* Sender name colors - assigned by sender ID, not message position */
.chat-messages li.other-message strong {
    color: var(--sender-color, var(--sender-color-0));
}

/* Message text - removed (handled per message type above) */

/* Links in messages - HYPER CONTRAST */
.chat-messages li.my-message a {
    color: #004085;
    text-decoration: underline;
    font-weight: 600;
}

body.dark-theme .chat-messages li.my-message a {
    color: #ff9c6b;
}

.chat-messages li.other-message a {
    color: #0056b3;
    text-decoration: underline;
    font-weight: 600;
}

body.dark-theme .chat-messages li.other-message a {
    color: #3ba4d3;
}

.chat-messages li a:hover {
    color: #000000;
}

body.dark-theme .chat-messages li a:hover {
    color: #ffffff;
}

/* New message structure - separate divs */
.message-sender {
    font-weight: 500;
    font-size: 12.8px;
    margin-bottom: 4px;
    display: block;
}

.message-content {
    font-size: 14.2px;
    line-height: 19px;
    word-break: break-word;
}

.message-time {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.45);
    margin-top: 4px;
    text-align: right;
    display: block;
}

body.dark-theme .message-time {
    color: rgba(241, 241, 242, 0.63);
}

.chat-messages li.my-message .message-time {
    color: rgba(0, 0, 0, 0.45);
}

body.dark-theme .chat-messages li.my-message .message-time {
    color: rgba(232, 239, 240, 0.63);
}

/* Timestamp - old inline format */
.chat-messages li small {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.5);
    margin-left: 8px;
    white-space: nowrap;
}

body.dark-theme .chat-messages li small {
    color: #ff6f6fb3;
}

/* Unread indicator */
.chat-messages li.highlighted {
    background: #c7cb12 !important;
    color: #100101; 
}
.chat-messages li.highlighted strong,
.chat-messages li.highlighted .message-sender {
    color: #000000;
    font-weight: 700;
}
.chat-messages li.highlighted small,
.chat-messages li.highlighted .message-time {
    font-weight: 700 !important;
    color: black !important;
}
body.dark-theme .chat-messages li.highlighted {
    background: #c7cb12 !important;
    color: #100101;
}

/* Chat input - RECTANGULAR like WhatsApp Web */
.chat-input {
    width: 100%;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: #f0f2f5;
    color: #111b21;
    font-size: 15px;
    font-family: "Segoe UI", Helvetica, Arial, sans-serif;
    transition: all 0.2s ease;
    resize: none;
}

body.dark-theme .chat-input {
    background: #2a3942;
    color: #e9edef;
}

.chat-input:focus {
    outline: none;
    background: #ffffff;
}

body.dark-theme .chat-input:focus {
    background: #33404a;
}

.chat-input::placeholder {
    color: #667781;
}

body.dark-theme .chat-input::placeholder {
    color: #8696a0;
}

/* Chat action bubble (copy/link buttons) */
.chat-action-bubble {
    position: absolute;
    z-index: 1001;
    animation: fadeIn 0.2s ease;
}

.chat-action-btn {
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    width: 100%;
    height: 19px; /* Same as line-height of messages */
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.chat-action-btn:hover {
    background: rgba(0, 0, 0, 0.95);
    transform: scale(1.02);
}

.chat-action-btn:active {
    transform: scale(0.98);
}

body.dark-theme .chat-action-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #111b21;
}

body.dark-theme .chat-action-btn:hover {
    background: rgba(255, 255, 255, 1);
}

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

/* Loading indicator */
.chat-loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    gap: 16px;
}

.chat-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

body.dark-theme .chat-loading-spinner {
    border-color: rgba(255, 255, 255, 0.1);
    border-top-color: #bb86fc;
}

.chat-loading-text {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

body.dark-theme .chat-loading-text {
    color: #aaa;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Load More button */
.chat-load-more {
    text-align: center;
    padding: 12px 0;
    margin: 8px 0;
}

.chat-load-more button {
    font-size: 13px;
    padding: 6px 16px;
    background: rgba(0, 0, 0, 0.05);
    color: #666;
    border: 1px solid rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-load-more button:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.chat-load-more button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

body.dark-theme .chat-load-more button {
    background: rgba(255, 255, 255, 0.05);
    color: #aaa;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-theme .chat-load-more button:hover {
    background: rgba(255, 255, 255, 0.08);
}

