/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #0f0f0f;
    color: #e4e4e7;
    height: 100vh;
    overflow: hidden;
}

/* Chat container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    background-color: #1a1a1b;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, #2a2a2b 0%, #1a1a1b 100%);
    border-bottom: 1px solid #2a2a2b;
    padding: 1rem 1.5rem;
}

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

.chat-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.moderator-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(245, 158, 11, 0.1);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-icon {
    width: 24px;
    height: 24px;
}

.moderator-name {
    font-weight: 600;
    color: #f59e0b;
}

.moderator-role {
    font-size: 0.875rem;
    color: #a8a29e;
}

/* View controls */
.view-controls {
    display: flex;
    gap: 0.5rem;
}

.view-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: transparent;
    border: 1px solid #3a3a3b;
    border-radius: 0.5rem;
    color: #a8a29e;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
}

.view-tab:hover {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: #4a4a4b;
}

.view-tab.active {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
    color: #f59e0b;
}

.tab-icon {
    width: 16px;
    height: 16px;
}

.deleted-count {
    background-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Chat messages area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: #0f0f0f;
}

/* Custom scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #1a1a1b;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #3a3a3b;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #4a4a4b;
}

/* Message styles */
.message {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease;
}

.message:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

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

/* Deleted message styles */
.message-deleted {
    opacity: 0.6;
    position: relative;
}

.message-deleted .message-text {
    color: #6b7280;
    text-decoration: line-through;
}

.message-deleted::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: #ef4444;
}

.deleted-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.message-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
}

.message-username {
    font-weight: 600;
    color: #f59e0b;
}

.message-moderator .message-username {
    color: #10b981;
}

.message-role {
    font-size: 0.75rem;
    color: #6b7280;
    background-color: rgba(107, 114, 128, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
}

.message-time {
    font-size: 0.75rem;
    color: #6b7280;
    margin-left: auto;
}

.message-text {
    word-wrap: break-word;
    line-height: 1.5;
    color: #e4e4e7;
}

/* Message actions */
.message-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.reply-button,
.delete-button {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background-color: transparent;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reply-button {
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #f59e0b;
}

.reply-button:hover {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
}

.delete-button {
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.delete-button:hover {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.reply-button svg,
.delete-button svg {
    width: 14px;
    height: 14px;
}

/* Reply indicator */
.message-reply-to {
    background-color: rgba(245, 158, 11, 0.1);
    border-left: 3px solid #f59e0b;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

.message-reply-to-user {
    color: #f59e0b;
    font-weight: 500;
}

/* Reply bar */
.reply-bar {
    display: none;
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 0.5rem;
    align-items: center;
    justify-content: space-between;
}

.reply-bar.active {
    display: flex;
}

.reply-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.reply-info-text {
    font-size: 0.875rem;
}

.reply-info-user {
    color: #f59e0b;
    font-weight: 500;
}

.cancel-reply {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
}

.cancel-reply:hover {
    background-color: rgba(239, 68, 68, 0.1);
}

.cancel-reply svg {
    width: 16px;
    height: 16px;
}

/* Input container */
.chat-input-container {
    background-color: #1a1a1b;
    border-top: 1px solid #2a2a2b;
    padding: 1rem 1.5rem;
}

.message-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    background-color: #2a2a2b;
    border: 1px solid #3a3a3b;
    border-radius: 0.5rem;
    padding: 0.75rem;
    color: #e4e4e7;
    font-size: 1rem;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
    max-height: 120px;
    line-height: 1.5;
}

.message-input:focus {
    border-color: #f59e0b;
}

.message-input::placeholder {
    color: #6b7280;
}

.send-button {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

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

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-button svg {
    width: 20px;
    height: 20px;
    color: white;
}

.char-counter {
    text-align: right;
    font-size: 0.75rem;
    color: #6b7280;
}

.char-counter.warning {
    color: #f59e0b;
}

.char-counter.danger {
    color: #ef4444;
}

/* Loading spinner */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #2a2a2b;
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* System message */
.message-system {
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    padding: 0.75rem;
    border-radius: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    color: #f59e0b;
}

/* Responsive design */
@media (max-width: 768px) {
    .chat-header h1 {
        font-size: 1.25rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .chat-messages {
        padding: 1rem;
    }
    
    .message {
        padding: 0.5rem;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
    }
    
    .chat-input-container {
        padding: 0.75rem;
    }
}
