/* Messages/Inbox Page Styles */
.messages-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 2000;
    display: none;
    overflow-y: auto;
}

.messages-container {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    position: relative;
}

/* Messages Header */
.messages-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.messages-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.messages-title {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.messages-title i {
    font-size: 20px;
}

/* Header Actions */
.messages-header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.header-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.header-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Search Bar */
.messages-search {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.search-container {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 45px 12px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    color: #333;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(138, 43, 226, 0.1);
}

.search-icon {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
}

/* Messages List */
.messages-list {
    padding: 0;
}

.messages-empty {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.messages-empty i {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.messages-empty h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #666;
}

.messages-empty p {
    font-size: 14px;
    color: #999;
    margin-bottom: 20px;
}

/* Message Item */
.message-item {
    display: flex;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

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

.message-item.unread {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.05), rgba(255, 107, 139, 0.05));
}

.message-item.active {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.1), rgba(255, 107, 139, 0.1));
}

/* User Avatar */
.message-avatar {
    position: relative;
    margin-right: 15px;
    flex-shrink: 0;
}

.avatar-img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

.message-item:hover .avatar-img {
    border-color: var(--primary);
}

.unread-indicator {
    position: absolute;
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: linear-gradient(135deg, var(--secondary), #FF4757);
    border-radius: 50%;
    border: 2px solid white;
}

/* Message Content */
.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 5px;
}

.message-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.message-badge {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

.message-time {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
}

.message-preview {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.message-preview.unread {
    color: #333;
    font-weight: 500;
}

.message-status {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    font-size: 12px;
    color: #999;
}

/* Matches Section */
.matches-section {
    padding: 20px;
    border-bottom: 1px solid #eee;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.matches-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 15px;
}

.match-item {
    text-align: center;
    cursor: pointer;
}

.match-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e0e0e0;
    transition: all 0.3s ease;
}

.match-item:hover .match-avatar {
    border-color: var(--primary);
    transform: scale(1.05);
}

.match-name {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Filter Tabs */
.messages-filter {
    display: flex;
    padding: 0 20px;
    background: white;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 70px;
    z-index: 90;
}

.filter-tab {
    flex: 1;
    text-align: center;
    padding: 15px 10px;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.filter-tab:hover {
    color: var(--primary);
}

.filter-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Loading State */
.messages-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
}

.messages-loading i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 20px;
    animation: spin 1s linear infinite;
}

/* No Messages State */
.no-messages {
    text-align: center;
    padding: 60px 20px;
}

.no-messages-icon {
    font-size: 64px;
    color: #e0e0e0;
    margin-bottom: 20px;
}

.no-messages h3 {
    font-size: 20px;
    color: #666;
    margin-bottom: 10px;
}

.no-messages p {
    font-size: 14px;
    color: #999;
    margin-bottom: 30px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.start-chatting-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
}

.start-chatting-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(138, 43, 226, 0.3);
}

/* Back Button */
.messages-back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.messages-back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 480px) {
    .message-name {
        max-width: 120px;
    }
    
    .avatar-img {
        width: 50px;
        height: 50px;
    }
    
    .matches-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 12px;
    }
    
    .match-avatar {
        width: 55px;
        height: 55px;
    }
}

/* Add to the end of your existing messages.css */

/* Badges */
.unread-badge {
    background: linear-gradient(135deg, var(--secondary), #FF4757);
    color: white;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

.filter-badge {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 5px;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #4cd964;
    border-radius: 50%;
    border: 2px solid white;
}

/* Search results */
.search-highlight {
    background-color: rgba(255, 215, 0, 0.2);
    padding: 1px 2px;
    border-radius: 3px;
}

/* Loading animation */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
