/**
 * Foro Avianuncios - Estilos CSS
 * Diseño tipo panel social/comunidad
 */

/* ==================== Variables y Reset ==================== */
:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --primary-light: #C8E6C9;
    --secondary-color: #2196F3;
    --accent-color: #FF9800;
    --danger-color: #f44336;
    --success-color: #4CAF50;
    --warning-color: #ff9800;
    
    --bg-color: #f5f7fa;
    --bg-white: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #f0f2f5;
    --bg-sidebar: #fafbfc;
    
    --text-primary: #1a1a2e;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-link: #2196F3;
    
    --border-color: #e2e8f0;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    
    --header-height: 64px;
    --sidebar-width: 280px;
    --chat-width: 340px;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

input, textarea, select {
    font-family: inherit;
    font-size: 14px;
}

/* ==================== Header ==================== */
.forum-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 1000;
    box-shadow: var(--shadow-sm);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Botón de filtros móvil */
.mobile-filters-btn {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.mobile-filters-btn:hover {
    background: var(--primary-light);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.mobile-filters-btn svg {
    width: 18px;
    height: 18px;
}

.logo {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 40px;
    width: auto;
}

.forum-title {
    font-weight: 700;
    font-size: 18px;
    color: var(--primary-color);
    text-decoration: none;
    padding: 6px 14px;
    background: var(--bg-color);
    border-radius: var(--border-radius-sm);
    transition: all 0.2s;
}

.forum-title:hover {
    background: var(--primary-color);
    color: white;
}

.vender-btn {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
}

.vender-btn:hover {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.logo img {
    height: 36px;
    width: auto;
}

.header-center {
    flex: 1;
    max-width: 500px;
    margin: 0 32px;
}

.search-box {
    position: relative;
    width: 100%;
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 44px;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--bg-color);
    transition: all var(--transition-fast);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-white);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Resultados de búsqueda del header */
.header-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.header-search-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s;
    cursor: pointer;
}

.header-search-item:hover {
    background: #f5f5f5;
}

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

.header-search-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.header-search-avatar-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

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

.header-search-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-search-meta {
    font-size: 12px;
    color: #888;
    display: flex;
    gap: 8px;
}

.header-search-loading,
.header-search-empty {
    padding: 20px;
    text-align: center;
    color: #666;
}

.header-search-loading i {
    animation: spin 1s linear infinite;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.notification-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    transition: all var(--transition-fast);
}

.notification-btn:hover {
    background: var(--bg-hover);
}

.notification-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger-color);
    color: white;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Botón de mensajes */
.messages-btn {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.messages-btn:hover {
    background: var(--bg-hover);
}

.messages-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.messages-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--primary-color);
    color: white;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
}

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

.user-name {
    font-weight: 500;
    color: var(--text-primary);
}

.login-btn {
    padding: 8px 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.login-btn:hover {
    background: var(--primary-dark);
    color: white;
}

/* ==================== Main Container ==================== */
.forum-container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

/* ==================== Sidebar Izquierdo ==================== */
.sidebar-left {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    overflow-y: auto;
}

.new-thread-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all var(--transition-fast);
    margin-bottom: 24px;
}

.new-thread-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.new-thread-btn svg {
    width: 18px;
    height: 18px;
}

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-left: 8px;
}

.filter-list,
.category-list {
    list-style: none;
}

.filter-item,
.category-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
    font-size: 14px;
}

.filter-item:hover,
.category-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.filter-item.active,
.category-item.active {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 500;
}

.filter-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.category-emoji {
    font-size: 18px;
    flex-shrink: 0;
}

.category-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.category-count {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-color);
    padding: 2px 8px;
    border-radius: 10px;
}

/* ==================== Main Feed ==================== */
.main-feed {
    flex: 1;
    margin-left: var(--sidebar-width);
    margin-right: var(--chat-width);
    padding: 24px;
    max-width: calc(100% - var(--sidebar-width) - var(--chat-width));
}

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

.feed-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.feed-stats {
    font-size: 14px;
    color: var(--text-muted);
}

/* ==================== Thread Cards ==================== */
.threads-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ==================== AdSense en lista de temas ==================== */
.forum-adsense-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px dashed var(--border-color);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.forum-adsense-card::before {
    content: 'Publicidad';
    position: absolute;
    top: 8px;
    left: 16px;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.forum-adsense-card ins.adsbygoogle {
    width: 100%;
    max-width: 100%;
}

.thread-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.thread-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}

