/* ===== RESET AND BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', 'Inter', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background: #f8fafc;
    height: 100vh;
    overflow: hidden;
    color: #374151;
    display: grid;
    grid-template-rows: 56px 1fr;
    grid-template-columns: 200px 350px 1fr;
    grid-template-areas: 
        "header header header"
        "sidebar messages chat";
}

/* ===== HEADER ===== */
.header {
    grid-area: header;
    background: white;
    padding: 8px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 20px;
    height: 56px;
}

.logo {
    color: #3b82f6;
    font-size: 20px;
    font-weight: 700;
}

.search-bar {
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 6px 12px;
    min-width: 1000px;
    max-width: 1000px;
    justify-self: start;
    margin-left: 140px;
    height: 36px;
}
.search-icon {
    width: 16px;
    height: 16px;
    fill: #9ca3af;
    flex-shrink: 0;
}
.search-bar input {
    border: none;
    background: none;
    outline: none;
    margin-left: 8px;
    color: #6b7280;
    width: 100%;
    font-size: 14px;
}

.search-bar input::placeholder {
    color: #9ca3af;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-self: end;
}

.create-job-btn {
    background: #3b82f6;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    height: 32px;
}

.notification-icon {
    width: 16px;
    height: 16px;
    cursor: pointer;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.notification-icon:hover {
    opacity: 0.8;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.user-name {
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.dropdown-arrow {
    color: #9ca3af;
    font-size: 12px;
}

/* ===== SIDEBAR ===== */
.sidebar {
    grid-area: sidebar;
    background: white;
    border-right: 1px solid #e5e7eb;
    padding: 20px 0;
    display: grid;
    grid-template-rows: repeat(auto-fit, minmax(auto, 1fr));
    align-content: start;
    gap: 2px;
}

.fintory-section {
    margin-top: 30px;
    padding: 0 20px;
    margin-bottom: 20px;
}

.fintory-header {
    display: grid;
    grid-template-columns: 20px 1fr;
    align-items: center;
    gap: 25px;
    color: #374151;
    font-weight: 600;
    font-size: 14px;
}

.fintory-icon {
    width: 20px;
    height: 20px;
    background: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
}

.sidebar-item {
    display: grid;
    grid-template-columns: 20px 1fr;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
    cursor: pointer;
    color: #6b7280;
    font-size: 14px;
    transition: all 0.2s ease;
    margin: 1px 0;
}

.sidebar-item:hover {
    background: #f3f4f6;
    color: #374151;
}

.sidebar-item.active {
    background: #eff6ff;
    color: #3b82f6;
    border-right: 3px solid #3b82f6;
}

.sidebar-icon {
    width: 18px;
    height: 18px;
    fill: #6b7280;
    transition: fill 0.2s ease;
}

.sidebar-item:hover .sidebar-icon {
    fill: #374151;
}

.sidebar-item.active .sidebar-icon {
    fill: #3b82f6;
}

.sidebar-item.active .sidebar-icon path[fill="#74C0FC"] {
    fill: #3b82f6;
}

/* ===== MESSAGES PANEL ===== */
.messages-panel {
    grid-area: messages;
    background: white;
    border-right: 1px solid #e5e7eb;
    display: grid;
    grid-template-rows: auto 1fr;
}

.messages-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: grid;
    gap: 12px;
}

.messages-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
}

.message-count {
    background: #e5e7eb;
    color: #6b7280;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
}

.search-messages input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
}

.search-messages input:focus {
    border-color: #3b82f6;
}

.filter-dropdown select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

/* ===== MESSAGES LIST - UPDATED SECTION ===== */
.messages-list {
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    align-content: start;
    padding-right: 4px;
    max-height: calc(100vh - 200px);
    min-height: 0;
}

.message-item {
    display: grid;
    grid-template-columns: 12px 48px 1fr;
    grid-template-rows: auto auto auto;
    align-items: start;
    gap: 1px;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.2s ease;
}

.message-item:hover {
    background: #f8fafc;
}

/* Online status dot */
.message-item::before {
    content: '';
    width: 8px;
    height: 8px;
    background: transparent;
    border-radius: 50%;
    margin-top: 19px;
    justify-self: center;
    grid-column: 1;
    grid-row: 1;
}

.message-item.has-online-status::before {
    background: #22c55e;
}

/* Avatar positioning */
.message-avatar {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
    margin-top: 2px;
}

/* Message info container - spans columns 3, row 1 */
.message-info {
    grid-column: 3;
    grid-row: 1;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0px 8px;
    align-items: start;
    margin-top: 6px;
    width: 100%;
}

.sender-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
    line-height: 1.2;
    grid-column: 1;
    grid-row: 1;
}

.time {
    color: #9ca3af;
    font-size: 11px;
    font-weight: 400;
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    white-space: nowrap;
}

.job-applied {
    color: #3b82f6;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.2;
    margin: 0;
    grid-column: 1 / -1;
    grid-row: 2;
    margin-top: 0px;
    display: block;
}

/* Message preview spans from column 2 to end, row 3 */
.message-preview {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.3;
    font-weight: 400;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    grid-column: 2 / -1;
    grid-row: 3;
    margin-top: 1px;
}

/* ===== CHAT PANEL ===== */
.chat-panel {
    grid-area: chat;
    background: white;
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 20px;
}

.chat-user-info {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    gap: 12px;
}

.chat-user-details h3 {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 2px;
}

.applied-position {
    color: #3b82f6;
    font-size: 13px;
}

.chat-actions {
    display: grid;
    grid-template-columns: auto auto auto;
    align-items: center;
    gap: 12px;
}

.view-profile-btn {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #eaf3ff;
    color: #6ca0e0;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.view-profile-btn:hover {
    background: #dbeafe;
    color: #3b82f6;
}

