/* General reset for consistent styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%
}

/* background image */
body::before {
    content: "";
    background-image: url('background.jpg');
    position: fixed;
    width: 100%;
    min-height: 100vh;
    top: 0;
    left: 0;
    background-size: cover;
    background-position: center;
    filter: blur(5px);
    box-shadow: 0 0 8px 8px;
    z-index: -1;
}

main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* heading */
h2 {
    font-size: 2rem;
    color: #2cd364;
    margin-bottom: 20px;
    text-align: center;
}

/* Connection status */
#status {
    font-size: 1rem;
    color: #ff8282;
    margin-bottom: 15px;
}

/* Chat box */
#chatBox {
    background-color: #203e61;
    width: 100%;
    min-width: 600px;
    height: 500px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow-y: auto;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    gap: 10px;
}

/* Rules section */
#rules {
    width: 100%;
    max-width: 600px;
    margin-bottom: 15px;
    padding: 10px 15px;
}

#rules h3 {
    font-size: 1.2rem;
    color: #4a90e2;
    margin-bottom: 10px;
    text-align: left;
}

#rules ul {
    margin-left: 20px;
    list-style-type: disc;
    color: #c6fffc;
    font-size: 0.9rem;
    line-height: 1.5;
}

#rules ul li {
    margin-bottom: 5px;
}

/* footer */
footer {
    position: relative;
    bottom: 0;
    width: 100%;
    background-color: #f0f0f0;
    text-align: center;
    font-size: 12px;
    color: #666;
    border-top: 1px solid #ccc;
    opacity: 0.4;
}

/* Chat messages */
.message {
    width: auto;
    max-width: 80%;
    padding: 10px;
    border-radius: 10px;
    word-wrap: break-word;
    position: relative;
}

/* Sent messages */
.message.sent {
    align-self: flex-end;
    background: #d1e7dd;
    color: #0f5132;
    border-top-right-radius: 0;
    text-align: right;
}

/* Received messages */
.message.received {
    align-self: flex-start;
    background: #f8d7da;
    color: #842029;
    border-top-left-radius: 0;
    text-align: left;
}

/* Smooth message fade-in animation */
.message:last-child {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input section */
#inputSection {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 600px;
    margin-top: 10px;
}

/* Input field */
#messageInput {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
}

#messageInput:focus {
    border-color: #4a90e2;
}

/* Buttons */
button {
    padding: 10px 15px;
    font-size: 1rem;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    outline: none;
    transition: background-color 0.3s ease;
}

#startButton {
    background-color: #4caf50;
}

#sendButton {
    background-color: #2196f3;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

button:hover:not(:disabled) {
    opacity: 0.9;
}


/* Mobile-specific adjustments  */
@media (max-width: 768px) {
    main {
        flex: 1 1 auto;
        width: 100%;
        padding: 10px;
    }

    #chatBox {
        min-width: unset;
        height: 60vh;
    }
}
