/* style.css */

:root {
    --navbar-height: 52px;
    --filter-input-height: 48px;
    --table-header-height: 44px;
}

/* Reset default margins/padding */
body, html {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

/* Navbar container */
#navbar {
    display: flex;               /* horizontal layout */
    align-items: center;         /* vertical centering */
    padding: 10px 20px;
    background-color: #f2f2f2;   /* light gray background */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;                 /* stretch full width */
    box-sizing: border-box;
    position: fixed;             /* fixed to top */
    top: 0;
    z-index: 1000;               /* keep above other content */
}

/* Links and buttons in navbar */
#navbar a,
#navbar button {
    margin-right: 15px;
    padding: 10px 16px;
    border: 1px solid #ccc;
    background-color: #f2f2f2;  /* same as navbar */
    color: #333;
    text-decoration: none;
    cursor: pointer;
    font-size: 15px;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
    border-radius: 4px;
}

/* Hover effect */
#navbar a:hover,
#navbar button:hover {
    background-color: #e0e0e0; /* slightly darker */
    color: #000;
    border-color: #bbb;
}

/* Active page highlight */
#navbar a.active {
    background-color: #d0d0d0;
    font-weight: bold;
    border-color: #bbb;
}

/* Remove outline on focus */
#navbar button:focus {
    outline: none;
}

/* Navbar user info */
#user-info-link {
    display: flex;
    align-items: center;
    gap: 8px;
}

.navbar-role-badge {
    background: #007bff;
    color: white !important;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

#user-info-link:hover .navbar-role-badge {
    background: #0056b3;
}

/* Push content below fixed navbar */
body {
    padding-top: var(--navbar-height);
}

img {
    max-width: 100%;
    /* never exceed the width of the container */
    height: auto;
    /* keep aspect ratio */
    display: block;
    /* remove tiny gaps under image */
}

/* Dropdown container */
.dropdown {
    position: relative;
}

/* Dropdown button (same look as links) */
.dropdown-toggle {
    background: inherit;
}

/* Dropdown menu */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #f2f2f2;
    min-width: 160px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border-radius: 4px;
    padding: 5px 0;
    z-index: 1001;
}

/* Dropdown items */
.dropdown-menu a {
    display: block;
    padding: 8px 12px;
    margin: 0;
    white-space: nowrap;
}

/* Hover shows dropdown */
.dropdown:hover .dropdown-menu {
    display: block;
}

/* Hover effect on dropdown items */
.dropdown-menu a:hover {
    background-color: #e0e0e0;
}

/*------------------------CHAT--------------------------------*/
#chat-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease;
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

#chat-sidebar.open {
    right: 0;
}

/* Header section with search - 30% height */
.chat-header {
    padding: 15px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
    position: relative;
}

#chat-user-search {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

#chat-user-search:focus {
    outline: none;
    border-color: #007bff;
}

/* Custom dropdown styling */
.custom-select-wrapper {
    position: relative;
}

#chat-user-search-dropdown {
    display: none;
    border: 1px solid #ccc;
    max-height: 200px;
    overflow-y: auto;
    width: calc(100% - 30px);
    background: white;
    position: absolute;
    z-index: 10000;
    left: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

#chat-user-search-dropdown div {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

#chat-user-search-dropdown div:hover {
    background-color: #f0f0f0;
}

/* Conversations list - fills remaining space */
#chat-conversations {
    flex: 1;
    overflow-y: auto;
    background: #ffffff;
}

/* Chat window container - fills remaining space */
#chat-window {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: #fafafa;
}

#chat-window.hidden {
    display: none;
}

/* Messages area - scrollable, takes up available space */
#chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Message bubbles */
.message-me,
.message-them {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-me {
    align-self: flex-end;
    background: #007bff;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-them {
    align-self: flex-start;
    background: #e9ecef;
    color: #333;
    border-bottom-left-radius: 4px;
}

/* Chat input area - fixed at bottom */
.chat-input {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #ffffff;
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
}

#chat-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
}

#chat-input:focus {
    border-color: #007bff;
}

#send-chat {
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

#send-chat:hover {
    background: #0056b3;
}

#send-chat:active {
    background: #004494;
}

/* Scrollbar styling */
#chat-conversations::-webkit-scrollbar,
#chat-messages::-webkit-scrollbar,
#chat-user-search-dropdown::-webkit-scrollbar {
    width: 8px;
}

#chat-conversations::-webkit-scrollbar-track,
#chat-messages::-webkit-scrollbar-track,
#chat-user-search-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#chat-conversations::-webkit-scrollbar-thumb,
#chat-messages::-webkit-scrollbar-thumb,
#chat-user-search-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

#chat-conversations::-webkit-scrollbar-thumb:hover,
#chat-messages::-webkit-scrollbar-thumb:hover,
#chat-user-search-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Unread badge on navbar chat button */
.unread-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #dc3545;
    color: white;
    font-size: 11px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    padding: 0 4px;
    box-sizing: border-box;
}

/* Per-conversation unread dot */
.conversation-unread-badge {
    width: 10px;
    height: 10px;
    background: #dc3545;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Conversation item layout */
.conversation-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
    font-size: 14px;
    color: #333;
}

.conversation-item:hover {
    background-color: #f5f5f5;
}

.conversation-item:active {
    background-color: #e8e8e8;
}

/* Chat window header with back button */
.chat-window-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.chat-window-header button {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    color: #333;
}

.chat-window-header button:hover {
    color: #007bff;
}

/* Message wrappers for bubble + timestamp */
.message-wrapper-me,
.message-wrapper-them {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.message-wrapper-me {
    align-self: flex-end;
    align-items: flex-end;
}

.message-wrapper-them {
    align-self: flex-start;
    align-items: flex-start;
}

/* Message timestamp */
.message-timestamp {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
    padding: 0 4px;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    #chat-sidebar {
        right: -100%;
        width: 100%;
    }
    
    #chat-sidebar.open {
        right: 0;
    }
}
/*------------------------------------------------------------*/