/* =====================================================
   Comentarios de leads - estilos específicos
   ===================================================== */

/* --- Pestanyes principals (Comentaris / Sistema) --- */
.coment-maintabs {
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 0.5rem;
}
.coment-maintabs .nav-link {
    color: #6c757d;
    font-size: 12px;
    padding: 6px 12px;
    cursor: pointer;
}
.coment-maintabs .nav-link.active {
    color: #0d6efd;
    background: #f8f9fa;
    border-bottom: 2px solid #0d6efd;
    font-weight: 600;
}

/* --- Pestanyes de filtre per tipus --- */
.coment-tabs {
    gap: 4px;
    flex-wrap: wrap;
}
.coment-tabs .nav-link {
    padding: 3px 10px;
    font-size: 12px;
    color: #495057;
    background: #f1f3f5;
    border-radius: 14px;
    cursor: pointer;
    border: 1px solid transparent;
}
.coment-tabs .nav-link.active {
    background: #0d6efd;
    color: #fff;
}
.coment-tabs .nav-link:hover:not(.active) {
    background: #e9ecef;
}

/* --- Cerca comentaris --- */
.coment-search {
    font-size: 13px;
}

/* --- Card individual d'un comentari --- */
.coment-item {
    padding: 8px 10px;
    margin-bottom: 6px;
    border-radius: 8px;
    background: #fafbfc;
    border: 1px solid #eaecef;
    transition: background 0.15s;
}
.coment-item:hover {
    background: #f4f6f8;
}
.coment-item.coment-fijado {
    background: #fff8e1;
    border-color: #ffd54f;
}

.coment-header {
    margin-bottom: 4px;
    gap: 4px;
    flex-wrap: wrap;
}
.coment-header .coment-tipo-badge {
    font-size: 10px;
    padding: 3px 8px;
    font-weight: 500;
}
.coment-header .coment-fecha {
    font-size: 11px;
}
.coment-header .coment-editado {
    font-size: 10px;
    font-style: italic;
}
.coment-pin-icon {
    font-size: 11px;
}
.coment-actions {
    display: flex;
    gap: 2px;
    opacity: 0.5;
    transition: opacity 0.15s;
}
.coment-item:hover .coment-actions {
    opacity: 1;
}
.coment-actions .bt_prog {
    background: transparent;
    border: none;
    padding: 2px 5px;
    cursor: pointer;
    font-size: 11px;
}
.coment-actions .bt_prog:hover {
    background: #e9ecef;
    border-radius: 3px;
}

.coment-body {
    font-size: 13px;
    color: #212529;
    word-break: break-word;
}
.coment-body p:last-child {
    margin-bottom: 0;
}
.coment-body .mencion {
    background: #e7f3ff;
    color: #0d6efd;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.9em;
}

/* --- Adjunts --- */
.coment-adjuntos,
.coment-adjuntos-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.coment-adjunto-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #e9ecef;
    color: #495057;
    border-radius: 12px;
    font-size: 11px;
    text-decoration: none;
    cursor: pointer;
}
.coment-adjunto-chip:hover {
    background: #dee2e6;
    color: #212529;
    text-decoration: none;
}
.coment-adj-del {
    opacity: 0.6;
    cursor: pointer;
    margin-left: 3px;
}
.coment-adj-del:hover {
    opacity: 1;
    color: #dc3545;
}

/* --- Zona nou comentari --- */
.coment-nou {
    background: #fff;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    position: relative;
}
.coment-tipo-selector {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.coment-tipo-btn {
    font-size: 11px;
    padding: 3px 10px;
}
.coment-tipo-btn.active {
    background: #0d6efd !important;
    color: #fff !important;
    border-color: #0d6efd !important;
}

/* --- Trumbowyg integration tweaks --- */
.coment-nou .trumbowyg-box,
.coment-nou .trumbowyg-editor {
    min-height: 80px;
    margin: 0;
    font-size: 13px;
}
.coment-nou .trumbowyg-button-pane {
    background: #f8f9fa;
    border-bottom: 1px solid #e1e4e8;
}
.coment-edit-area .trumbowyg-box {
    min-height: 40px;
    margin: 0;
}
.coment-edit-area .trumbowyg-editor {
    min-height: 40px !important;
}

/* --- Autocomplete menciones --- */
.coment-mencion-dropdown {
    position: absolute;
    z-index: 1060;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    max-height: 220px;
    overflow-y: auto;
    min-width: 240px;
    padding: 4px 0;
    left: 10px;
    top: auto;
    margin-top: 4px;
}
.mencion-item {
    padding: 6px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}
.mencion-item:hover,
.mencion-item.active {
    background: #f1f3f5;
}
.mencion-inicials {
    display: inline-block;
    width: 28px;
    height: 28px;
    line-height: 28px;
    border-radius: 50%;
    background: #0d6efd;
    color: #fff;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
}
.mencion-nom {
    font-weight: 500;
}
.mencion-email {
    margin-left: auto;
}

/* --- Historial sistema --- */
.sistema-item {
    padding: 6px 4px;
    margin-bottom: 4px;
    border-bottom: 1px dashed #eaecef;
    font-size: 12px;
}
.sistema-item p {
    font-size: 12px;
}

/* --- Col·lapsibles del panel de gestió --- */
.panel-section-toggle {
    cursor: pointer;
    user-select: none;
}
.panel-section-toggle .collapse-arrow {
    transition: transform 0.2s ease;
    display: inline-block;
    transform: rotate(180deg); /* amunt = obert */
    font-size: 18px;
    color: #6c757d;
    flex-shrink: 0;
    vertical-align: middle;
}
.panel-section-toggle.collapsed .collapse-arrow {
    transform: rotate(0deg); /* avall = tancat */
}
.row_tit_mail .collapse-arrow {
    font-size: 18px !important;
}
.row_tit_mail .panel-tit {
    display: flex;
    align-items: center;
    gap: 6px;
}
.row_tit_mail .panel-tit i {
    font-size: 35px !important;
}

/* --- Resum de seccions col·lapsibles --- */
.panel-summary {
    display: inline-block;
    font-size: 11px;
    color: #6c757d;
    margin-left: 8px;
    font-weight: 400;
}
.panel-section-toggle:not(.collapsed) .panel-summary {
    display: none !important;
}

/* --- Responsive --- */
@media (max-width: 576px) {
    .coment-tabs {
        font-size: 11px;
    }
    .coment-header {
        font-size: 11px;
    }
    .coment-actions {
        opacity: 1;
    }
}
