* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
  --message-input-height: 50px; /* Default height, will be updated dynamically */
}


.app-container {
    display: flex;
    height: 100vh;
    background-color: #f5f5f5;
}

/* Chat List Styling */
.chat-list {
    width: 100vw;
    background-color: #fff;
    border-right: 1px solid #e1e1e1;
    display: flex;
    flex-direction: column;
}


.message-view {
    display: none; /* Hide chat section initially */
    flex: 1;
    flex-direction: column;

    position: relative; /* Add this to establish positioning context */
    height: 100vh; /* Make it full viewport height */
    overflow: hidden; /* Prevent scrolling of the entire container */
}



.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  padding: 15px;
  border-bottom: 1px solid #e1e1e1;
  background-color: #f8f8f8;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 5vw;
  height: auto;
}

.icon-container a span {
    color: #004978 !important;
}


h2 {
margin: 0;
font-size: 25px;
font-weight: 520;
color:#004978;

}

.chat-list-container {
    flex: 1;
    overflow-y: auto;
     padding-top: 80px; /* Adjust this value based on your header height */
}

.chat-item {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.chat-item:hover {
    background-color: #f9f9f9;
}

.chat-item.active {
    background-color: #eaeaea;
}

.chat-info {
    flex: 1;
}

.chat-name {
    font-weight: 600;
    margin-bottom: 5px;
}

.last-message {
    font-size: 0.9rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.timestamp {
    font-size: 0.8rem;
    color: #999;
    align-self: flex-start;
}



.messages-container {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: relative;

    padding-top: 80px; /* Adjust this value based on your header height */
    padding-bottom: calc(var(--message-input-height) + 15px);
}

.message {
    max-width: 70%;
    margin-bottom: 10px;
    padding: 10px 15px;
    border-radius: 15px;
    position: relative;
}

.message.sent {
    align-self: flex-end;
    background-color: #dcf8c6;
}

.message.received {
    align-self: flex-start;
    background-color: #fff;
    border: 1px solid #e1e1e1;
}

.message-content {
    margin-bottom: 5px;
}

.message-time {
    font-size: 0.7rem;
    color: #999;
    text-align: right;
}

.message-input-container { 
    position: fixed;
    bottom: env(safe-area-inset-bottom, 0);
    left: 0;
    right: 0;
    width: 100%;
    background: white;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;

    height: auto;
    min-height: 50px;
    max-height: 150px;

    z-index: 100;
}

.message-input-container input {
    flex: 1;
}

#messageInput {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
}

#sendButton {
    margin-left: 10px;
    padding: 10px 20px;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#sendButton:hover {
    background-color: #45a049;
}

#sendButton:disabled, #messageInput:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive design */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .chat-list {
        width: 100%;
        height: 100%;
    }
}










/* Add these to your CSS file */

/* Initial state - hide message view content */
.messages-container, .message-input-container {
    display: none;
}

/* State classes to control visibility */
.app-container.state-empty .chat-list {
    width: 100%;
}

/* Show message-view only when a chat is selected */
.app-container.state-chat-selected .message-view {
    display: flex;
}

/* Ensure chat list is visible initially */
.app-container .chat-list {
    display: flex;
}

/* Hide chat list when a chat is selected */
.app-container.state-chat-selected .chat-list {
    display: none;
}

.app-container.state-chat-selected .messages-container, 
.app-container.state-chat-selected .message-input-container {
    display: flex;
}

.app-container.state-chat-selected .message-view .header {
  position: fixed;
  top: 0;
  left: 0;
}



/* Empty state messaging */
.no-chats, .no-messages {
    padding: 20px;
    text-align: center;
    color: #888;
    font-style: italic;
}

/* Add responsive fix for states as well */
@media (max-width: 768px) {
    .app-container.state-chat-selected .chat-list {
        display: none;
    }
    
    .app-container.state-chat-selected .message-view {
        height: 100%;
    }
}
















