﻿ /* Ensure the background image covers the full height and repeats */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden;

}

.message-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.message-action-button {
    border: none;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.7rem;
    background-color: rgba(255, 255, 255, 0.25);
    color: inherit;
}

.deleted-message {
    opacity: 0.85;
}

.deleted-message-text {
    font-style: italic;
}

.message-action-menu {
    position: fixed;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    min-width: 120px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.message-action-menu-item {
    border: none;
    background: transparent;
    text-align: left;
    padding: 8px 12px;
    font-size: 0.85rem;
    color: #212529;
}

.message-action-menu-item:hover {
    background: #f1f3f5;
}

.chat-fetch-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.85);
    z-index: 20;
}

.chat-fetch-spinner {
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    border-top: 4px solid #3498db;
    width: 36px;
    height: 36px;
    animation: spin 1s linear infinite;
}

.chat-fetch-text {
    font-weight: 600;
    color: #0056b3;
}




/* Set the background image to repeat and overlay with 50% transparency */
/*body {
    background-image: url('/images/chat-background.png');
    background-size: auto;*/ /* Keep the original size of the image */
    /*background-repeat: repeat;*/ /* Repeat the image across the screen */
    /*background-position: top left;*/ /* Start repeating from the top left */
    /* Add a semi-transparent white overlay to achieve 50% transparency effect */
    /*background-color: rgba(255, 255, 255, 1.0);*/ /* White overlay with 50% opacity */
    /*background-blend-mode: lighten;  Blend the background image with the color */
/*}*/

/* Apply background only to the chat page */
.chat-page {
    --chat-font-size: 14pt;
    background-image: var(--chat-bg-tile, url('/images/Chat_bubble.png'));
    background-size: 280px auto;
    background-repeat: repeat;
    background-position: top left;
    background-color: rgba(255, 255, 255, 1.0);
    /*height: 100%;*/
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

@media (min-width: 768px) {
    .chat-navbar,
    .chat-page {
        width: 100vw;
        margin-left: calc(50% - 50vw);
        margin-right: calc(50% - 50vw);
    }

    .chat-navbar .container-fluid,
    #chat-messages,
    #chat-input-area {
        padding-left: 100px !important;
        padding-right: 100px !important;
    }
}

/* Chat messages area */
#chat-messages {
    overflow-y: auto;
    overflow-x: hidden; /* Prevent horizontal scroll */
    padding: 15px;
    padding-bottom: 16px;
    /*background-color: rgba(255, 255, 255, 0.5);*/ /* Light transparent background */
    height: calc(100dvh - 60px - var(--chat-input-height, 88px));
    display: block;
    width: 100%; /* Ensure the container takes full width */
}

/* Add smaller font for the message timestamp and ensure it appears below the message */
.message-time {
    font-size: 0.9rem; /* Smaller font size for the timestamp */
    color: rgba(0, 0, 0, 1.); /* Gray color for the timestamp */
    display: block; /* Ensure it appears on a new line */
    margin-top: 5px; /* Space between message and timestamp */
}

/* Ensure messages are block elements to take up full width of their parent */
.message {
    display: block; /* Forces each message to be on its own row */
    width: 100%; /* Ensures the message takes up full width of the parent */
}

