/* ==========================================================================
   FORO TÉCNICO PROFESIONAL - ESTILOS E INTERACTIVIDAD
   Plataforma comunitaria de Electricidad, Automatización, Control y Electrónica
   ========================================================================== */

:root {
    --foro-primary: #0b2b4f;
    --foro-primary-light: #16406f;
    --foro-accent: #1a6fb5;
    --foro-accent-glow: rgba(26, 111, 181, 0.2);
    --foro-gold: #f7a81b;
    --foro-bg: #f5f7fa;
    --foro-card-bg: #ffffff;
    --foro-border: #e2e8f0;
    --foro-border-hover: #cbd5e1;
    --foro-text-main: #1e293b;
    --foro-text-muted: #64748b;
    --foro-danger: #ef4444;
    --foro-danger-bg: #fef2f2;
    --foro-warning: #f59e0b;
    --foro-warning-bg: #fffbeb;
    --foro-success: #10b981;
    --foro-success-bg: #ecfdf5;
}

/* Contenedor principal */
.foro-wrapper {
    background-color: var(--foro-bg);
    min-height: 80vh;
    padding: 2.5rem 0 4rem 0;
}

.foro-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* Banner de Cabecera y Estadísticas */
.foro-hero-card {
    background: linear-gradient(135deg, #0b2b4f 0%, #153e6b 50%, #1a6fb5 100%);
    border-radius: 18px;
    padding: 2.2rem 2.5rem;
    color: #ffffff;
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(11, 43, 79, 0.15);
    position: relative;
    overflow: hidden;
}

.foro-hero-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(247, 168, 27, 0.15) 0%, rgba(255,255,255,0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.foro-hero-title {
    font-size: 2.1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.foro-hero-title .fa-bolt {
    color: var(--foro-gold);
    filter: drop-shadow(0 0 8px rgba(247, 168, 27, 0.6));
}

.foro-hero-subtitle {
    font-size: 1.05rem;
    color: #e2e8f0;
    max-width: 780px;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Buscador Rápido */
.foro-search-bar {
    position: relative;
    max-width: 680px;
    margin-bottom: 1.5rem;
}

.foro-search-bar input {
    width: 100%;
    padding: 0.95rem 1.2rem 0.95rem 3.2rem;
    border-radius: 50px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.96);
    color: #1e293b;
    font-size: 1.02rem;
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
    transition: all 0.25s ease;
}

.foro-search-bar input:focus {
    background: #ffffff;
    border-color: var(--foro-gold);
    outline: none;
    box-shadow: 0 8px 24px rgba(247, 168, 27, 0.25);
}

.foro-search-bar .search-icon {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-size: 1.2rem;
}

.foro-search-bar .clear-search {
    position: absolute;
    right: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    cursor: pointer;
    display: none;
}

.foro-search-bar .clear-search:hover {
    color: #ef4444;
}

/* Contadores y Badges del Hero */
.foro-stats-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    margin-top: 1rem;
}

.foro-stat-pill {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.45rem 1rem;
    border-radius: 30px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #f1f5f9;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.foro-stat-pill strong {
    color: var(--foro-gold);
    font-weight: 700;
}

/* Barra de Herramientas y Filtros */
.foro-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.8rem;
    scroll-margin-top: 90px;
}

.foro-cat-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cat-tab-btn {
    padding: 0.55rem 1.1rem;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--foro-text-muted);
    background: #ffffff;
    border: 1px solid var(--foro-border);
    cursor: pointer;
    text-decoration: none !important;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: all 0.2s ease;
}

.cat-tab-btn:hover {
    background: #f8fafc;
    color: var(--foro-accent);
    border-color: var(--foro-accent);
}

.cat-tab-btn.active {
    background: var(--foro-primary);
    color: #ffffff;
    border-color: var(--foro-primary);
    box-shadow: 0 4px 12px rgba(11, 43, 79, 0.2);
}

.cat-tab-btn.active .fa {
    color: var(--foro-gold);
}

.btn-crear-tema {
    background: linear-gradient(135deg, #f7a81b 0%, #e5930a 100%);
    color: #0b2b4f !important;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.65rem 1.4rem;
    border-radius: 30px;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px rgba(247, 168, 27, 0.35);
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none !important;
}

.btn-crear-tema:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(247, 168, 27, 0.45);
    color: #000000 !important;
}

