/**
 * Chat page styles
 */

body.chat-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.chat-page footer {
    background: #1a1a2e;
}

/* Chat container */
.chat-wrapper {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* Chat header */
.chat-header-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-header-bar h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.chat-header-bar .online-indicator {
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse-online 2s infinite;
}

@keyframes pulse-online {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Chat messages container */
#chat-messages {
    height: 60vh;
    min-height: 400px;
    max-height: 600px;
    overflow-y: auto;
    background: #fafafa;
}

/* Chat message */
.chat-message {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid #eee;
    transition: background 0.15s;
}

.chat-message:hover {
    background-color: #f0f4ff;
}

.chat-message:last-child {
    border-bottom: none;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.chat-username {
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
}

.chat-username:hover {
    text-decoration: underline;
}

.chat-time {
    font-size: 0.7rem;
    color: #9ca3af;
    margin-left: auto;
}

.chat-text {
    margin-left: 2.5rem;
    line-height: 1.6;
    word-break: break-word;
    color: #374151;
}

/* Reply preview in message */
.reply-preview {
    margin: 0.25rem 0 0.5rem 2.25rem;
    padding: 0.5rem 0.75rem;
    background: #e9ecef;
    border-left: 3px solid #0d6efd;
    border-radius: 0.25rem;
    font-size: 0.85rem;
}

.reply-preview .reply-to {
    font-weight: 600;
    color: #0d6efd;
    font-size: 0.8rem;
}

.reply-preview .reply-text {
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

/* Reply actions */
.chat-actions {
    margin-left: auto;
    opacity: 0;
    transition: opacity 0.15s;
}

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

.btn-reply {
    font-size: 0.75rem;
    color: #6c757d;
    text-decoration: none;
    cursor: pointer;
}

.btn-reply:hover {
    color: #0d6efd;
}

/* @mentions highlight */
.mention {
    color: #0d6efd;
    font-weight: 600;
    background: rgba(13, 110, 253, 0.08);
    padding: 0 2px;
    border-radius: 2px;
}

/* Reply form preview */
#reply-preview-bar {
    display: none;
    background: linear-gradient(135deg, #e0e7ff 0%, #ede9fe 100%);
    border: 1px solid #c7d2fe;
    border-bottom: none;
    border-radius: 0.5rem 0.5rem 0 0;
    padding: 0.5rem 1rem;
    align-items: center;
    justify-content: space-between;
}

#reply-preview-bar.show {
    display: flex;
}

#reply-preview-bar .reply-info {
    flex: 1;
}

#reply-preview-bar .reply-to {
    font-weight: 600;
    color: #0d6efd;
    font-size: 0.85rem;
}

#reply-preview-bar .reply-text {
    color: #495057;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 500px;
}

/* Ban alert */
.ban-alert {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

/* Tribute.js dropdown */
.tribute-container {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #fff;
}

.tribute-container ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tribute-container li {
    padding: 0.5rem 1rem;
    cursor: pointer;
}

.tribute-container li.highlight {
    background: #e7f1ff;
}

.tribute-container li .username {
    font-weight: 600;
    color: #0d6efd;
}

.tribute-container li .display-name {
    color: #6c757d;
    font-size: 0.85rem;
}

/* Highlight animation for scrolled-to message */
@keyframes message-highlight {
    0% { background: #fff3cd; box-shadow: 0 0 0 3px #ffc107; }
    50% { background: #fff3cd; box-shadow: 0 0 0 3px #ffc107; }
    100% { background: transparent; box-shadow: none; }
}

.chat-message.highlighted {
    animation: message-highlight 2.5s ease-in-out;
    border-radius: 0.5rem;
}

/* Scroll to bottom button */
#scroll-to-bottom {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    z-index: 10;
    border-radius: 2rem;
    padding: 0.5rem 1rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
}

#scroll-to-bottom:hover {
    transform: translateX(-50%) scale(1.05);
    color: white;
}

#scroll-to-bottom.show {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: pulse-scroll 2s infinite;
}

@keyframes pulse-scroll {
    0%, 100% { box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4); }
    50% { box-shadow: 0 4px 25px rgba(102, 126, 234, 0.6); }
}

/* Loading indicator */
.chat-loading {
    text-align: center;
    padding: 1rem;
    color: #6c757d;
}

.chat-loading .spinner {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #dee2e6;
    border-top-color: #0d6efd;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

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

/* Chat container for relative positioning */
#chat-container {
    position: relative;
}

/* Chat input form */
.chat-input-wrapper {
    padding: 1rem 1.25rem;
    background: #fff;
    border-top: 1px solid #eee;
}

#chat-form .input-group {
    border-radius: 2rem;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

#chat-form .form-control {
    border: none;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
}

#chat-form .form-control:focus {
    box-shadow: none;
}

#chat-form .btn-primary {
    border-radius: 0 2rem 2rem 0;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

#chat-form .btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd6 0%, #6a4190 100%);
}

.chat-form-hint {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.5rem;
    margin-left: 1rem;
}