/* Messages from the current user (right aligned) */
.current-user-message {
    text-align: left;
    background: linear-gradient(to right, #007bff, #0056b3); /* Blue gradient for current user */
    color: white;
    padding: 10px;
    border-radius: 10px;
    margin-left: auto; /* Push to the right */
    margin-top: 10px;
    max-width: 80%; /*Limit message width to 80% */
    word-wrap: break-word;
    white-space: pre-wrap;
   /* display: inline-block;*/
    float: right; /* Align to the right */
    /*display: block;  Ensure it takes full width */
    clear: both; /* Clears any floating elements to prevent side-by-side display */
    font-size: var(--chat-font-size, 14pt); /* Configurable chat font size */
    box-shadow: 5px 8px 8px rgba(0, 0, 0, 0.6); /* Add shadow */
    position: relative; /* Ensure the pseudo-elements are positioned relative to this */
    z-index: 10; /* Ensure the main bubble stays on top */
    overflow: visible; /* Allow pseudo-elements to be visible outside */
    display: flex;
    flex-direction: column; /* Stack children vertically */
    align-items: flex-end; /* Align all children to the right */
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
}

    .current-user-message::before,
    .current-user-message::after {
        content: '';
        position: absolute;
        background: linear-gradient(to right, #007bff, #0056b3); /* Same color as the main bubble */
        border-radius: 50%; /* Make it circular */
        box-shadow: 5px 8px 8px rgba(0, 0, 0, 0.3); /* Add shadow to match */
        border: 2px solid #0056b3; /* Add border around the bubble */
        z-index: -1; /* Ensure the pseudo-elements go behind the main bubble */
    }

    .current-user-message::before {
        width: 15px;
        height: 15px;
        bottom: 8px;
        right: -8px; /* Position it just outside the main bubble */
    }

    .current-user-message::after {
        width: 10px;
        height: 10px;
        bottom: 4px;
        right: -15px; /* Position it slightly further out for a cascading effect */
    }

/* Messages from other users (left aligned) */
.other-user-message {
    text-align: left;
    background: linear-gradient(to right, #e9ecef, #d6d8db); /* Light gray gradient for other users */
    color: black;
    padding: 10px;
    border-radius: 10px;
    margin-right: auto; /* Push to the left */
    margin-top: 10px;
    max-width: 80%; /*Limit message width to 80% */
    float: left; /* Align to the left */
    word-wrap: break-word;
    white-space: pre-wrap;
    display: inline-block;
    /*display: block;  Ensure it takes full width */
    clear: both; /* Clears any floating elements to prevent side-by-side display */
    font-size: var(--chat-font-size, 14pt); /* Configurable chat font size */
    box-shadow: 5px 8px 8px rgba(0, 0, 0, 0.6); /* Add shadow */
    position: relative; /* Ensure the pseudo-elements are positioned relative to this */
    z-index: 10; /* Ensure the main bubble stays on top */
    overflow: visible; /* Allow pseudo-elements to be visible outside */
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.current-user-message > *,
.other-user-message > * {
    max-width: 100%;
}
    .other-user-message::before,
    .other-user-message::after {
        content: '';
        position: absolute;
        background: linear-gradient(to right, #e9ecef, #d6d8db); /* Same color as the main bubble */
        border-radius: 50%; /* Make it circular */
        box-shadow: 5px 8px 8px rgba(0, 0, 0, 0.3); /* Add shadow to match */
        border: 2px solid #b0b3b5; /* Add border around the bubble */
        z-index: -1; /* Ensure the pseudo-elements go behind the main bubble */
    }

    .other-user-message::before {
        width: 15px;
        height: 15px;
        bottom: 8px;
        left: -8px; /* Position it just outside the main bubble */
    }

    .other-user-message::after {
        width: 10px;
        height: 10px;
        bottom: 4px;
        left: -15px; /* Position it slightly further out for a cascading effect */
    }

/* Add smaller font for the message timestamp and ensure it appears below the message */
.current-message-time {
    float:right;
    font-size: 0.8rem; /* Smaller font size for the timestamp */
    color: white; /* Gray color for the timestamp */
    display: block; /* Ensure it appears on a new line */
   /* margin-top: 5px;  Space between message and timestamp */
}

.other-message-time {
    font-size: 0.8rem; /* Smaller font size for the timestamp */
    color: black; /* Gray color for the timestamp */
    display: block; /* Ensure it appears on a new line */
    /* margin-top: 5px; Space between message and timestamp */
}

/* Input area */
#chat-input-area {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    background-color: rgba(255, 255, 255, 0.9); /* Semi-transparent background */
    padding: 10px;
    border-top: 1px solid #ddd;
    font-size: 1.2rem; /* Increase font size */
    overflow-x: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
}

.reply-preview {
    width: 100%;
    margin-bottom: 8px;
    border-left: 3px solid #0d6efd;
    background: rgba(13, 110, 253, 0.08);
    border-radius: 6px;
    padding: 6px 8px;
}

.reply-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #0d6efd;
}

.reply-preview-text {
    font-size: 0.82rem;
    color: #343a40;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.reply-preview-content {
    margin-top: 4px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.reply-preview-image {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.reply-preview-cancel {
    border: none;
    background: transparent;
    color: #0d6efd;
    font-size: 1rem;
    line-height: 1;
    padding: 0 4px;
}

.message-reply-quote {
    width: 100%;
    border-left: 3px solid rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 5px 8px;
    margin-bottom: 6px;
    font-size: 0.78rem;
}

.message-reply-quote-image {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
}

.other-user-message .message-reply-quote {
    border-left-color: rgba(0, 0, 0, 0.35);
    background: rgba(0, 0, 0, 0.08);
}

/* Style for the plus button to make it round */
#plus-button {
    width: 45px; /* Set the width */
    height: 45px; /* Set the height */
    border-radius: 50%; /* Makes the button round */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem; /* Adjust icon size */
    margin-right: 10px;
}

/* Style for the send button to make it round */
#send-button {
    width: 45px; /* Set the width */
    height: 45px; /* Set the height */
    border-radius: 50%; /* Makes the button round */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem; /* Adjust icon size */
    margin-left: 10px;
}


.icon-container {
    display: flex;
    align-items: center; /* Vertically align items */
    justify-content: flex-end; /* Align items to the right */
    gap: 10px; /* Even space between each icon */
}

.chat-nav-layout {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
}

.chat-nav-left {
    justify-self: start;
}

.chat-nav-center {
    justify-self: center;
    text-align: center;
}

.chat-nav-right {
    justify-self: end;
}

.icon-item {
    display: flex;
    margin-left: 20px;
    align-items: center; /* Center items inside each icon */
    justify-content: center;
}

.sync-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: green; /* Default color */
}

/* Color states */
.syncing {
    background-color: orange; /* Sync in progress */
}

.synced {
    background-color: green; /* Synced */
}


/* Style for the message image icon */
.message-image-icon {
    width: min(280px, calc(80vw - 32px));
    max-width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    cursor: pointer;
    border-radius: 8px;
    margin-top: 10px;
    display: block;
}

.image-upload-progress {
    width: min(280px, calc(80vw - 32px));
    max-width: 100%;
    margin-top: 7px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.72rem;
    line-height: 1.25;
    letter-spacing: 0.01em;
}

.image-upload-progress--failed {
    color: #ffd2d2;
}

.image-upload-retry-button {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.45rem;
    padding: 0.35rem 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.image-upload-retry-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.7);
    transform: translateY(-1px);
}

.image-upload-retry-button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.image-upload-retry-button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.image-upload-progress-line {
    display: block;
    height: 2px;
    margin-top: 5px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.28);
}

