/* ------------------------------------ */
/* 1. Global & Window Structure Styles  */
/* ------------------------------------ */

body {
    margin: 0;
    padding: 20px;
    background-color: #e0e0e0; /* Neutral background color */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.window-container {
    width: 400px; /* Classic chat window width */
    height: 500px;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid #c0c0c0;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
}

/* ------------------------------------ */
/* 2. AIM Title Bar Styles (Fixed Buttons) */
/* ------------------------------------ */

.title-bar {
    background: linear-gradient(#0066ff, #0044cc);
    color: white;
    font-family: Tahoma, sans-serif;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border: 2px solid #0044cc;
    user-select: none;
}

.aim-logo {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    background-color: transparent; 
    border-radius: 50%;
}

.title-left {
    display: flex;
    align-items: center;
}

.title-buttons div {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-left: 5px;
    text-align: center;
    line-height: 16px;
    color: #000;
    font-size: 12px;
    border: 1px solid #000;
    cursor: pointer;
    background-color: #cccccc;
    box-shadow: 1px 1px #808080;
}

.title-buttons .close {
    background-color: #ff3333; 
}

/* ------------------------------------ */
/* 3. Chat Window Styles              */
/* ------------------------------------ */

.chat-window {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    background-color: #ffffff;
}

.messages p {
    margin: 4px 0;
    line-height: 1.4;
}

/* ------------------------------------ */
/* 4. Input Area Styles               */
/* ------------------------------------ */

.input-area {
    padding: 10px;
    border-top: 1px solid #c0c0c0;
    background-color: #f0f0f0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-field {
    width: 100%;
    padding: 5px;
    border: 1px solid #777;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    font-size: 14px;
}

.user-input {
    height: 30px;
}

.text-input {
    resize: none;
    height: 60px; 
}

.send-button {
    background-color: #009933; 
    color: white;
    border: 1px solid #006600;
    padding: 5px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 1px 1px #006600;
    transition: background-color 0.1s;
}

.send-button:active {
    background-color: #004d00;
    box-shadow: none;
    transform: translate(1px, 1px);
}

/* ------------------------------------ */
/* 4.1. NEW: Status Area Styles       */
/* ------------------------------------ */

.status-area {
    padding: 10px;
    border-top: 1px solid #c0c0c0;
    border-bottom: 1px solid #c0c0c0;
    background-color: #f0f0f0;
    display: flex;
    gap: 5px;
    align-items: center;
}

.status-select {
    width: 100px;
    flex-shrink: 0;
}

.status-message {
    flex-grow: 1;
}

.status-button {
    width: 80px;
    flex-shrink: 0;
    /* Use a neutral/light button color for status */
    background-color: #55aaff; 
    border: 1px solid #0056b3;
}

.status-button:active {
    background-color: #0056b3;
    box-shadow: none;
    transform: translate(1px, 1px);
}

/* ------------------------------------ */
/* 5. Message Styling                 */
/* ------------------------------------ */

.message-self {
    text-align: right;
    color: #0066ff; 
}

.message-other {
    text-align: left;
    color: #000000; 
}

/* ------------------------------------ */
/* 6. Private Message Styling         */
/* ------------------------------------ */

.message-private {
    background-color: #fffacd; /* A light yellow for private messages */
    border-radius: 4px;
    padding: 2px 4px;
    margin-left: -4px; /* Adjust to sit flush with the edge */
}

/* Style the badge text within the private message */
.message-private strong {
    color: #800080; /* Purple for a private badge */
    font-size: 11px;
    font-weight: bold;
    margin-right: 5px;
}

/* ------------------------------------ */
/* 7. Buddy List Styles               */
/* ------------------------------------ */

.buddy-list-container {
    width: 200px; /* Classic Buddy List width */
    height: 500px;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid #c0c0c0;
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    margin-right: 20px; /* Space between windows */
}

.buddy-list {
    flex-grow: 1;
    overflow-y: auto;
    padding: 5px;
    background-color: #f0f0f0;
    font-family: Arial, sans-serif;
    font-size: 13px;
    font-weight: bold;
}

.buddy-title-bar {
    border-bottom: 0; 
    background: linear-gradient(#00cc00, #008000); 
}

.buddy-item {
    padding: 3px 5px;
    margin-bottom: 2px;
    cursor: pointer;
    border-radius: 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.1s;
}

.buddy-item:hover {
    background-color: #cceeff; 
}

/* Add Buddy Input */
.buddy-add-area {
    display: flex;
    flex-direction: column;
    padding: 5px;
    border-top: 1px solid #c0c0c0;
    gap: 5px;
    background-color: #ffffff;
}

.add-buddy-btn {
    padding: 5px;
    font-size: 14px;
}

.remove-buddy-btn {
    background: none;
    border: none;
    color: #ff0000;
    font-weight: bold;
    cursor: pointer;
    padding: 0 5px;
}

/* ------------------------------------ */
/* 7.1. NEW: Buddy Status Colors        */
/* ------------------------------------ */

.buddy-item[data-status="Online"] {
    color: #008000; /* Green */
}

.buddy-item[data-status="Away"] {
    color: #ff8c00; /* Orange/Gold */
    font-style: italic;
}

.buddy-item[data-status="Invisible"] {
    color: #808080; /* Grey */
    opacity: 0.7;
}

.buddy-item[data-status="Offline"] {
    color: #808080; /* Grey */
    opacity: 0.5;
}

.buddy-status-message {
    display: block;
    font-size: 10px;
    font-weight: normal;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* --- NEW: Away Message Box Styles --- */

#away-message-box {
    /* Position the box over the center of the screen */
    position: fixed; /* Use fixed so it stays in place when scrolling */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    /* Style the box */
    width: 300px;
    padding: 15px;
    background-color: #FFFFCC; /* Classic AIM Away Message light yellow */
    border: 3px solid #000;
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5); /* Gives it a raised, retro look */
    text-align: center;
    font-family: Tahoma, sans-serif;
    font-size: 14px;
    z-index: 1000; /* Ensure it floats above all other elements */
}

/* CRUCIAL: The class to hide it when the status is not 'Away' */
.hidden {
    display: none !important; /* Use !important to override any other display rules */
}

#away-message-box h2 {
    margin-top: 0;
    color: #000080; /* Dark blue title */
}