/* Full-Screen Chat Modal */
.full-screen-chat-modal {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgb(255, 255, 255, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000; /* Ensure it's on top of everything */
    flex-direction: column; /* Stack header, main, footer vertically */
    overflow: hidden; /* Prevent body scroll, main will scroll */
    transition: transform 0.3s ease-out; /* Smooth entry/exit */
    transform: translateX(100%); /* Start off-screen to the right */
}

.full-screen-chat-modal.open {
    display: flex; /* Show when open */
    transform: translateX(0); /* Slide into view */
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    padding: 1rem;
background-color: rgb(255, 255, 255, 0.4);
    color: #333;
    position: sticky; /* Sticky header */
    top: 0;
    z-index: 10;
}

.chat-header .back-button {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.chat-header .back-button:hover {
    background-color: rgba(255,255,255,0.1);
}

.chat-header .chat-header-info {
    display: flex;
    align-items: center;
    flex-grow: 1; /* Take up remaining space */
    margin-left: 1rem;
}

.chat-header .chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 0.75rem;
    border: 2px solid white; /* Small white border */
}

.chat-header .chat-header-name {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Chat Messages Display Area */
.chat-messages-display {
    flex-grow: 1; /* Takes up all available space between header and footer */
    padding: 1rem;
    overflow-y: auto; /* Enable scrolling for messages */
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Space between message bubbles */
}
svg.feather.feather-arrow-left {
    fill: black;

    stroke: black;
    stroke-width: 2;
}

/* Individual Message Bubble Styles */
.chat-message {
    display: flex;
    max-width: 80%; /* Limit message bubble width */
}

.chat-message.sent {
    margin-left: auto; /* Align to right for sent messages */
}

.chat-message.received {
    margin-right: auto; /* Align to left for received messages */
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 1.2rem;
    font-size: 0.95rem;
    position: relative;
    word-wrap: break-word; /* Ensure long words break */
    min-width: 60px; /* Minimum width for small messages */
}

.chat-message.sent .message-bubble {
    background-color: #DCF8C6; /* Light green for sent messages */
    color: #333;
    border-bottom-right-radius: 0.3rem; /* Tapered corner for sent messages */
}

.chat-message.received .message-bubble {
    background-color: #fff; /* White for received messages */
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 0.3rem; /* Tapered corner for received messages */
}

.message-timestamp {
    font-size: 0.7rem;
    color: #777;
    text-align: right; /* Align timestamp to bottom right of bubble */
    margin-top: 0.25rem;
    display: block; /* Ensures it's on its own line */
}

/* Image Messages */
.message-image {
    max-width: 100%;
    max-height: 200px; /* Limit height of images */
    border-radius: 8px;
    object-fit: contain; /* Ensure full image is visible */
    margin-bottom: 0.5rem; /* Space between image and timestamp */
}

/* View-Once Image Styles */
.view-once-container {
    position: relative;
    width: 150px; /* Fixed size for view-once placeholder */
    height: 150px;
    background-color: rgb(255, 255, 255, 0.5);
    backdrop-filter: blur(6px);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    overflow: hidden;
    font-size: .8em;
    text-align: center;
}

.view-once-container.viewed {
    background-color: #ddd;
    color: #888;
    cursor: default;
}

.view-once-tap-to-view {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 100%;
    width: 100%;
    color: #555;
}

.view-once-tap-to-view svg {
    color: #555;
    margin-bottom: 5px;
}

/* Animation for view-once image disappearance */
.chat-message.fade-out {
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}


/* Chat Input Area */
.chat-input-area {
    display: flex;
    padding: 0.75rem 1rem;
    background-color: #fff;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
    align-items: center;
    gap: 0.5rem;
    position: sticky; /* Sticky footer */
    bottom: 0;
    z-index: 10;
}

.chat-input-area .icon-button {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.chat-input-area .icon-button:hover {
    background-color: #f0f0f0;
    color: #2196F3;
}

#message-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 20px; /* Pill shape */
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

#message-input:focus {
    border-color: #2196F3;
}

.send-button {
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 50%; /* Circular button */
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease-in-out;
    flex-shrink: 0; /* Prevent button from shrinking */
}

.send-button:hover {
    background-color: #1976D2;
    transform: scale(1.05);
}

.send-button svg {
    width: 20px;
    height: 20px;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .chat-header {
        padding: 0.75rem;
    }

    .chat-header .chat-header-name {
        font-size: 1.1rem;
    }

    .chat-header .chat-header-avatar {
        width: 35px;
        height: 35px;
    }

    .chat-messages-display {
        padding: 0.75rem;
    }

    .message-bubble {
        padding: 0.6rem 0.9rem;
        font-size: 0.9rem;
    }

    .chat-input-area {
        padding: 0.5rem 0.75rem;
    }

    #message-input {
        padding: 0.6rem 0.9rem;
        font-size: 0.9rem;
    }

    .send-button {
        width: 40px;
        height: 40px;
    }

    .send-button svg {
        width: 18px;
        height: 18px;
    }

    .view-once-container {
        width: 120px;
        height: 120px;
    }
}
/* Small Message Popup (for "Can't open view once") */
.small-message-popup {
    position: fixed;
    bottom: -60px; /* Start off-screen */
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    z-index: 1000;
    opacity: 0;
    transition: bottom 0.3s ease-out, opacity 0.3s ease-out;
    font-size: 0.9rem;
    white-space: nowrap;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.small-message-popup.show {
    bottom: 20px; /* Slide in */
    opacity: 1;
}

@media (max-width: 600px) {
    .small-message-popup {
        bottom: -80px; /* Adjust for smaller screens */
        padding: 8px 15px;
        font-size: 0.85rem;
    }
    .small-message-popup.show {
        bottom: 15px;
    }
}



/* NEW: Simple View-Once Overlay Styles */
.view-once-simple-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* Darker background */
    backdrop-filter: blur(15px); /* Stronger blur effect */
    -webkit-backdrop-filter: blur(15px); /* For Safari */
    z-index: 1001; /* Above chat modal */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.view-once-simple-overlay.open {
    opacity: 1;
    visibility: visible;
}

.view-once-simple-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-once-simple-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* Ensure the whole image is visible */
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.view-once-simple-close-button {
    position: absolute;
    top: 15px; /* Adjusted for better spacing */
    right: 15px; /* Adjusted for better spacing */
    background-color: rgba(255, 255, 255, 0.3); /* Slightly transparent white */
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.2s ease;
    z-index: 10; /* Ensure button is clickable above image */
}

.view-once-simple-close-button:hover {
    background-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.1);
}