/* ==========================================
   TAGS / ETIQUETAS DINÁMICAS
========================================== */

.tag-field {
    cursor: pointer;
    min-height: 45px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.tag-dropdown {
    display: none;
    position: relative;
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px;
    margin-top: 6px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.tag-dropdown.show {
    display: block;
}

.tag-selected {
    padding: 6px 10px;
    font-size: 0.85rem;
}

.remove-tag {
    margin-left: 6px;
    cursor: pointer;
    font-weight: bold;
}

.tag-option:hover,
.tag-option-edit:hover {
    background-color: #f1f5f9;
}

#selected-tags {
    background: #fff;
}

#selected-tags .badge {
    border-radius: 20px;
}

#tag-input-edit .selected-tag {
    margin-right: 6px;
}

#tag-dropdown-edit .tag-option-edit {
    cursor: pointer;
}

.tag-badge-edit {
    transition: 0.2s ease;
    opacity: 0.6;
}

.tag-badge-edit.selected {
    opacity: 1;
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.tag-input-edit {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.tag-option-edit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.tag-option-edit.is-selected {
    background-color: #eef4ff;
}

.tag-option-check {
    color: var(--crm-primary);
    font-size: 0.9rem;
}

/* ==========================================
   NOTAS
========================================== */

.notes-container {
    max-height: 300px;
    overflow-y: auto;
}

.note-card {
    background: #f8f9fa;
    transition: 0.2s ease;
}

.note-card:hover {
    background: #eef1f4;
}

.leads-header-actions .btn {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .leads-header-actions {
        width: 100%;
        justify-content: flex-start !important;
    }
}

.lead-checkbox-cell {
    width: 44px;
    min-width: 44px;
    text-align: center;
    vertical-align: middle;
}

.lead-checkbox-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 36px;
    margin: 0;
    cursor: pointer;
}

/* =========================
   TABLA LEADS - ESTILO CLARO
========================= */

.table-leads {
    background: #ffffff;
    border: 1px solid #e6e6e6;
    border-collapse: separate;
    border-spacing: 0;
}

.table-leads thead th {
    background: #ffffff;
    color: #4f5661;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: .05em;
    font-size: 12px;
    border-bottom: 1px solid #e6e6e6 !important;
    border-right: 1px solid #ececec;
    vertical-align: middle;
    text-align: center;
    padding: 14px 14px;
}

.table-leads thead th:last-child {
    border-right: 0;
}

.table-leads tbody td {
    background: #ffffff;
    color: #5f6b7a;
    border-bottom: 1px solid #ececec !important;
    border-right: 1px solid #f0f0f0;
    vertical-align: middle;
    text-align: center;
    padding: 16px 14px;
}

.table-leads tbody td:last-child {
    border-right: 0;
}

.table-leads tbody tr:hover td {
    background: #fafafa;
}

.table-leads strong {
    color: #5a6270;
    font-weight: 500;
}

.table-leads small,
.table-leads .text-muted {
    color: #7b8794 !important;
}

/* Header activo */
.table-leads th a,
.table-leads th .sortable-link {
    color: #4f5661;
    text-decoration: none;
    font-weight: 600;
}

.table-leads th a:hover,
.table-leads th .sortable-link:hover {
    color: #5c79d6;
}

.table-leads th.active,
.table-leads th.active a,
.table-leads th.active .sortable-link {
    color: #5c79d6 !important;
}

/* Checkbox */
.table-leads td:first-child,
.table-leads th:first-child {
    text-align: center;
    vertical-align: middle;
}

.table-leads input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #b8c0cc;
    margin: 0 auto;
    display: block;
}

/* FECHA (columna 2) a la izquierda */
.table-leads thead th:nth-child(2),
.table-leads tbody td:nth-child(2) {
    text-align: left;
}

.table-leads tbody td:nth-child(2) * {
    text-align: left !important;
}

/* CONTACTO (columna 3) a la izquierda */
.table-leads thead th:nth-child(3),
.table-leads tbody td:nth-child(3) {
    text-align: left;
}

.table-leads tbody td:nth-child(3) * {
    text-align: left !important;
}

/* ESTADO (columna 4) a la izquierda */
.table-leads thead th:nth-child(4),
.table-leads tbody td:nth-child(4) {
    text-align: left;
}

.table-leads tbody td:nth-child(4) * {
    text-align: left !important;
}

/* Notas a la izquierda si usas clase */
.table-leads td.col-notas {
    text-align: left;
}

.table-leads td.col-notas * {
    text-align: left;
}

/* Badges */
.table-leads .badge {
    display: inline-block;
    margin: 2px 2px;
}

/* =========================
   ACCIONES
========================= */

.lead-actions {
    display: grid;
    grid-template-columns: repeat(2, 30px);
    gap: 4px;
    justify-content: center;
    align-content: center;
    width: fit-content;
    margin: 0 auto;
}

.lead-actions .btn {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    border: 0 !important;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
    box-shadow: none !important;
}

.lead-actions .btn i {
    color: #ffffff;
    font-size: 14px;
    line-height: 1;
}

.table-leads td:last-child {
    text-align: center;
    vertical-align: middle;
}

/* Colores de acciones */
.btn-action-mail {
    background: #b974d7;
}

.btn-action-mail:hover {
    background: #aa62cb;
}

.btn-action-whatsapp {
    background: #63d36c;
}

.btn-action-whatsapp:hover {
    background: #51c45a;
}

.btn-action-simulacion {
    background: #6ab8b0;
}

.btn-action-simulacion:hover {
    background: #59a79f;
}

.btn-action-historial {
    background: #59acc2;
}

.btn-action-historial:hover {
    background: #489cb2;
}

.btn-action-edit {
    background: #5c79d6;
}

.btn-action-edit:hover {
    background: #4d69c3;
}