.image-upload-progress-line::after {
    content: "";
    display: block;
    width: 38%;
    height: 100%;
    border-radius: inherit;
    background: currentColor;
    animation: image-upload-progress 1.15s ease-in-out infinite;
}

.image-upload-progress-line--determinate::after {
    width: var(--image-upload-progress);
    animation: none;
    transform: none;
}

.image-upload-progress--complete {
    color: #d1fae5;
    font-weight: 600;
}

@keyframes image-upload-progress {
    from { transform: translateX(-110%); }
    to { transform: translateX(290%); }
}


/* Modal styling for full image */
.full-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow: hidden;
}



/* Logout button icon */
#logout-button {
    color: #dc3545; /* Red color */
    text-decoration: none;
    font-size: 1.5rem; /* Adjust the size of the icon */
    float: none;
    display: inline-flex;
    align-items: center;
}

    #logout-button:hover {
        color: #a71d2a; /* Darker red on hover */
    }

/* Settings button icon */
#settings-button {
    color: #6c757d; /* Grey color */
    text-decoration: none;
    font-size: 1.5rem; /* Adjust the size of the icon */
}

    #settings-button:hover {
        color: #343a40; /* Darker grey on hover */
    }

/* Bubbles button icon */
#bubbles-button {
    color: #0d6efd; /* Blue color */
    text-decoration: none;
    font-size: 1.5rem; /* Adjust the size of the icon */
}

    #bubbles-button:hover {
        color: #0a58ca; /* Darker blue on hover */
    }




/*image command zooming section*/
.full-image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow: hidden;
    touch-action: none; /* Prevent default touch actions like scrolling and pinch-zooming */
}

.full-image {
    max-width: 100%;
    max-height: 100%;
    transition: transform 0.3s ease;
    cursor: pointer;
}

    .full-image.zoomed {
        transform: scale(2); /* Adjust this value as needed for zoom level */
        cursor: zoom-out; /* Change cursor to indicate zoomed state */
    }


.close-button {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 32px;
    cursor: pointer;
    z-index: 10000; /* Ensure the close button is above other modal elements */
}

