/* General styling for the chat box */
#chat-overlay {
    position: fixed;
    width: 545px;
    height: 40%;
    bottom: 10px;
    right: 10px;
    background-color: rgba(40, 40, 43, 0.8); /* Matte black with 20% transparency */
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    display: none; /* Start hidden */
    flex-direction: column;
    z-index: 1000;
}

/* Header styling */
#chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    color: #f5d470; /* Gold color for header text */
}

/* Container for title and online status */
#chat-title-container {
    display: flex;
    align-items: center;
    gap: 5px; /* Reduced gap between "Social" and status indicator */
}

#chat-title {
    margin: 0;
    padding-right: 10px;
    font-size: 1.2em;
    color: #f5d470; /* Gold color for the title */
}

#chat-actions {
    display: flex;
    gap: 10px;
}

.chat-action-button {
    padding: 3px 8px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    color: white; /* White text color for buttons */
}

.chat-action-button-overlay {
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    color: white; /* White text color for buttons */
}

.add-friend {
    background-color: darkslateblue;
}

.add-friend:hover {
    background-color: #06768d;
}

.block-user {
    background-color: #003747;
}

.block-user:hover {
    background-color: red;
}

/* Divider styling under header */
.chat-header-divider {
    border: none;
    border-top: 1px solid #f5d470; /* Gold thin border */
    margin: 0;
}

/* Close button styling */
#chat-overlay-close {
    margin-left: 10px;
    cursor: pointer;
    font-size: 20px;
    background: none;
    border: none;
    color: white; /* White color for better contrast */
}

#chat-overlay-close:hover {
    color: #f5d470; /* Gold color on hover */
}

/* Chat icon always-active state */
.always-active {
    opacity: 1;
}

/* Right and Left Panels Styling */
#chat-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.right-panel {
    width: 30%;
    overflow-y: auto;
    height: 90%;
    margin: auto;
    padding: 10px;
    border-left: 1px solid #f5d470;
}

.left-panel {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column-reverse;
}

.chat-category {
    margin-bottom: 15px;
}

.chat-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    color: #f5d470; /* Gold color for category header */
}

.chat-category-content {
    display: block;
    padding-left: 10px;
}

.chat-box {
    height: 100%;
}

/* Friends/requests/blocked items styling */
.chat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white; /* White color for usernames */
    padding: 5px 0px 5px 5px;
    border-radius: 5px;
    transition: background 0.3s ease; /* Smooth hover effect */
}

.chat-item:hover {
    background-color: rgba(255, 215, 0, 0.1); /* Light gold background on hover */
}

/* Styling for active (selected) friend */
.active-friend {
    color: #f5d470; /* Gold color for active friend */
}

/* Styling for username buttons with hover effect */
.username-button {
    background: none;
    border: none;
    color: white; /* Default white color */
    cursor: pointer;
    text-align: left;
    width: 100%;
    padding: 5px;
    transition: color 0.3s ease; /* Smooth transition for color changes */
}

.username-button:hover {
    color: #f5d470; /* Gold color on hover */
}

.toggle-category {
    background: none;
    border: none;
    color: #f5d470; /* Gold color for arrow */
    cursor: pointer;
}

/* Adjust styling for remove (x) button */
.remove-item {
    background: none;
    border: none;
    color: red;
    cursor: pointer;
    font-size: 16px;
    transition: color 0.3s ease;
}

.remove-item:hover {
    color: #f5d470; /* Gold color on hover */
}

.message-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    border-bottom: 1px solid #f5d470;
}

/* Message styling to mimic chat bubbles */
.message-wrapper {
    display: flex;
    margin-bottom: 10px;
    overflow-wrap: anywhere;   /* modern spec – will break mid-word if needed */
    word-break: break-word;    /* older fallback */
}

.our-message-wrapper {
    justify-content: flex-end;
}

.friend-message-wrapper {
    justify-content: flex-start;
}

.our-message {
    background-color: cornflowerblue; /* Blue bubble for user */
    color: white;
    padding: 10px;
    border-radius: 15px;
    word-wrap: break-word;
    max-width: 100%;
}

.friend-message {
    background-color: #444; /* Dark grey bubble for friend */
    color: white;
    padding: 10px;
    border-radius: 15px;
    word-wrap: break-word;
    max-width: 100%;
}

.input-container {
    display: flex;
    align-items: center;
    padding-top: 10px;
}

.message-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #f5d470;
    border-right: none;
    color: white;
    background-color: rgba(40, 40, 43, 0.8);
}

