/* ============================================
   FORUM STYLES - Sistema de Foro Completo
============================================ */

.forum-container {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Header del Foro */
.forum-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.forum-header-left h1 {
    font-size: 28px;
    color: #0f172a;
    margin-bottom: 4px;
}

.forum-breadcrumb {
    font-size: 13px;
    color: #64748b;
}

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

/* Barra de búsqueda */
.forum-search-bar {
    margin-bottom: 20px;
    position: relative;
    display: block;
}

.forum-search-bar input {
    padding-right: 35px !important;
}

/* Tabs del foro */
.forum-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
}

.forum-tab {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.3s;
    font-size: 14px;
}

.forum-tab:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.forum-tab.active {
    background: #2E7D9A;
    color: white;
}

/* Lista de hilos */
.forum-thread-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.forum-thread-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.forum-thread-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #2E7D9A;
}

.forum-thread-card.pinned {
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
    border-color: #fbbf24;
}

.forum-thread-header {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.forum-thread-avatar {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    flex-shrink: 0;
}

.forum-thread-info {
    flex: 1;
    min-width: 0;
}

.forum-thread-title {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.forum-category {
    display: inline-block;
    padding: 3px 10px;
    background: #e0f2fe;
    color: #0369a1;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.forum-thread-meta {
    font-size: 13px;
    color: #64748b;
}

.forum-thread-actions {
    margin-left: auto;
}

.forum-thread-preview {
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
    padding-left: 60px;
}

.forum-thread-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f1f5f9;
    padding-left: 60px;
}

.forum-thread-stats {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #64748b;
}

.forum-thread-last-reply {
    font-size: 12px;
    color: #64748b;
}

/* Vista de hilo individual */
.forum-thread-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.forum-post {
    background: white;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.forum-post.original-post {
    border: 2px solid #2E7D9A;
    box-shadow: 0 4px 12px rgba(46, 125, 154, 0.15);
}

.forum-post-sidebar {
    width: 180px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 20px;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.forum-post-avatar {
    font-size: 48px;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.forum-post-author {
    font-weight: 600;
    color: #0f172a;
    text-align: center;
    font-size: 15px;
}

.forum-post-user-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
    text-align: center;
}

.forum-post-content {
    flex: 1;
    padding: 20px;
}

.forum-post-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.forum-post-date {
    font-size: 12px;
    color: #64748b;
}

.forum-post-actions {
    display: flex;
    gap: 8px;
}

.forum-post-title {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 16px;
}

.forum-post-body {
    color: #334155;
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 16px;
}

.forum-post-signature {
    padding-top: 16px;
    margin-top: 16px;
    border-top: 1px dashed #e2e8f0;
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
}

.forum-mention {
    color: #2E7D9A;
    font-weight: 600;
    background: #e0f2fe;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Respuestas */
.forum-replies-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-top: 2px solid #e2e8f0;
    margin-top: 8px;
}

.forum-no-replies {
    text-align: center;
    padding: 40px;
    color: #64748b;
    font-style: italic;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
}

.forum-reply-form {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    margin-top: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.forum-reply-form h4 {
    margin-bottom: 12px;
    color: #0f172a;
}

.forum-locked-message {
    text-align: center;
    padding: 20px;
    background: #fef3c7;
    border: 1px solid #fde047;
    border-radius: 8px;
    color: #92400e;
    font-weight: 600;
    margin-top: 16px;
}

/* Mensajes Privados */
.forum-pm-container {
    background: white;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
}

.forum-pm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e2e8f0;
}

.forum-pm-conversation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 50px 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.forum-pm-conversation > div:first-child {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.forum-pm-conversation:hover {
    background: #f8fafc;
    border-color: #2E7D9A;
    transform: translateX(4px);
}

.forum-pm-conversation.unread {
    background: #eff6ff;
    border-color: #3b82f6;
    font-weight: 600;
}

.forum-pm-avatar {
    font-size: 20px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e2e8f0;
    flex-shrink: 0;
}

.forum-pm-info {
    flex: 1;
    min-width: 0;
}

.forum-pm-user {
    font-size: 14px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

.forum-pm-preview {
    font-size: 13px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forum-pm-date {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
    margin-right: 8px;
}

.forum-pm-actions {
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.forum-pm-conversation:hover .forum-pm-actions {
    opacity: 1;
}

.forum-pm-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.forum-pm-message {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 70%;
}

.forum-pm-message.me {
    align-self: flex-end;
    background: linear-gradient(135deg, #2E7D9A 0%, #1d5d7a 100%);
    color: white;
}

.forum-pm-message.other {
    align-self: flex-start;
    background: #f1f5f9;
    color: #1e293b;
}

.forum-pm-message-header {
    font-size: 11px;
    margin-bottom: 4px;
    opacity: 0.8;
}

.forum-pm-message-content {
    font-size: 14px;
    line-height: 1.5;
}

/* Perfil */
.forum-profile-container {
    background: white;
    border-radius: 12px;
    padding: 32px;
    border: 1px solid #e2e8f0;
}

.forum-profile-header {
    display: flex;
    gap: 24px;
    align-items: center;
    padding-bottom: 32px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 32px;
}

.forum-profile-avatar-large {
    font-size: 80px;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border: 5px solid white;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.forum-profile-info {
    flex: 1;
}

.forum-profile-info h2 {
    font-size: 32px;
    color: #0f172a;
    margin-bottom: 16px;
}

.forum-profile-stats {
    display: flex;
    gap: 32px;
}

.forum-profile-stat {
    text-align: center;
}

.forum-profile-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2E7D9A;
}

.forum-profile-stat-label {
    font-size: 13px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.forum-profile-section {
    margin-bottom: 32px;
}

.forum-profile-section h3 {
    font-size: 18px;
    color: #0f172a;
    margin-bottom: 16px;
}

.forum-avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    gap: 12px;
}

.forum-avatar-option {
    font-size: 40px;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f1f5f9;
    cursor: pointer;
    transition: all 0.2s;
    border: 3px solid transparent;
}

.forum-avatar-option:hover {
    background: #e0f2fe;
    transform: scale(1.1);
}

.forum-avatar-option.selected {
    background: linear-gradient(135deg, #2E7D9A 0%, #1d5d7a 100%);
    border-color: #2E7D9A;
    box-shadow: 0 4px 12px rgba(46, 125, 154, 0.3);
}

/* Empty state */
.forum-empty {
    text-align: center;
    padding: 80px 40px;
    color: #64748b;
}

/* Badge de notificación */
.badge-notification {
    display: inline-block;
    padding: 2px 8px;
    background: #ef4444;
    color: white;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    vertical-align: middle;
}

/* Botones de icono */
.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    transition: all 0.2s;
    border-radius: 4px;
}

.btn-icon:hover {
    background: #f1f5f9;
    transform: scale(1.1);
}

/* Responsive */
@media (max-width: 768px) {
    .forum-post {
        flex-direction: column;
    }
    
    .forum-post-sidebar {
        width: 100%;
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
    }
    
    .forum-thread-preview,
    .forum-thread-footer {
        padding-left: 0;
    }
    
    .forum-header {
        flex-direction: column;
        gap: 16px;
    }
    
    .forum-header-right {
        width: 100%;
        flex-wrap: wrap;
    }
}

/* ============================================
   PHPBB STYLE - Diseño tipo phpBB
============================================ */

/* Toolbar con búsqueda y botón */
.forum-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.forum-toolbar .forum-search-bar {
    flex: 0 0 auto;
    width: 300px;
    max-width: 300px;
    margin-bottom: 0;
    position: relative;
    display: block;
}

.forum-toolbar .forum-search-bar input {
    width: 100%;
    padding: 10px;
    padding-right: 35px !important;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
}

/* Categoría phpBB */
.phpbb-category {
    margin-bottom: 32px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.phpbb-category-header {
    background: linear-gradient(135deg, #2E7D9A 0%, #1e5a73 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.phpbb-category-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
}

.phpbb-category-icon {
    font-size: 24px;
}

.phpbb-category-stats {
    display: flex;
    gap: 8px;
    font-size: 13px;
    opacity: 0.9;
}

/* Lista de foros estilo phpBB */
.phpbb-forum-list {
    background: white;
}

.phpbb-forum-header {
    display: grid;
    grid-template-columns: 2fr 1fr 100px 100px 1.2fr;
    gap: 16px;
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
    font-size: 13px;
    color: #475569;
    text-transform: uppercase;
    align-items: center;
}

.phpbb-forum-row {
    display: grid;
    grid-template-columns: 2fr 1fr 100px 100px 1.2fr;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid #e2e8f0;
    transition: background 0.2s;
    align-items: center;
    cursor: pointer;
}

.phpbb-forum-row:hover {
    background: #f8fafc;
}

.phpbb-forum-row.phpbb-pinned {
    background: #fef3c7;
}

.phpbb-forum-row.phpbb-pinned:hover {
    background: #fde68a;
}

/* Columna de tema */
.phpbb-col-topic {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-start;
    min-width: 0;
}

.phpbb-topic-icon {
    font-size: 24px;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.phpbb-icon-pin {
    color: #f59e0b;
}

.phpbb-icon-lock {
    color: #64748b;
}

.phpbb-icon-hot {
    color: #ef4444;
}

.phpbb-icon-normal {
    color: #3b82f6;
}

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

.phpbb-topic-title {
    font-weight: 600;
    font-size: 15px;
    color: #0f172a;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phpbb-topic-preview {
    font-size: 13px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Columna de autor */
.phpbb-col-author {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    min-width: 0;
}

.phpbb-author-avatar {
    font-size: 20px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.phpbb-author-name {
    font-weight: 600;
    font-size: 14px;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phpbb-author-date {
    font-size: 12px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Columnas de estadísticas */
.phpbb-col-replies,
.phpbb-col-views {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
}

.phpbb-stat-number {
    font-size: 18px;
    font-weight: 700;
    color: #2E7D9A;
}

/* Columna de última respuesta */
.phpbb-col-lastpost {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
    min-width: 0;
}

.phpbb-lastpost-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.phpbb-lastpost-avatar {
    font-size: 18px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.phpbb-lastpost-info {
    flex: 1;
    min-width: 0;
}

.phpbb-lastpost-author {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phpbb-lastpost-date {
    font-size: 12px;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.phpbb-lastpost-none {
    font-size: 13px;
    color: #94a3b8;
    font-style: italic;
}

/* Botón ir a última respuesta */
.phpbb-goto-last {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #2E7D9A 0%, #1e5a73 100%);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(46, 125, 154, 0.2);
}

.phpbb-goto-last:hover {
    background: linear-gradient(135deg, #1e5a73 0%, #2E7D9A 100%);
    transform: translateX(2px);
    box-shadow: 0 4px 8px rgba(46, 125, 154, 0.3);
}

.phpbb-goto-last:active {
    transform: translateX(0);
}

/* Responsive */
@media (max-width: 1024px) {
    .phpbb-forum-header,
    .phpbb-forum-row {
        grid-template-columns: 2fr 1fr 80px 1fr;
    }
    
    .phpbb-col-views {
        display: none;
    }
    
    .phpbb-goto-last {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .phpbb-forum-header {
        display: none;
    }
    
    .phpbb-forum-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .phpbb-col-topic {
        grid-column: 1;
    }
    
    .phpbb-col-author,
    .phpbb-col-replies,
    .phpbb-col-lastpost {
        font-size: 12px;
        align-items: center;
    }
    
    .phpbb-col-replies,
    .phpbb-col-views {
        display: inline-flex;
        gap: 4px;
    }
    
    .phpbb-col-replies::before {
        content: "💬 ";
    }
    
    .phpbb-col-views::before {
        content: "👁️ ";
    }
    
    .phpbb-goto-last {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* Botón de seguir inline en phpBB */
.phpbb-follow-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    margin-left: 8px;
    vertical-align: middle;
}

.phpbb-follow-btn:hover {
    background: #f1f5f9;
    color: #f59e0b;
    transform: scale(1.1);
}

.phpbb-follow-btn.following {
    color: #f59e0b;
}

.phpbb-follow-btn.following:hover {
    color: #dc2626;
}

/* Estilos para citas en el foro */
.forum-quote {
    background: #f8fafc;
    border-left: 4px solid #2E7D9A;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 12px 0;
}

.forum-quote-header {
    font-weight: 600;
    color: #2E7D9A;
    font-size: 13px;
    margin-bottom: 8px;
}

.forum-quote-content {
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
    font-style: italic;
}

/* Menciones en el foro */
.forum-mention {
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}


/* ============================================
   EDITOR BBCODE PROFESIONAL
============================================ */

.bbcode-editor {
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    overflow: visible; /* Cambiado de hidden a visible para tooltips */
    background: white;
    margin-top: 50px; /* Espacio para tooltips arriba */
}

.bbcode-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 8px; /* Aumentado padding */
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid #cbd5e1;
    flex-wrap: wrap;
    position: relative;
    min-height: 56px; /* Altura mínima para evitar saltos */
}

.bbcode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    background: white;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
    position: relative;
    z-index: 1;
}

.bbcode-btn:hover {
    background: #2E7D9A;
    color: white;
    border-color: #2E7D9A;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(46, 125, 154, 0.2);
    z-index: 100; /* Asegurar que el tooltip esté encima */
}

.bbcode-btn:active {
    transform: translateY(0);
}

.bbcode-separator {
    width: 1px;
    height: 24px;
    background: #cbd5e1;
    margin: 0 4px;
}

.bbcode-preview {
    padding: 16px;
    background: #f8fafc;
    border-top: 2px solid #e2e8f0;
    min-height: 150px;
}

.bbcode-preview-header {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #cbd5e1;
    color: #2E7D9A;
    font-size: 14px;
}

.bbcode-preview-content {
    color: #334155;
    font-size: 15px;
    line-height: 1.7;
}

/* ============================================
   RENDERIZADO BBCODE MEJORADO
============================================ */

/* Citas mejoradas estilo phpBB */
.forum-quote {
    background: #f8fafc;
    border-left: 4px solid #2E7D9A;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 12px 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.forum-quote-header {
    font-weight: 600;
    color: #2E7D9A;
    font-size: 13px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.forum-quote-header::before {
    content: '💬';
    font-size: 14px;
}

.forum-quote-content {
    color: #475569;
    font-size: 14px;
    line-height: 1.6;
    font-style: italic;
    padding-left: 12px;
}

/* Citas anidadas */
.forum-quote .forum-quote {
    background: #e0f2fe;
    border-left-color: #0369a1;
    margin: 8px 0;
}

.forum-quote .forum-quote .forum-quote-header {
    color: #0369a1;
}

/* Código */
.forum-code {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    line-height: 1.6;
    overflow-x: auto;
    margin: 12px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.forum-code-header {
    color: #94a3b8;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

/* Listas BBCode */
.forum-list {
    margin: 12px 0;
    padding-left: 24px;
}

.forum-list li {
    margin: 6px 0;
    color: #334155;
    line-height: 1.6;
}

/* Enlaces */
.forum-link {
    color: #2E7D9A;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

.forum-link:hover {
    border-bottom-color: #2E7D9A;
    color: #1d5d7a;
}

/* Imágenes */
.forum-img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    display: block;
}

/* Texto con color */
.forum-colored-text {
    font-weight: 600;
}

/* Texto con tamaño */
.forum-sized-text {
    line-height: 1.4;
}

/* Texto en negrita */
.forum-bold {
    font-weight: 700;
    color: #0f172a;
}

/* Texto en cursiva */
.forum-italic {
    font-style: italic;
}

/* Texto subrayado */
.forum-underline {
    text-decoration: underline;
}

/* Texto tachado */
.forum-strikethrough {
    text-decoration: line-through;
    opacity: 0.7;
}

/* Menciones mejoradas */
.forum-mention {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    border: 1px solid #93c5fd;
    display: inline-block;
    transition: all 0.2s;
}

.forum-mention:hover {
    background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(30, 64, 175, 0.2);
}

/* Responsive para editor BBCode */
@media (max-width: 768px) {
    .bbcode-toolbar {
        gap: 2px;
        padding: 6px;
    }
    
    .bbcode-btn {
        min-width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .bbcode-separator {
        display: none;
    }
}


/* ============================================
   NUEVOS ESTILOS BBCODE - Alineación, Tablas, Spoilers, Videos
============================================ */

/* Alineación de texto */
.forum-align-left {
    text-align: left;
    margin: 8px 0;
}

.forum-align-center {
    text-align: center;
    margin: 8px 0;
}

.forum-align-right {
    text-align: right;
    margin: 8px 0;
}

.forum-align-justify {
    text-align: justify;
    margin: 8px 0;
}

/* Tablas */
.forum-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.forum-table th {
    background: linear-gradient(135deg, #2E7D9A 0%, #1e5a73 100%);
    color: white;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
}

.forum-table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    color: #334155;
    font-size: 14px;
}

.forum-table tr:last-child td {
    border-bottom: none;
}

.forum-table tr:hover {
    background: #f8fafc;
}

/* Línea separadora */
.forum-hr {
    border: none;
    border-top: 2px solid #e2e8f0;
    margin: 20px 0;
}

/* Spoilers */
.forum-spoiler {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    margin: 12px 0;
    overflow: hidden;
}

.forum-spoiler-header {
    padding: 12px 16px;
    background: #fde68a;
    color: #92400e;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.forum-spoiler-header:hover {
    background: #fcd34d;
}

.forum-spoiler-toggle {
    font-size: 12px;
    transition: transform 0.3s;
}

.forum-spoiler-header.open .forum-spoiler-toggle {
    transform: rotate(180deg);
}

.forum-spoiler-content {
    padding: 16px;
    background: #fffbeb;
    color: #78350f;
    line-height: 1.6;
}

/* Videos de YouTube */
.forum-video {
    margin: 16px 0;
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.forum-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 8px;
}

/* Tabla de ayuda BBCode */
.bbcode-help-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.bbcode-help-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}

.bbcode-help-table td:first-child {
    width: 40%;
    font-family: 'Courier New', monospace;
    background: #f8fafc;
    color: #475569;
    font-size: 13px;
}

.bbcode-help-table td:last-child {
    width: 60%;
    color: #334155;
}

.bbcode-help-table tr:last-child td {
    border-bottom: none;
}

.bbcode-help-table code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: #0f172a;
}

/* Responsive para tablas */
@media (max-width: 768px) {
    .forum-table {
        font-size: 12px;
    }
    
    .forum-table th,
    .forum-table td {
        padding: 8px;
    }
    
    .forum-video {
        margin: 12px 0;
    }
    
    .bbcode-help-table td:first-child {
        font-size: 11px;
    }
}

/* Mejoras adicionales para el editor */
.bbcode-toolbar {
    flex-wrap: wrap;
    max-height: none;
}

/* Tooltip para botones del editor - Mejorado y corregido */
.bbcode-btn {
    position: relative;
}

.bbcode-btn::before {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 12px); /* Más separación */
    left: 50%;
    transform: translateX(-50%) translateY(10px); /* Empieza más abajo */
    background: #1e293b;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10000; /* Z-index muy alto */
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    max-width: 200px;
    text-align: center;
}

.bbcode-btn::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px); /* Ajustado */
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #1e293b;
    pointer-events: none;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.bbcode-btn:hover::before,
.bbcode-btn:hover::after {
    transform: translateX(-50%) translateY(0); /* Sube a posición final */
    opacity: 1;
    visibility: visible;
}

/* Asegurar que los tooltips no se corten */
.bbcode-toolbar {
    position: relative;
    overflow: visible !important; /* Forzar visible */
}

/* Contenedor del editor también debe permitir overflow */
.forum-reply-form,
.modal-content {
    overflow: visible !important;
}

/* Tooltip para el botón goto-last */
.phpbb-goto-last {
    position: relative;
}

.phpbb-goto-last::before {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0; /* Alineado a la derecha del botón */
    transform: translateY(10px);
    background: #1e293b;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    pointer-events: none;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.phpbb-goto-last::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    right: 8px; /* Alineado con el botón */
    transform: translateY(10px);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #1e293b;
    pointer-events: none;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.phpbb-goto-last:hover::before,
.phpbb-goto-last:hover::after {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}


/* ============================================
   SELECTOR DE EMOJIS Y GIFS
============================================ */

/* Categorías de emojis */
.emoji-category {
    margin-bottom: 20px;
}

.emoji-category h4 {
    color: #2E7D9A;
    margin: 16px 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Grid de emojis */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
}

/* Botones de emoji */
.emoji-btn {
    font-size: 24px;
    padding: 8px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
}

.emoji-btn:hover {
    background: #f1f5f9;
    transform: scale(1.2);
    border-color: #2E7D9A;
    box-shadow: 0 2px 8px rgba(46, 125, 154, 0.2);
    z-index: 10;
}

.emoji-btn:active {
    transform: scale(1.1);
}

/* Buscador de emojis */
#emojiSearchInput {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

#emojiSearchInput:focus {
    outline: none;
    border-color: #2E7D9A;
    box-shadow: 0 0 0 3px rgba(46, 125, 154, 0.1);
}

/* Grid de GIFs */
.gif-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

/* Items de GIF */
.gif-item {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    transition: all 0.2s;
    background: #f8fafc;
}

.gif-item:hover {
    border-color: #2E7D9A;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(46, 125, 154, 0.3);
    z-index: 10;
}

.gif-item:active {
    transform: scale(1.02);
}

.gif-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

/* Buscador de GIFs */
#gifSearchInput {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

#gifSearchInput:focus {
    outline: none;
    border-color: #2E7D9A;
    box-shadow: 0 0 0 3px rgba(46, 125, 154, 0.1);
}

/* Contenedor de GIFs */
#gifContainer {
    min-height: 200px;
}

/* Estados vacíos */
.emoji-empty,
.gif-empty {
    text-align: center;
    padding: 40px;
    color: #64748b;
}

.emoji-empty div:first-child,
.gif-empty div:first-child {
    font-size: 48px;
    margin-bottom: 16px;
}

/* Responsive para emojis y GIFs */
@media (max-width: 768px) {
    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
        gap: 6px;
    }
    
    .emoji-btn {
        font-size: 20px;
        padding: 6px;
        min-height: 35px;
    }
    
    .gif-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }
    
    .gif-item img {
        height: 120px;
    }
}

/* Animación de carga para GIFs */
@keyframes gifLoading {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

.gif-loading {
    animation: gifLoading 1.5s ease-in-out infinite;
}


/* ============================================
   EDITOR WYSIWYG EN TIEMPO REAL
============================================ */

.wysiwyg-container {
    position: relative;
}

.wysiwyg-mode-toggle {
    display: flex;
    gap: 0;
    margin-bottom: -1px;
    position: relative;
    z-index: 2;
}

.wysiwyg-toggle-btn {
    padding: 8px 16px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-bottom: none;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 6px 6px 0 0;
}

.wysiwyg-toggle-btn:first-child {
    border-right: none;
}

.wysiwyg-toggle-btn:hover {
    background: #e2e8f0;
    color: #334155;
}

.wysiwyg-toggle-btn.active {
    background: white;
    color: #2E7D9A;
    border-bottom: 1px solid white;
    position: relative;
    z-index: 3;
}

.wysiwyg-source {
    font-family: 'Courier New', monospace;
    line-height: 1.6;
}

.wysiwyg-preview {
    line-height: 1.7;
    color: #334155;
    cursor: text;
}

.wysiwyg-preview:focus {
    outline: 2px solid #2E7D9A;
    outline-offset: -2px;
}

.wysiwyg-preview:empty::before {
    content: 'Escriu alguna cosa per veure la previsualització...';
    color: #94a3b8;
    font-style: italic;
}

/* Estilos para el contenido renderizado en el preview */
.wysiwyg-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 8px 0;
}

.wysiwyg-preview iframe {
    max-width: 100%;
    border-radius: 8px;
    margin: 8px 0;
}

.wysiwyg-preview code {
    background: #f1f5f9;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #e11d48;
}

.wysiwyg-preview pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
}

.wysiwyg-preview pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.wysiwyg-preview blockquote {
    border-left: 4px solid #2E7D9A;
    padding-left: 16px;
    margin: 12px 0;
    color: #64748b;
    font-style: italic;
}

.wysiwyg-preview a {
    color: #2E7D9A;
    text-decoration: underline;
}

.wysiwyg-preview a:hover {
    color: #1e5a73;
}

.wysiwyg-preview ul,
.wysiwyg-preview ol {
    margin: 12px 0;
    padding-left: 24px;
}

.wysiwyg-preview li {
    margin: 4px 0;
}

.wysiwyg-preview table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.wysiwyg-preview th,
.wysiwyg-preview td {
    border: 1px solid #cbd5e1;
    padding: 8px 12px;
    text-align: left;
}

.wysiwyg-preview th {
    background: #f1f5f9;
    font-weight: 600;
}

.wysiwyg-preview hr {
    border: none;
    border-top: 2px solid #e2e8f0;
    margin: 16px 0;
}

/* Animación suave al cambiar de modo */
.wysiwyg-source,
.wysiwyg-preview {
    transition: opacity 0.2s ease-in-out;
}
