/* Messages System Styling */

/* Messages Layout */
.messages-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    height: calc(100vh - 200px);
    min-height: 600px;
	padding-top: 30px;
	padding-bottom: 30px;
}

/* Conversations Sidebar */
.conversations-sidebar {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.unread-badge {
    background: #ff4757;
    color: white;
    border-radius: 50%;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 10px;
}

.conversation-search {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.conversation-search input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.9rem;
}

.search-btn {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.conversation-item.active {
    background-color: #e3f2fd;
    border-right: 3px solid #007bff;
}

.conversation-avatar {
    position: relative;
    margin-right: 12px;
}

.conversation-avatar img,
.conversation-avatar .avatar-placeholder {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-placeholder {
    background-image: url('/assets/images/avatar-placeh.png');
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

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

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.conversation-header h4 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 0.8rem;
    color: #666;
    white-space: nowrap;
}

.conversation-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversation-preview p {
    margin: 0;
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.unread-count {
    background: #ff4757;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: bold;
    margin-left: 8px;
}

/* Messages Main Area */
.messages-main {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
	padding: 25px;
}

.conversation-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversation-user {
    display: flex;
    align-items: center;
}

.user-avatar {
    position: relative;
    margin-right: 15px;
}

.user-avatar img,
.user-avatar .avatar-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.user-info h3 {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    color: #333;
}

.user-status {
    font-size: 0.85rem;
    color: #666;
}

.conversation-actions {
    display: flex;
    gap: 10px;
}

.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 150px;
    z-index: 1000;
    display: none;
}

.dropdown.show .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 10px 15px;
    color: #333;
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item.text-danger {
    color: #dc3545;
}

.dropdown-divider {
    height: 1px;
    background: #eee;
    margin: 5px 0;
}

/* Messages List */
.messages-list {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.no-messages i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 15px;
}

.message {
    display: flex;
    gap: 12px;
    max-width: 70%;
}

.message.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.other {
    align-self: flex-start;
}

.message-avatar img,
.message-avatar .avatar-placeholder {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    background: #f8f9fa;
    border-radius: 18px;
    padding: 12px 16px;
    position: relative;
    max-width: 100%;
}

.message.own .message-content {
    background: #007bff;
    color: white;
}

.message-reply {
    background: rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 0.85rem;
    border-left: 3px solid #007bff;
}

.message-text {
    word-wrap: break-word;
    line-height: 1.4;
}

.message-attachment {
    margin-top: 8px;
}

.attachment-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
}

.attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #007bff;
    text-decoration: none;
    padding: 8px 12px;
    background: rgba(0,123,255,0.1);
    border-radius: 8px;
    font-size: 0.9rem;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 0.75rem;
    opacity: 0.7;
}

.message-read-status {
    color: #2ed573;
}

.message-edited {
    font-style: italic;
}

.message-reactions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.reaction {
    background: rgba(0,0,0,0.1);
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
}

.message-actions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-actions {
    opacity: 1;
}

.reactions-menu {
    display: flex;
    gap: 5px;
    padding: 10px;
}

.reactions-menu button {
    background: none;
    border: none;
    font-size: 1.2rem;
    padding: 5px;
    border-radius: 4px;
    cursor: pointer;
}

.reactions-menu button:hover {
    background: #f0f0f0;
}

/* Message Compose */
.message-compose {
    padding: 20px;
    border-top: 1px solid #eee;
}

.reply-indicator {
    background: #e3f2fd;
    border-left: 3px solid #007bff;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
}

.replying-to {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.message-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.compose-input {
    flex: 1;
}

.compose-input textarea {
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 12px 16px;
    resize: none;
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.4;
}

.compose-input textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Compose Page */
.compose-container {
    min-height: 100vh;
    background: #f8f9fa;
}

.compose-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 0;
}

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

.header-text h1 {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    font-weight: 600;
	color:#fff;
}

.header-text p {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
	color:#fff;
}

.compose-content {
    padding: 40px 0;
}

.compose-form-container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    padding: 40px;
}

.compose-form .form-group {
    margin-bottom: 25px;
}

.compose-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.compose-form .form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.compose-form .form-control:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

.message-compose-tools {
    margin-bottom: 10px;
}

.compose-toolbar {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
}

.character-count {
    text-align: right;
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
}

.attachment-preview {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.attachment-name {
    flex: 1;
    font-size: 0.9rem;
    color: #333;
}

.remove-attachment {
    color: #dc3545;
}

.message-options {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check-input {
    margin: 0;
}

.form-check-label {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Notifications */
.notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    background: white;
    border-radius: 8px;
    padding: 15px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.notification-success {
    border-left: 4px solid #2ed573;
}

.notification-error {
    border-left: 4px solid #ff4757;
}

.notification-info {
    border-left: 4px solid #007bff;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Emoji Picker */
.emoji-picker {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
    margin-bottom: 10px;
}

.emoji-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.emoji-btn:hover {
    background: #f0f0f0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .messages-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .conversations-sidebar {
        order: 2;
        max-height: 300px;
    }
    
    .messages-main {
        order: 1;
        min-height: 500px;
    }
    
    .message {
        max-width: 85%;
    }
    
    .compose-form-container {
        margin: 0 15px;
        padding: 25px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .message-options {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .conversations-sidebar {
        border-radius: 0;
    }
    
    .messages-main {
        border-radius: 0;
    }
    
    .message {
        max-width: 95%;
    }
    
    .conversation-item {
        padding: 12px 15px;
    }
    
    .compose-toolbar {
        flex-wrap: wrap;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .conversations-sidebar,
    .messages-main,
    .compose-form-container {
        background: #2c3e50;
        color: #ecf0f1;
    }
    
    .conversation-item:hover {
        background-color: #34495e;
    }
    
    .conversation-item.active {
        background-color: #3498db;
    }
    
    .message-content {
        background: #34495e;
        color: #ecf0f1;
    }
    
    .message.own .message-content {
        background: #3498db;
    }
    
    .form-control {
        background: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .notification {
        background: #2c3e50;
        color: #ecf0f1;
    }
}