/**
 * CRM Print Solution - Estilos
 * Fuente: Poppins
 * Actualizado: Colores de estados
 */

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

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-light: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Icono de Login - Posicionado abajo a la derecha */
#iconoLogin {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 1000 !important;
    margin: 0 !important;
    padding: 0 !important;
    top: auto !important;
    left: auto !important;
}

/* Asegurar que cualquier elemento dentro del icono de login también respete la posición */
#iconoLogin > *,
#iconoLogin > div,
#iconoLogin > a,
#iconoLogin > button {
    position: relative !important;
}

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

/* Header */
.header {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    padding: 1.5rem 0;
    margin-bottom: 2rem;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.header-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
    cursor: pointer;
    transition: opacity 0.2s;
}

.header-logo:hover {
    opacity: 0.8;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
}

.nav {
    display: flex;
    gap: 1rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-color);
    border-radius: 0.375rem;
    transition: all 0.2s;
    font-weight: 500;
}

.nav-link:hover {
    background-color: var(--bg-color);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: var(--primary-color);
    color: white;
}

/* Main Content */
.main-content {
    padding-bottom: 2rem;
}

.main-content h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    margin-bottom: 0;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-card.alert {
    border-left: 4px solid var(--warning-color);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.stat-info p {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Sections */
.section {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.section h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.375rem;
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    font-size: 0.875rem;
}

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

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

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

.btn-secondary:hover {
    background-color: #475569;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

/* Botones de archivar */
.btn-archive {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
}

.btn-archive:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

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

.btn-unarchive {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
}

.btn-unarchive:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

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

.btn-archive-sm {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-family: 'Poppins', sans-serif;
}

.btn-archive-sm:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(220, 38, 38, 0.3);
}

.btn-unarchive-sm {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-family: 'Poppins', sans-serif;
}

.btn-unarchive-sm:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(16, 185, 129, 0.3);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 500;
}

.badge-primary {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-secondary {
    background-color: #f1f5f9;
    color: #475569;
}

/* Colores específicos para estados de contactos */
.badge-estado-nuevo {
    background-color: #3b82f6;
    color: white;
}

.badge-estado-espero {
    background-color: #ec4899;
    color: white;
}

.badge-estado-presupuesto {
    background-color: #06b6d4;
    color: white;
}

.badge-estado-negociacion {
    background-color: #f59e0b;
    color: white;
}

.badge-estado-convertido {
    background-color: #10b981;
    color: white;
}

.badge-estado-perdido {
    background-color: #ef4444;
    color: white;
}

/* Estilos para filas con alertas disparadas */
.seguimiento-disparado {
    background-color: #d1fae5 !important; /* Verde claro - seguimiento de hoy */
}

.seguimiento-disparado td {
    background-color: #d1fae5 !important; /* Verde claro - seguimiento de hoy */
}

.seguimiento-pasado {
    background-color: #fee2e2 !important; /* Rojo claro - seguimiento pasado */
}

.seguimiento-pasado td {
    background-color: #fee2e2 !important; /* Rojo claro - seguimiento pasado */
}

.seguimiento-pendiente {
    /* Blanco - sin color de fondo, seguimiento futuro */
}

.fila-archivada {
    opacity: 0.6;
    background-color: #f8f9fa !important;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Poppins', sans-serif;
    table-layout: fixed;
}

/* Asegurar que las filas expandidas no cambien el ancho de la tabla */
.interacciones-row {
    width: 100% !important;
}

.interacciones-row td {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden;
    word-wrap: break-word;
}

.table thead {
    background-color: var(--bg-color);
}

.table th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    overflow: hidden;
    word-wrap: break-word;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: var(--bg-color);
}

.table tbody tr.seguimiento-disparado:hover {
    background-color: #a7f3d0 !important;
}

.table tbody tr.seguimiento-pasado:hover {
    background-color: #fecaca !important;
}

/* Fijar altura del input de asunto para que no cambie al expandir */
.asunto-input {
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
    padding: 0.25rem 0.5rem !important;
    vertical-align: middle !important;
}

.notas-input {
    min-height: 32px !important;
    max-height: 80px !important;
    line-height: 1.5 !important;
    box-sizing: border-box !important;
    padding: 0.25rem 0.5rem !important;
    vertical-align: middle !important;
    resize: vertical !important;
    overflow-y: auto !important;
}

/* Asegurar que el td que contiene el asunto mantenga la altura */
.table tbody td:first-child {
    vertical-align: middle !important;
}

/* Ocultar header expandido en desktop (se mostrará solo en móvil) */
.interacciones-row .contacto-expandido-header {
    display: none;
}

/* Filters */
.filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    text-decoration: none;
    color: var(--text-color);
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    transition: all 0.2s;
    background: var(--card-bg);
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

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

.estado-dropzone {
    cursor: grab;
}

.estado-dropzone:hover {
    cursor: grab;
}

.contacto-row[draggable="true"] {
    cursor: grab;
}

.contacto-row[draggable="true"]:active {
    cursor: grabbing;
}

/* Contacto Detail */
.contacto-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.contacto-header h3 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.contacto-header .email {
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.contacto-stats {
    display: flex;
    gap: 2rem;
}

.stat-mini {
    text-align: center;
}

.stat-mini strong {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-mini span {
    font-size: 0.75rem;
    color: var(--text-light);
}

.contacto-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-item.full-width {
    grid-column: 1 / -1;
}

.info-item label {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-light);
}

.info-item span,
.info-item p {
    color: var(--text-color);
}

/* Actions Grid */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.action-btn {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--card-bg);
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.action-btn:hover {
    border-color: var(--primary-color);
    background-color: var(--bg-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Alertas */
.alertas-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.alerta-item {
    display: flex;
    justify-content: space-between;
    align-items: start;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--card-bg);
}

.alerta-item.completada {
    opacity: 0.6;
    background: var(--bg-color);
}

.alerta-item.vencida {
    background: #d1fae5;
    border-left: 4px solid #10b981;
}

.alerta-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.alerta-content p {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.alerta-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Interacciones */
.interacciones-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.interaccion-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    background: var(--card-bg);
}

.interaccion-icon {
    font-size: 2rem;
}

.interaccion-content h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.interaccion-content p {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.interaccion-fecha {
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-color);
    font-family: 'Poppins', sans-serif;
}

.form-control {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-family: 'Poppins', sans-serif;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

.checkbox-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 400;
    cursor: pointer;
}

.quick-alerts {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 8% auto;
    padding: 2rem;
    border-radius: 0.5rem;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
    position: relative;
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: var(--text-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    font-style: italic;
}

/* Estilo para "Agenda del" y fecha - 2rem en escritorio */
.agenda-del-text {
    font-size: 2rem !important;
    }
    
.fecha-agenda-input {
    font-size: 2rem !important;
}

/* Protección de contenido - hacer ilegible cuando no está logueado */
body.cmr-no-autorizado .container {
    filter: blur(10px);
    opacity: 0.3;
    pointer-events: none;
    user-select: none;
    transition: filter 0.3s ease, opacity 0.3s ease;
}

body.cmr-autorizado .container {
    filter: none;
    opacity: 1;
    pointer-events: auto;
    user-select: auto;
}