.thread-card.pinned {
    border-left: 4px solid var(--accent-color);
}

.thread-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    position: relative;
}

.thread-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    flex-shrink: 0;
    overflow: hidden;
}

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

.thread-meta {
    flex: 1;
}

.thread-author {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.thread-time {
    font-size: 12px;
    color: var(--text-muted);
}

.thread-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: white;
}

.thread-card-content {
    margin-bottom: 16px;
}

.thread-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.thread-preview {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.thread-card-footer {
    display: flex;
    align-items: center;
    gap: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.thread-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.thread-stat svg {
    width: 16px;
    height: 16px;
}

.thread-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    background: var(--bg-color);
}

.action-btn:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.action-btn.active {
    background: var(--primary-color) !important;
    color: white !important;
    border: 2px solid var(--primary-dark) !important;
}

.action-btn svg {
    width: 16px;
    height: 16px;
}

/* Botón de eliminar tema */
.action-btn.delete-btn {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.action-btn.delete-btn:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* ==================== Thread Detail View ==================== */
.thread-view {
    animation: fadeIn 0.3s ease;
}

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

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
    transition: all var(--transition-fast);
}

.back-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.back-btn svg {
    width: 18px;
    height: 18px;
}

.thread-detail {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.thread-detail-header {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}

.thread-detail-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 20px;
    flex-shrink: 0;
    overflow: hidden;
}

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

.thread-detail-info {
    flex: 1;
}

.thread-detail-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.thread-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.thread-detail-content {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.thread-detail-content .mention {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.thread-detail-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ==================== Replies Section ==================== */
.replies-section {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.replies-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.reply-form {
    margin-bottom: 24px;
}

.reply-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reply-input-wrapper textarea {
    flex: 1;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    resize: none;
    transition: all var(--transition-fast);
}

.reply-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.reply-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}

.file-upload-area {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.attach-btn {
    padding: 8px;
    border: none;
    background: var(--bg-hover);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.attach-btn:hover {
    background: var(--primary-color-light);
    color: var(--primary-color);
}

.attached-files {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.attached-file {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 12px;
    color: var(--text-secondary);
}

.attached-file .remove-file {
    cursor: pointer;
    color: var(--danger-color);
    font-weight: bold;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background var(--transition-fast);
}

.attached-file .remove-file:hover {
    background: var(--danger-color);
    color: white;
}

.send-reply-btn {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.send-reply-btn:hover {
    background: var(--primary-dark);
}

.send-reply-btn svg {
    width: 20px;
    height: 20px;
}

/* Archivos adjuntos en respuestas */
.reply-attachments {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.attachment-image {
    width: 100%;
}

.attachment-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text-color);
    font-size: 13px;
    transition: all var(--transition-fast);
    max-width: 300px;
}

.attachment-item:hover {
    border-color: var(--primary-color);
    background: var(--primary-color-light);
}

.attachment-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.attachment-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-size {
    color: var(--text-muted);
    font-size: 11px;
}

/* Preview de imágenes */
.image-preview {
    width: 100%;
    max-width: 600px;
    height: auto;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: block;
}

.image-preview:hover {
    transform: scale(1.01);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.replies-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ==================== AdSense en respuestas ==================== */
.reply-adsense-card {
    padding: 16px;
    background: var(--bg-white);
    border-radius: var(--border-radius-sm);
    border: 1px dashed var(--border-color);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.reply-adsense-card::before {
    content: 'Publicidad';
    position: absolute;
    top: 8px;
    left: 16px;
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reply-adsense-card ins.adsbygoogle {
    width: 100%;
    max-width: 100%;
}

.reply-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--border-radius-sm);
}

.reply-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

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

.reply-content {
    flex: 1;
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.reply-author {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.reply-time {
    font-size: 12px;
    color: var(--text-muted);
}

.reply-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
}

.reply-text .mention {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.reply-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.reply-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.reply-action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.reply-action-btn.active {
    color: var(--primary-color);
}

.reply-action-btn svg {
    width: 14px;
    height: 14px;
}

.delete-reply-btn {
    color: var(--danger-color);
}

.delete-reply-btn:hover {
    background: rgba(220, 38, 38, 0.1);
    color: var(--danger-color);
}

/* Nested replies */
.reply-children {
    margin-left: 52px;
    margin-top: 12px;
    padding-left: 16px;
    border-left: 2px solid var(--border-color);
}

/* ==================== Sidebar Derecho - Chat ==================== */
.sidebar-right {
    width: var(--chat-width);
    background: var(--bg-white);
    border-left: 1px solid var(--border-color);
    position: fixed;
    right: 0;
    top: var(--header-height);
    bottom: 0;
    display: flex;
    flex-direction: column;
}

.chat-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.chat-header h3 {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.chat-close-btn {
    display: none;
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    color: #666;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-close-btn:hover {
    background: var(--primary-color);
    color: white;
}

.online-count {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.online-dot {
    width: 8px;
    height: 8px;
    background: var(--success-color);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.chat-category-filter {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.chat-category-filter select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-color);
    cursor: pointer;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
    overflow: hidden;
}

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

.chat-message-content {
    flex: 1;
    max-width: calc(100% - 44px);
}

.chat-message-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 4px;
}

.chat-message-author {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.chat-message-time {
    font-size: 11px;
    color: var(--text-muted);
}

.chat-message-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message-text .mention {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
}

.chat-input-area {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    position: relative;
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
}

.chat-input-wrapper input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-color);
    transition: all var(--transition-fast);
}

.chat-input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-white);
}

.chat-send-btn {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.chat-send-btn:hover {
    background: var(--primary-dark);
}

.chat-send-btn svg {
    width: 18px;
    height: 18px;
}

.mention-suggestions {
    position: absolute;
    bottom: 100%;
    left: 16px;
    right: 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 8px;
}

.mention-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.mention-suggestion:hover {
    background: var(--bg-hover);
}

.online-users-panel {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    max-height: 200px;
    overflow-y: auto;
}

.online-users-panel h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.online-users-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.online-user {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: var(--bg-color);
    border-radius: 16px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.online-user.clickable {
    cursor: pointer;
}

.online-user.clickable:hover {
    background: var(--primary-color-light);
    transform: translateY(-1px);
}

.online-user.current-user {
    background: var(--warning-light);
    color: var(--warning-dark);
}

.you-label {
    font-size: 10px;
    opacity: 0.7;
    font-style: italic;
}

.user-name {
    flex: 1;
}

.online-user-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    font-weight: 600;
    overflow: hidden;
}

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

/* ==================== Modals ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal.modal-small {
    max-width: 400px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-muted);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ==================== Notifications Dropdown ==================== */
.notifications-dropdown {
    position: absolute;
    top: calc(var(--header-height) - 8px);
    right: 80px;
    width: 360px;
    max-height: 480px;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1500;
    overflow: hidden;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.notifications-header h4 {
    font-size: 16px;
    font-weight: 600;
}

.mark-all-read {
    font-size: 13px;
    color: var(--text-link);
}

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background var(--transition-fast);
    align-items: center;
}

.notification-item:hover {
    background: var(--bg-hover);
}

.notification-item.unread {
    background: rgba(76, 175, 80, 0.05);
}

.notification-icon {
    width: 16px;
    height: 16px;
    color: var(--primary-color);
    margin-left: auto;
    flex-shrink: 0;
}

.notification-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
}

.notification-text {
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
}

.notification-text strong {
    font-weight: 600;
}

.notification-time {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==================== Toast Notifications ==================== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-white);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    animation: slideInRight 0.3s ease;
}

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

.toast.success {
    border-left: 4px solid var(--success-color);
}

.toast.error {
    border-left: 4px solid var(--danger-color);
}

.toast.info {
    border-left: 4px solid var(--secondary-color);
}

.toast-message {
    flex: 1;
    font-size: 14px;
}

.toast-close {
    color: var(--text-muted);
    font-size: 18px;
}

/* ==================== Mobile Chat Toggle ==================== */
.chat-toggle-mobile {
    display: none;
    position: fixed;
    bottom: 90px; /* Por encima de la barra flotante móvil */
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    z-index: 900;
    align-items: center;
    justify-content: center;
}

.chat-toggle-mobile svg {
    width: 24px;
    height: 24px;
}

.chat-unread-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--danger-color);
    color: white;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== Loading States ==================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.load-more {
    text-align: center;
    padding: 20px;
}

.load-more-btn {
    padding: 12px 32px;
    background: var(--bg-color);
    color: var(--text-secondary);
    border-radius: 24px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.load-more-btn:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ==================== Empty States ==================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

/* ==================== Responsive ==================== */
@media (max-width: 1200px) {
    .sidebar-right {
        width: 300px;
    }
    
    .main-feed {
        margin-right: 300px;
        max-width: calc(100% - var(--sidebar-width) - 300px);
    }
    
    --chat-width: 300px;
}

@media (max-width: 1024px) {
    .sidebar-right {
        position: fixed;
        right: -100%;
        width: 100%;
        max-width: 360px;
        transition: right 0.3s ease;
        z-index: 1100;
    }
    
    .sidebar-right.open {
        right: 0;
    }
    
    .main-feed {
        margin-right: 0;
        max-width: calc(100% - var(--sidebar-width));
    }
    
    .chat-toggle-mobile {
        display: flex;
        bottom: 80px; /* Subir por encima de la barra flotante móvil */
    }
    
    .chat-close-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .vender-btn {
        display: none;
    }
    
    .sidebar-left {
        position: fixed;
        left: -100%;
        width: 280px;
        transition: left 0.3s ease;
        z-index: 1100;
    }
    
    .sidebar-left.open {
        left: 0;
    }
    
    .main-feed {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
        padding: 16px;
    }
    
    .header-center {
        display: none;
    }
    
    .header-right {
        display: flex;
    }
    
    .header-right .notification-btn,
    .header-right .messages-btn,
    .header-right .user-menu {
        display: none;
    }
    
    .mobile-filters-btn {
        display: flex;
    }
    
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1050;
        display: none;
    }
    
    .forum-header {
        padding: 0 16px;
    }
    
    .thread-card {
        padding: 16px;
    }
    
    .thread-title {
        font-size: 16px;
    }
    
    .thread-detail {
        padding: 16px;
    }
    
    .thread-detail-title {
        font-size: 20px;
    }
    
    .replies-section {
        padding: 16px;
    }
    
    .modal {
        margin: 16px;
        max-height: calc(100vh - 32px);
    }
    
    .notifications-dropdown {
        right: 10px;
        width: calc(100% - 20px);
        max-width: 360px;
    }
}

@media (max-width: 480px) {
    .thread-card-footer {
        flex-wrap: wrap;
    }
    
    .thread-actions {
        width: 100%;
        margin-left: 0;
        margin-top: 12px;
        justify-content: flex-start;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions button,
    .form-actions a {
        width: 100%;
        text-align: center;
    }
}

/* ==================== Scrollbar Styling ==================== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ==================== Selection ==================== */
::selection {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ==================== Modal de búsqueda móvil ==================== */
.mobile-search-modal {
    margin: 16px;
    width: calc(100% - 32px);
    max-width: 400px;
}

.search-box-mobile input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.search-box-mobile input:focus {
    outline: none;
    border-color: #4CAF50;
}

/* Responsive móvil */
@media (max-width: 768px) {
    /* Ocultar elementos del header en móvil */
    .header-center {
        display: none;
    }
    
    /* Ajustar el feed para el footer */
    .main-feed {
        padding-bottom: 80px;
    }
    
    /* Ajustar sidebar cuando está abierto */
    .sidebar-right.open {
        bottom: 70px;
    }
}

/* ==================== Menú contextual de mensajes del chat ==================== */
.chat-context-menu {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    padding: 8px;
    z-index: 10000;
    min-width: 200px;
    animation: fadeInScale 0.15s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

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

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    border-radius: 8px;
    transition: background 0.15s;
}

.context-menu-item:hover {
    background: #f3f4f6;
}

.context-menu-item.danger {
    color: #dc2626;
}

.context-menu-item.danger:hover {
    background: #fef2f2;
}

.context-menu-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Mensajes propios con estilo diferenciado */
.chat-message.own-message {
    background: #f0fdf4;
    border-left: 3px solid #4CAF50;
    margin-left: 8px;
}

.chat-message {
    cursor: pointer;
    transition: background 0.15s;
}

.chat-message:hover {
    background: #f9fafb;
}

.chat-message.own-message:hover {
    background: #dcfce7;
}

/* Badge de mensajes privados en la barra móvil */
.small-footer .pm-badge {
    position: absolute;
    top: 2px;
    right: 50%;
    transform: translateX(15px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #dc2626;
    color: white;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: badgePulse 0.3s ease;
}

@keyframes badgePulse {
    0% { transform: translateX(15px) scale(0); }
    50% { transform: translateX(15px) scale(1.2); }
    100% { transform: translateX(15px) scale(1); }
}

.small-footer ul li {
    position: relative;
}

/* Modal de mensaje privado */
#privateMessageModal .modal {
    max-width: 450px;
}

#privateMessageModal textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    font-family: inherit;
}

#privateMessageModal textarea:focus {
    outline: none;
    border-color: #4CAF50;
}