/* Specific styling for add/block friend input field */
.overlay-message-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #f5d470; /* Added gold border for consistency */
    color: white;
    background-color: rgba(40, 40, 43, 0.8);
    margin-bottom: 10px;
}

.send-button {
    padding: 5px;
    border: 1px solid #f5d470;
    border-left: none;
    background-color: #f5d470;
    cursor: pointer;
}

.send-icon {
    width: 24px; /* Adjust size as needed */
    height: 24px; /* Adjust size as needed */
}

.send-button:hover {
    background-color: #d4b556;
}

/* Styling for the overlay container */
.overlay-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5); /* Dark transparent overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100; /* On top of the chat */
    border-radius: 10px;
}

.overlay-container .input-container {
    background: rgba(40, 40, 43, 0.9); /* Matte black with higher transparency */
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 300px; /* Width of the overlay box */
    align-items: center; /* Center align all content in the overlay */
}

/* Delete button styling */
.chat-action-button-overlay.delete-user {
    background-color: darkred; /* Dark red to indicate delete action */
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    color: white;
}

.chat-action-button-overlay.delete-user:hover {
    background-color: #b22222; /* Lighter red on hover */
}

/* Button container styling to keep Delete and Cancel buttons side-by-side */
.button-container {
    display: flex;
    flex-direction: row;
    gap: 10px;
    justify-content: center;
}

/* Cancel button styling */
.chat-cancel-button {
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: #555; /* Dark grey for cancel button */
    color: white;
}

.chat-cancel-button:hover {
    background-color: #777; /* Lighter grey on hover */
}

/* General styling for action confirmation text */
.overlay-container .message-container {
    color: #f5d470; /* Gold color for consistency */
    font-size: 1.1em;
    text-align: center;
    padding-bottom: 10px;
}

/* Delete confirmation action buttons */
.delete-user {
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    color: white; /* White text color for buttons */
    background-color: darkred; /* Red for Delete to indicate danger */
}

.delete-user:hover {
    background-color: #b22222; /* Darker red on hover for better visibility */
}

/* Styling for highlighted username in the overlay */
.username-highlight {
    color: cornflowerblue; /* Cornflowerblue color for the username to make it stand out */
}

.accept-item {
    background: none;
    border: none;
    color: cornflowerblue; /* Green for accepting */
    cursor: pointer;
    font-size: 16px;
    transition: color 0.3s ease;
}

.accept-item:hover {
    color: #32CD32; /* Lime green on hover */
}

/* Accept button styling */
.chat-action-button-overlay.accept-user {
    background-color: darkgreen; /* Dark green to indicate acceptance action */
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    color: white; /* White text color for better contrast */
}

.chat-action-button-overlay.accept-user:hover {
    background-color: #228B22; /* Forest green on hover for better visibility */
}

/* Styling for the online/offline status */
#online-status-indicator {
    display: flex;
    align-items: center;
    gap: 4px; /* Small gap between the circle and the text */
    font-size: 0.9em;
}

.status-circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: red; /* Default to red for offline */
}

.status-text {
    font-weight: bold;
    color: red; /* Default to red for offline */
}

/* Actions container on the right */
#chat-actions {
    display: flex;
    gap: 10px;
}

@keyframes blinkGlow {
    0%, 100% {
        background-color: rgba(255, 223, 63, 0.7); /* Start and end with a richer gold */
    }
    50% {
        background-color: rgba(255, 223, 63, 0); /* Transparent at midpoint */
    }
}

.glow {
    animation: blinkGlow 2s ease-in-out infinite; /* Adjust speed as needed */
}

.chat-item {
    position: relative;
    display: flex;
    align-items: center;
    padding-left: 20px; /* Add padding to make space for the unread indicator */
}

.unread-indicator {
    position: absolute;
    left: 0; /* Place it at the far left of the friend entry */
    display: none; /* Start hidden */
    width: 10px;
    height: 10px;
    animation: blinkGlow 2s ease-in-out infinite; /* Adjust speed as needed */
    border-radius: 50%;
    margin-left: 8px;
}

/* For responsiveness */
@media (max-width: 768px) {
    #chat-overlay {
        width: 90%;
        height: 40%;
        bottom: 10px;
        right: 10px;
    }

    .right-panel {
        width: 35%;
    }
}

/* For responsiveness */
@media (max-width: 600px) {
    .status-text {
        display: none;
    }
    .status-circle {
        margin-right: 10px;
    }
}

@media (max-height: 768px) {
    #chat-overlay {
        height: 70%;
    }
}
