body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #eae6df;
    height: 100%;
    overflow: hidden;
    position: fixed;
    width: 100%;
}

#chat-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background-color: #fff;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
}

#header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    background-color: #008069;
    color: #fff;
    height: 54px;
    gap: 10px;
    position: relative;
    z-index: 2;
}

#profile-picture {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

#friend-name {
    font-size: 16px;
    font-weight: 500;
}

#online-status {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

#online-status::before {
    content: "online";
}

#message-list {
    flex: 1;
    padding: 8px 16px;
    overflow-y: auto;
    background-color: #efeae2;
    background-image: url('img/bg.webp');
    background-size: contain;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
}

.message-bubble {
    max-width: 65%;
    margin-bottom: 8px;
    padding: 8px 10px;
    border-radius: 7.5px;
    position: relative;
    font-size: 14.2px;
    line-height: 19px;
    box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.13);
}

.outgoing-message {
    background-color: #d9fdd3;
    margin-left: auto;
    border-top-right-radius: 0;
}

.incoming-message {
    background-color: #fff;
    margin-right: auto;
    border-top-left-radius: 0;
}

.message-image {
    max-width: 100%;
    border-radius: 6px;
    margin: 4px 0;
    display: block;
}

.message-link {
    color: #53bdeb;
    text-decoration: none;
    font-weight: 500;
    display: inline-block;
    margin-top: 5px;
}

.message-link:hover {
    text-decoration: underline;
}

#message-input {
    display: flex;
    align-items: center;
    padding: 10px;
    background-color: #f0f2f5;
    gap: 8px;
    position: relative;
    z-index: 2;
}

#user-input {
    flex: 1;
    padding: 9px 12px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    background-color: #fff;
    height: 20px;
    line-height: 20px;
    box-shadow: 0 1px 3px rgba(11, 20, 26, 0.08);
}

#user-input:focus {
    outline: none;
}

#send-button {
    width: 40px;
    height: 40px;
    padding: 8px;
    border: none;
    background-color: #00a884;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

#send-button:hover {
    background-color: #008f6f;
}

#send-button img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1);
}

/* Prevent scrolling on mobile */
@media (max-width: 600px) {
    body {
        position: fixed;
        width: 100%;
        height: 100%;
    }
    
    #chat-container {
        height: 100%;
        max-width: none;
        position: fixed;
    }
    
    .message-bubble {
        max-width: 85%;
    }
    
    #message-list {
        height: calc(100vh - 120px); /* Adjust based on header and input heights */
    }
}

/* Hide address bar on mobile */
@media screen and (max-width: 600px) {
    html {
        height: calc(100% + 60px);
    }
}