/* Estructura de 2 Columnas */
.foro-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.8rem;
}

@media (max-width: 991px) {
    .foro-layout {
        grid-template-columns: 1fr;
    }
}

/* Tarjetas de Temas (Listado) */
.foro-topics-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.topic-card {
    background: var(--foro-card-bg);
    border: 1px solid var(--foro-border);
    border-radius: 14px;
    padding: 1.35rem 1.6rem;
    transition: all 0.22s ease-in-out;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    border-left: 5px solid #cbd5e1;
}

.topic-card:hover {
    border-color: var(--foro-border-hover);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.06);
    transform: translateY(-2px);
}

/* Acentos de categoría en borde izquierdo */
.topic-card.cat-border-electricidad { border-left-color: #f7a81b; }
.topic-card.cat-border-automatizacion { border-left-color: #0284c7; }
.topic-card.cat-border-electronica { border-left-color: #8b5cf6; }
.topic-card.cat-border-fotovoltaico { border-left-color: #10b981; }
.topic-card.cat-border-terreno { border-left-color: #ea580c; }
.topic-card.cat-border-hogar { border-left-color: #059669; }
.topic-card.cat-border-estudiantil { border-left-color: #6366f1; }
.topic-card.cat-border-general { border-left-color: #64748b; }

.topic-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.topic-badge-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.badge-cat {
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.badge-cat.cat-electricidad { background: #fef3c7; color: #92400e; }
.badge-cat.cat-automatizacion { background: #e0f2fe; color: #0369a1; }
.badge-cat.cat-electronica { background: #ede9fe; color: #6d28d9; }
.badge-cat.cat-fotovoltaico { background: #d1fae5; color: #065f46; }
.badge-cat.cat-terreno { background: #ffedd5; color: #c2410c; }
.badge-cat.cat-hogar { background: #d1fae5; color: #047857; }
.badge-cat.cat-estudiantil { background: #e0e7ff; color: #4338ca; }
.badge-cat.cat-general { background: #f1f5f9; color: #334155; }

.badge-pinned {
    background: #fee2e2;
    color: #b91c1c;
    font-size: 0.74rem;
    font-weight: 700;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.topic-time {
    font-size: 0.82rem;
    color: var(--foro-text-muted);
}

.topic-title {
    font-size: 1.22rem;
    font-weight: 600;
    color: var(--foro-primary);
    margin: 0;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.topic-title a {
    color: inherit;
    text-decoration: none;
}

.topic-title a:hover {
    color: var(--foro-accent);
}

.topic-excerpt {
    font-size: 0.94rem;
    color: #475569;
    line-height: 1.55;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.tag-pill {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.75rem;
    padding: 0.18rem 0.5rem;
    border-radius: 4px;
}

.topic-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #e2e8f0;
}

.topic-author {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a6fb5 0%, #0b2b4f 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
}

.author-meta {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
}

.author-role {
    font-size: 0.75rem;
    color: #64748b;
}

.topic-metrics {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    font-size: 0.84rem;
    color: var(--foro-text-muted);
}

.metric-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.metric-btn-like {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 0.2rem 0.6rem;
    color: #475569;
    cursor: pointer;
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
}

.metric-btn-like:hover, .metric-btn-like.liked {
    background: #eff6ff;
    border-color: #93c5fd;
    color: var(--foro-accent);
}

.metric-btn-like.liked .fa {
    color: #2563eb;
}

/* Sidebar del Foro */
.foro-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-box {
    background: #ffffff;
    border: 1px solid var(--foro-border);
    border-radius: 14px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.sidebar-title {
    font-size: 1.08rem;
    font-weight: 700;
    color: var(--foro-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.rule-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.88rem;
    line-height: 1.5;
    color: #334155;
}

.rule-icon-warn {
    color: #ef4444;
    font-size: 1rem;
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.rule-icon-ok {
    color: #10b981;
    font-size: 1rem;
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.rule-icon-info {
    color: #0284c7;
    font-size: 1rem;
    margin-top: 0.15rem;
    flex-shrink: 0;
}

/* VISTA DE DETALLE DEL TEMA (THREAD) */
.thread-card {
    background: #ffffff;
    border: 1px solid var(--foro-border);
    border-radius: 16px;
    padding: 2.2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 18px rgba(0,0,0,0.03);
}

.thread-breadcrumb {
    margin-bottom: 1.2rem;
    font-size: 0.88rem;
    color: var(--foro-text-muted);
}

.thread-breadcrumb a {
    color: var(--foro-accent);
    text-decoration: none;
}

.thread-breadcrumb a:hover {
    text-decoration: underline;
}

.thread-main-title {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--foro-primary);
    line-height: 1.35;
    margin-bottom: 1rem;
}

.thread-author-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.9rem 0;
    margin-bottom: 1.5rem;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

.thread-body {
    font-size: 1.04rem;
    line-height: 1.75;
    color: #243242;
    margin-bottom: 1.8rem;
    white-space: pre-line;
}

.thread-code-box {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 10px;
    padding: 1.2rem 1.4rem;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.92rem;
    line-height: 1.6;
    overflow-x: auto;
    margin: 1.2rem 0 1.8rem 0;
    border-left: 4px solid var(--foro-gold);
}

.thread-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1.2rem;
    border-top: 1px dashed var(--foro-border);
}

/* Sección de Respuestas */
.replies-section {
    margin-top: 2rem;
}

.replies-heading {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--foro-primary);
    margin-bottom: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.reply-card {
    background: #ffffff;
    border: 1px solid var(--foro-border);
    border-radius: 14px;
    padding: 1.6rem;
    margin-bottom: 1.2rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    transition: border-color 0.2s ease;
}

.reply-card.is-solution {
    border-color: #86efac;
    background: #f0fdf4;
}

.reply-card.new-reply-highlight {
    animation: replyHighlight 2.5s ease;
    border-color: #34d399;
}

@keyframes replyHighlight {
    0% {
        background-color: #ecfdf5;
        border-color: #10b981;
        transform: translateY(8px);
        opacity: 0;
    }
    30% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        background-color: #ffffff;
        border-color: var(--foro-border);
    }
}

.solution-badge {
    background: #22c55e;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.9rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.reply-content {
    font-size: 0.98rem;
    line-height: 1.68;
    color: #334155;
    white-space: pre-line;
}

/* Formulario de Respuesta / Creación */
.form-card {
    background: #ffffff;
    border: 1px solid var(--foro-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.03);
    margin-top: 2rem;
}

.form-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--foro-primary);
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    font-size: 0.88rem;
    color: #334155;
    margin-bottom: 0.4rem;
}

.form-control-custom {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--foro-border);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    background: #f8fafc;
}

.form-control-custom:focus {
    background: #ffffff;
    border-color: var(--foro-accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--foro-accent-glow);
}

/* BANNER DE ALERTA DE MODERACIÓN INTERACTIVO (EN VIVO) */
.moderation-alert-box {
    display: none;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.2rem;
    animation: fadeInDown 0.3s ease;
}

.moderation-alert-box.alert-insult {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
}

.moderation-alert-box.alert-promo {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.moderation-alert-box.alert-success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.moderation-alert-box h5 {
    font-size: 0.98rem;
    font-weight: 700;
    margin: 0 0 0.35rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.moderation-alert-box p {
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 0;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal de Nuevo Tema */
.modal-foro-header {
    background: var(--foro-primary);
    color: #ffffff;
    border-radius: 14px 14px 0 0;
    padding: 1.3rem 1.6rem;
}

.modal-foro-header .modal-title {
    color: #ffffff;
    font-weight: 700;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-foro-header .close {
    color: #ffffff;
    opacity: 0.85;
    text-shadow: none;
}

.modal-foro-header .close:hover {
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .foro-hero-card {
        padding: 1.6rem 1.3rem;
    }
    .foro-hero-title {
        font-size: 1.6rem;
    }
    .foro-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .btn-crear-tema {
        width: 100%;
        justify-content: center;
    }
    .thread-card {
        padding: 1.4rem 1rem;
    }
    .topic-card {
        padding: 1.1rem;
    }
}
