* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* Login Page */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    text-align: center;
}

.login-header {
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
    justify-content: center;
}

.login-header h1 {
    color: white;
    font-size: 2.5rem;
}

.language-selector {
    display: flex;
    gap: 8px;
    align-items: center;
}

.language-selector a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 4px 8px;
    transition: color 0.2s;
}

.language-selector a:hover,
.language-selector a.active {
    color: white;
}

.language-selector span {
    color: rgba(255,255,255,0.5);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 400px;
    max-width: 90vw;
}

.login-box h2 {
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

/* Alerts */
.alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fee;
    color: #c33;
}

.alert-success {
    background: #dfd;
    color: #393;
}

/* Dashboard Layout */
.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: white;
    padding: 15px 30px;
    border-bottom: 2px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h1 {
    color: #667eea;
    font-size: 1.5rem;
}

.topbar-right {
    display: flex;
    gap: 20px;
    align-items: center;
}

.user-info {
    font-weight: 600;
    color: #333;
}

/* Tabs */
.tabs {
    background: white;
    padding: 0 30px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

.tab {
    padding: 15px 25px;
    border: none;
    background: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: #666;
    transition: all 0.2s;
}

.tab:hover {
    color: #333;
}

.tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Content */
.content {
    flex: 1;
    padding: 40px;
}

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

.content-header h2 {
    margin: 0;
}

/* Table */
table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

table th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
}

table td {
    padding: 12px;
    border-bottom: 1px solid #e0e0e0;
}

table tr:hover {
    background: #f8f9fa;
}

.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

/* Chat Interface */
.chat-layout {
    display: flex;
    height: calc(100vh - 70px);
}

.sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.chatroom-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.chatroom-item {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.chatroom-item:hover {
    background: #f5f5f5;
}

.chatroom-item.active {
    background: #e8ebfa;
}

.chatroom-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    position: relative;
}

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

.chat-header h3 {
    margin: 0;
    flex-shrink: 0;
}

/* Search Container */
.search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-container input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-container input:focus {
    outline: none;
    border-color: #667eea;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
}

.search-result-item {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: #f8f9fa;
}

.search-result-item:last-child {
    border-bottom: none;
}

mark {
    background: #fff3cd;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: 600;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.message {
    background: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    max-width: 70%;
    transition: background-color 0.5s ease;
}

.message-own {
    background: #e8f5e9;
    margin-left: auto;
}

.message-own .message-author {
    color: #2e7d32;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
}

.message-author {
    font-weight: 600;
    color: #667eea;
}

.message-time {
    color: #999;
    cursor: help;
    position: relative;
}

.message-content {
    line-height: 1.5;
    word-wrap: break-word;
}

.message-file {
    margin-top: 8px;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    display: inline-block;
}

.message-file a {
    color: #667eea;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-file a:hover {
    text-decoration: underline;
}

.message-file-icon {
    font-size: 20px;
}

.unread-badge {
    background: #dc3545;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: auto;
}

/* Online Status Indicator */
.online-indicator {
    color: #4caf50;
    font-size: 10px;
    line-height: 1;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Message Status Indicators */
.status-icon {
    font-size: 12px;
    margin-left: 4px;
}

.status-sent {
    color: #999;
}

.status-delivered {
    color: #999;
}

.status-read {
    color: #4fc3f7;
}

.seen-by-link {
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: 14px;
}

.seen-by-link:hover {
    opacity: 1;
}

/* Message Reply */
.message-reply {
    background: rgba(0,0,0,0.05);
    border-left: 3px solid #667eea;
    padding: 6px 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    font-size: 13px;
}

.message-reply-author {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 2px;
}

.message-reply-content {
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Message Image */
.message-image {
    margin-top: 8px;
    max-width: 100%;
}

.message-image img {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
}

.message-image img:hover {
    opacity: 0.9;
}

/* Message Deleted */
.message-deleted {
    color: #999;
    font-style: italic;
}

/* Message Edited Label */
.message-edited {
    color: #999;
    font-size: 11px;
    font-style: italic;
}

/* Image Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    background: none;
    border: none;
}

/* Date Separator */
.date-separator {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.date-separator span {
    background: #f8f9fa;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 12px;
    color: #666;
    font-weight: 600;
    display: inline-block;
}

/* Message Actions */
.message-actions {
    opacity: 0;
    transition: opacity 0.2s;
    margin-top: 8px;
}

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

.message-action-btn {
    background: none;
    border: 1px solid #ddd;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    color: #666;
    transition: all 0.2s;
}

.message-action-btn:hover {
    background: #f5f5f5;
    border-color: #667eea;
    color: #667eea;
}

.message-delete-btn:hover {
    border-color: #dc3545;
    color: #dc3545;
    background: #fff5f5;
}

/* Message Reactions */
.message-reactions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.reaction-bubble {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.reaction-bubble:hover {
    background: #e8f5e9;
    border-color: #4caf50;
}

.reaction-bubble-active {
    background: #e3f2fd;
    border-color: #2196f3;
}

.reaction-bubble-active:hover {
    background: #bbdefb;
}

/* Reaction Picker */
.reaction-picker {
    position: fixed;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    gap: 4px;
}

.reaction-option {
    font-size: 24px;
    padding: 6px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
    display: inline-block;
}

.reaction-option:hover {
    background: #f5f5f5;
    transform: scale(1.2);
}

/* Scroll to Bottom Button */
.scroll-to-bottom-btn {
    position: absolute;
    bottom: 100px;
    right: 30px;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #667eea;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 100;
}

.scroll-to-bottom-btn:hover {
    background: #5568d3;
    transform: scale(1.1);
}

.scroll-to-bottom-btn span {
    line-height: 1;
}

/* Mention Suggestions */
.mention-suggestions {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 5px;
    z-index: 1000;
}

.mention-suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.mention-suggestion-item:hover,
.mention-suggestion-item.selected {
    background: #f8f9fa;
}

.mention-suggestion-item:last-child {
    border-bottom: none;
}

/* Mention Highlight in Messages */
.mention-highlight {
    background: #e3f2fd;
    color: #1976d2;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 600;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: 10px 20px;
    color: #666;
    font-size: 13px;
    font-style: italic;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
}

.message-input {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

.message-input input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.no-selection {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 1.2rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 500px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

/* Utility */
.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}