.status-dropdown select {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
}

.chat-menu {
    display: flex;
    gap: 8px;
    color: #6b7280;
    font-size: 16px;
}

.chat-menu span {
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.chat-menu span:hover {
    background: #f3f4f6;
}

.chat-menu .menu-icon {
    width: 30px;
    height: 30px;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.chat-menu .menu-icon:hover {
    opacity: 0.8;
}

/* Thumbs-up icon - Light green background */
.chat-menu .thumbs-icon {
    background-color: #e6faf5;
}

.chat-menu .thumbs-icon:hover {
    background-color: #d1f7e6;
}

/* Close (X) icon - White background with black border */
.chat-menu .close-icon {
    background-color: white;
    border: 1px solid #000000;
}

.chat-menu .close-icon:hover {
    background-color: #f9f9f9;
}

/* Dots (More options) icon - White background */
.chat-menu .dots-icon {
    background-color: white;
    border: 1px solid #e5e7eb;
}

.chat-menu .dots-icon:hover {
    background-color: #f9f9f9;
}

/* ===== CHAT MESSAGES ===== */
.chat-messages {
    padding: 20px;
    overflow-y: auto;
    height: calc(100vh - 300px);
    background: #f9fafb;
    display: grid;
    align-content: start;
    gap: 20px;
}

.date-separator {
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
    padding: 8px;
    background: #f3f4f6;
    border-radius: 16px;
    justify-self: center;
}

.message {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    max-width: 70%;
}

.message.sent {
    justify-self: end;
    grid-template-columns: 1fr auto;
}

.message.received {
    justify-self: start;
    grid-template-columns: auto 1fr;
}

.message.received .message-avatar {
    grid-column: 1;
    order: 1;
}

.message.received .message-bubble {
    grid-column: 2;
    order: 2;
}
.message.sent .message-avatar {
    grid-column: 2;
    order: 2;
}

.message.sent .message-bubble {
    grid-column: 1;
    order: 1;
}

.message-bubble {
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: grid;
    gap: 8px;
}

.message.sent .message-bubble {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 6px;
}

.message.received .message-bubble {
    background: white;
    border-bottom-left-radius: 6px;
}

.message.sent .message-bubble p,
.message.sent .sender {
    color: white;
}

.message.sent .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.message-header {
    display: grid;
}

.sender {
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

.message-bubble p {
    line-height: 1.5;
    font-size: 14px;
    color: #374151;
    margin: 0;
}

.message-time {
    color: #9ca3af;
    font-size: 11px;
    margin-top: 4px;
}

/* ===== AVATAR STYLES ===== */
.user-avatar,
.message-avatar,
.chat-avatar {
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #f3f4f6;
    position: relative;
    background: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
}

.user-avatar {
    width: 28px;
    height: 28px;
    font-size: 12px;
}

.message-avatar {
    width: 42px;
    height: 42px;
    font-size: 14px;
}

.chat-avatar {
    width: 48px;
    height: 48px;
    font-size: 16px;
}

.company-avatar {
    background: #10b981;
}

/* Status dots */
.message-avatar.red-dot::after {
    content: '';
    position: absolute;
    top: -3px;
    right: -3px;
    width: 14px;
    height: 14px;
    background: #ef4444;
    border-radius: 50%;
    border: 2px solid white;
    z-index: 2;
}

/* ===== MESSAGE INPUT ===== */
.message-input-container {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: white;
}

.message-input {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.input-toolbar {
    display: none;
}

.message-input textarea {
    border: none;
    outline: none;
    resize: none;
    padding: 12px;
    font-family: inherit;
    font-size: 14px;
    min-height: 50px;
    max-height: 120px;
    line-height: 1.5;
    background: white;
    flex: 1;
    transition: all 0.2s ease;
}

.message-input textarea::placeholder {
    color: #9ca3af;
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: white;
    /* border-top: 1px solid #e5e7eb; */
}

.input-actions span {
    color: #6b7280;
    cursor: pointer;
    font-size: 14px;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.input-actions span:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    transform: scale(1.05);
}

.input-actions div {
    flex: 1;
}

.send-btn {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: 36px;
}

.send-btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.send-btn:active {
    transform: translateY(0);
}

.send-dropdown {
    color: white;
    cursor: pointer;
    font-size: 10px;
    width: 12px;
    height: 12px;
    margin-left: auto;
    fill: white;
}

.send-dropdown:hover {
    transform: scale(1.1);
}

.list-icon-2 {
    color: #6b7280;
    cursor: pointer;
    font-size: 14px;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
}

.list-icon-2:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    transform: scale(1.05);
}
/* ===== SCROLLBAR STYLES ===== */
.messages-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.messages-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.messages-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.messages-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1400px) {
    .search-bar {
        min-width: 600px;
        max-width: 600px;
        margin-left: 60px;
    }
}

@media (max-width: 1200px) {
    .search-bar {
        min-width: 400px;
        max-width: 400px;
        margin-left: 40px;
    }
}

@media (max-width: 1024px) {
    body {
        grid-template-columns: 200px 300px 1fr;
    }
    
    .search-bar {
        min-width: 300px;
        max-width: 300px;
        margin-left: 20px;
    }
}

@media (max-width: 768px) {
    body {
        grid-template-columns: 60px 250px 1fr;
    }
    
    .header {
        grid-template-columns: auto 1fr auto;
    }
    
    .search-bar {
        display: none;
    }
    
    .sidebar-item span:not(.sidebar-icon) {
        display: none;
    }
    
    .message {
        max-width: 85%;
    }
    
    .chat-actions {
        grid-template-columns: auto auto;
        gap: 8px;
    }
    
    .view-profile-btn {
        padding: 4px 8px;
        font-size: 12px;
    }
}