/* style.css */
body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f0f2f5;
    color: #333;
}

.container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 600px;
    height: 90vh;
    background-color: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 0 8px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.chat-header {
    background-color: #e2e8f0;
    padding: 15px;
    border-bottom: 1px solid #cbd5e0;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.chat-header h1 {
    margin: 0;
    font-size: 1.5em;
    color: #2d3748;
}

.secret-key-area {
    display: flex;
    gap: 5px;
    justify-content: center;
}

#secretKeyInput {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #a0aec0;
    border-radius: 4px;
    font-size: 0.9em;
}

#generateKeyBtn {
    background-color: #4a5568;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

#generateKeyBtn:hover {
    background-color: #2d3748;
}

.status-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 0.8em;
    color: #666;
}

.status-indicator.connected {
    color: #28a745;
}

.status-indicator.disconnected {
    color: #dc3545;
}

.chat-window {
    flex-grow: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #fdfdfd;
    border-bottom: 1px solid #eee;
}

.message {
    display: flex;
    margin-bottom: 10px;
    max-width: 80%;
}

.message.sent {
    margin-left: auto;
    justify-content: flex-end;
}

.message.received {
    margin-right: auto;
    justify-content: flex-start;
}

.message-bubble {
    padding: 10px 12px;
    border-radius: 18px;
    line-height: 1.4;
    word-wrap: break-word;
    position: relative;
    color: #333;
}

.message.sent .message-bubble {
    background-color: #e0f2f7; /* Light blue */
    border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
    background-color: #f0f0f0; /* Light gray */
    border-bottom-left-radius: 4px;
}

.message-bubble strong {
    display: block;
    font-size: 0.8em;
    margin-bottom: 3px;
    opacity: 0.7;
}

.message-bubble .timestamp {
    display: block;
    font-size: 0.7em;
    color: #888;
    margin-top: 5px;
    text-align: right;
}

.chat-input-area {
    display: flex;
    padding: 10px 15px;
    border-top: 1px solid #eee;
    background-color: #e2e8f0;
    gap: 5px;
}

#messageInput {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #a0aec0;
    border-radius: 20px;
    font-size: 1em;
}

.chat-input-area button {
    background-color: #4a5568;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
}

.chat-input-area button:hover {
    background-color: #2d3748;
}

.chat-input-area .clear-button {
    background-color: #dc3545;
}

.chat-input-area .clear-button:hover {
    background-color: #c82333;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
    }
    .chat-header h1 {
        font-size: 1.3em;
    }
    .secret-key-area {
        flex-direction: column;
        align-items: stretch;
    }
    #generateKeyBtn {
        width: 100%;
    }
    .chat-input-area {
        flex-wrap: wrap;
    }
    #messageInput {
        width: 100%;
        margin-bottom: 5px;
    }
    .chat-input-area button {
        flex-grow: 1;
    }
}
