/* ===== Advanced Forum Features CSS ===== */

/* Topic preview tooltip */
.topic-preview-box {
    position: absolute;
    z-index: 1000;
    background: #fff;
    border: 2px solid #003399;
    border-radius: 6px;
    padding: 12px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.2s;
}
body.theme-dark .topic-preview-box {
    background: #1f2937;
    border-color: #60a5fa;
}
.preview-loading {
    color: #6b7280;
    font-size: 11px;
    font-style: italic;
}
.preview-header {
    font-weight: bold;
    font-size: 12px;
    color: #003399;
    margin-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 6px;
}
body.theme-dark .preview-header {
    color: #60a5fa;
    border-bottom-color: #374151;
}
.preview-meta {
    font-size: 10px;
    color: #6b7280;
    margin-bottom: 8px;
    display: flex;
    gap: 12px;
}
body.theme-dark .preview-meta {
    color: #9ca3af;
}
.preview-content {
    font-size: 11px;
    color: #374151;
    line-height: 1.5;
    max-height: 150px;
    overflow: hidden;
    position: relative;
}
body.theme-dark .preview-content {
    color: #e5e7eb;
}
.preview-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, transparent, #fff);
}
body.theme-dark .preview-content::after {
    background: linear-gradient(to bottom, transparent, #1f2937);
}

/* New posts badge */
.new-posts-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 12px;
    margin-left: 8px;
    background: #3b82f6;
    color: #fff;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Image lightbox */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
}
.lightbox-content {
    position: relative;
    z-index: 10000;
    max-width: 90vw;
    max-height: 90vh;
}
.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    display: block;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}
.lightbox-close:hover {
    transform: scale(1.1);
    background: #f3f4f6;
}

/* Mention autocomplete */
.mention-autocomplete {
    position: absolute;
    z-index: 1000;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 200px;
    max-height: 150px;
    overflow-y: auto;
}
body.theme-dark .mention-autocomplete {
    background: #1f2937;
    border-color: #374151;
}
.autocomplete-item {
    padding: 6px 12px;
    font-size: 11px;
    cursor: pointer;
    color: #374151;
    transition: background 0.15s;
}
body.theme-dark .autocomplete-item {
    color: #e5e7eb;
}
.autocomplete-item:hover {
    background: #f0f4ff;
    color: #003399;
}
body.theme-dark .autocomplete-item:hover {
    background: #374151;
    color: #60a5fa;
}

/* User stats in author panel */
.user-stats {
    font-size: 9px;
    color: #6b7280;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #d1d5db;
}
body.theme-dark .user-stats {
    color: #9ca3af;
    border-top-color: #374151;
}
.user-stats div {
    margin: 3px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.user-stats .stat-label {
    color: #9ca3af;
}
body.theme-dark .user-stats .stat-label {
    color: #6b7280;
}
.user-stats .stat-value {
    font-weight: bold;
    color: #003399;
}
body.theme-dark .user-stats .stat-value {
    color: #60a5fa;
}

/* Reputation bar */
.reputation-bar {
    width: 100%;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin: 6px 0;
    overflow: hidden;
}
body.theme-dark .reputation-bar {
    background: #374151;
}
.reputation-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
    transition: width 0.3s;
}

/* Online status indicator */
.online-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    margin-left: 4px;
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
    animation: blink 2s infinite;
}
.online-status.offline {
    background: #6b7280;
    box-shadow: none;
    animation: none;
}
@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Quick reply enhancement */
.quick-reply-toggle {
    display: inline-block;
    padding: 4px 10px;
    margin-left: 8px;
    font-size: 10px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}
body.theme-dark .quick-reply-toggle {
    background: #374151;
    border-color: #4b5563;
}
.quick-reply-toggle:hover {
    background: #e5e7eb;
    border-color: #003399;
}
body.theme-dark .quick-reply-toggle:hover {
    background: #4b5563;
    border-color: #60a5fa;
}

/* Sticky topic indicator */
.topic-row.pinned {
    background: #fef3c7 !important;
}
body.theme-dark .topic-row.pinned {
    background: #422006 !important;
}
.topic-row.pinned .topic-title::before {
    content: "📌 ";
}

/* Hot topic indicator */
.topic-row.hot .topic-title::after {
    content: "🔥";
    margin-left: 6px;
}

/* Locked topic indicator */
.topic-row.locked .topic-title::after {
    content: "🔒";
    margin-left: 6px;
}

/* Forum statistics sidebar */
.forum-stats-sidebar {
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e8ff 100%);
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
}
body.theme-dark .forum-stats-sidebar {
    background: linear-gradient(135deg, #1e3a5f 0%, #152844 100%);
    border-color: #374151;
}
.forum-stats-sidebar h3 {
    font-size: 12px;
    font-weight: bold;
    color: #003399;
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #d1d5db;
}
body.theme-dark .forum-stats-sidebar h3 {
    color: #60a5fa;
    border-bottom-color: #374151;
}
.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 10px;
    color: #374151;
}
body.theme-dark .stat-item {
    color: #e5e7eb;
}
.stat-item .stat-number {
    font-weight: bold;
    color: #003399;
}
body.theme-dark .stat-item .stat-number {
    color: #60a5fa;
}

/* Active users list */
.active-users-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.active-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: transform 0.2s;
}
.active-user-avatar:hover {
    transform: scale(1.2);
    z-index: 10;
}

/* Sorting and filter controls */
.forum-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}
body.theme-dark .forum-controls {
    background: #1f2937;
    border-color: #374151;
}
.forum-controls select {
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
}
body.theme-dark .forum-controls select {
    background: #111827;
    border-color: #374151;
    color: #e5e7eb;
}

/* Search box */
.forum-search {
    position: relative;
    flex: 1;
    max-width: 300px;
}
.forum-search input {
    width: 100%;
    padding: 6px 32px 6px 12px;
    font-size: 11px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
}
body.theme-dark .forum-search input {
    background: #111827;
    border-color: #374151;
    color: #e5e7eb;
}
.forum-search input:focus {
    outline: none;
    border-color: #003399;
    box-shadow: 0 0 0 3px rgba(0, 51, 153, 0.1);
}
body.theme-dark .forum-search input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}
.forum-search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Smooth transitions */
.forum-post,
.forum-tbl tbody tr,
.forum-btn,
.post-actions a {
    transition: all 0.2s ease;
}

/* Keyboard shortcut hints */
.keyboard-hint {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 10px;
    z-index: 1000;
    animation: fadeIn 0.3s;
}
.keyboard-hint kbd {
    background: #374151;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    margin: 0 2px;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .topic-preview-box {
        max-width: calc(100vw - 40px);
        left: 20px !important;
    }
    
    .forum-controls {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .forum-search {
        max-width: 100%;
    }
    
    .forum-stats-sidebar {
        margin-bottom: 12px;
    }
}