.loader {
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    border-top: 4px solid #3498db;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}


.enlarged-emoticon {
    font-size: 2em; /* Adjust as needed */
    line-height: 1.2;
}

.bubble-title {
    font-size: 18px;
    font-weight: bold;
    color: #0056b3;
    margin-left: 20px;
}

.chat-nav-title {
    margin-left: 0;
}



/*URL Stuff*/
/* Link text in messages */
.link-text {
    color: #ffffff;
    text-decoration: underline;
    font-weight: bold;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* URL preview card */
.url-preview {
    text-decoration: none;
    display: block;
    margin-top: 6px;
    width: 100%;
    max-width: 100%;
}

.url-tile {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    gap: 10px;
    transition: background 0.2s;
}

    .url-tile:hover {
        background: rgba(0, 0, 0, 0.35);
    }

/* Favicon icon container with fallback */
.tile-icon {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

    /* Fallback link icon shown when favicon fails to load */
    .tile-icon::before {
        content: '\f0c1';
        font-family: 'Font Awesome 5 Free';
        font-weight: 900;
        font-size: 16px;
        color: rgba(255, 255, 255, 0.6);
        position: absolute;
    }

    .tile-icon img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        position: relative;
        z-index: 1;
    }

/* Text content area */
.tile-content {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.tile-title {
    font-size: 0.85rem;
    font-weight: bold;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.tile-description {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 2px 0;
}

.tile-domain {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

.message-reactions {
    position: absolute;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    top: -24px;
    z-index: 12;
}

.current-user-message .message-reactions {
    left: -24px;
}

.other-user-message .message-reactions {
    right: -16px;
}

.reaction-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    padding: 0;
    border-radius: 0;
    font-size: 2rem;
    background: transparent;
    color: #fff;
    transform-origin: 50% 70%;
    animation: reactionPulseRock 1.15s linear infinite;
}

.other-user-message .reaction-pill {
    background: transparent;
    color: #1d1d1d;
}

.reaction-picker {
    position: fixed;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: 999px;
    background: rgba(28, 28, 30, 0.96);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.reaction-picker-button {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px;
    border-radius: 10px;
    transition: transform 0.08s ease, background-color 0.08s ease, opacity 0.12s ease;
}

.reaction-picker-button.selected {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.18);
}

.reaction-picker-button:disabled {
    opacity: 0.75;
    cursor: default;
}

@keyframes reactionPulse {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.18);
    }
}

@keyframes reactionPulseRock {
    0% {
        transform: rotate(0deg);
    }
    12.5% {
        transform: rotate(4deg);
    }
    25% {
        transform: rotate(8deg);
    }
    37.5% {
        transform: rotate(4deg);
    }
    50% {
        transform: rotate(0deg);
    }
    62.5% {
        transform: rotate(-4deg);
    }
    75% {
        transform: rotate(-8deg);
    }
    87.5% {
        transform: rotate(-4deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

.chat-attachment-menu {
    position: fixed;
    z-index: 1150;
    display: flex;
    flex-direction: column;
    min-width: 160px;
    border-radius: 10px;
    background: rgba(20, 20, 22, 0.95);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.chat-attachment-menu-item {
    border: none;
    background: transparent;
    color: #fff;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    cursor: pointer;
}

.chat-attachment-menu-item:hover {
    background: rgba(255, 255, 255, 0.12);
}

.chat-inline-gif {
    width: min(280px, calc(80vw - 32px));
    max-width: 100%;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
}

.chat-gif-link {
    display: inline-block;
    max-width: 100%;
}

.gif-picker-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.gif-picker-panel {
    width: min(680px, 100%);
    max-height: min(80vh, 760px);
    background: #111;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.gif-picker-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.gif-picker-search {
    flex: 1;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: #1e1e1e;
    color: #fff;
    padding: 8px 10px;
}

.gif-picker-close {
    border: none;
    background: transparent;
    color: #fff;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 6px;
}

.gif-picker-status {
    color: rgba(255, 255, 255, 0.78);
    font-size: 0.9rem;
    padding: 10px 12px;
}

.gif-picker-results {
    padding: 10px;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    overflow-y: auto;
}

.gif-picker-item {
    border: none;
    padding: 0;
    margin: 0;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    display: block;
    width: 100%;
}

.gif-picker-item-image {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

@media (max-width: 768px) {
    .gif-picker-modal {
        padding: 8px;
    }

    .gif-picker-panel {
        width: 100%;
        max-height: 84vh;
    }

    .gif-picker-results {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding: 12px;
    }

    .gif-picker-item-image {
        height: auto;
        min-height: 0;
        max-height: none;
        object-fit: contain;
    }
}
