/* ========================================
   TABLA MODERNA DE CLIENTES
   ======================================== */

.clientes-table-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Header con búsqueda y acciones */
.clientes-table-header {
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.clientes-table-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: #111827;
}

.clientes-header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.clientes-search {
    position: relative;
    min-width: 300px;
}

.clientes-search input {
    width: 100%;
    padding: 10px 40px 10px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}

.clientes-search input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.clientes-search i {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

/* Filtros rápidos (tabs) */
.clientes-table-filters {
    padding: 0 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    overflow-x: auto;
}

.filter-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.filter-tab:hover {
    color: #111827;
    background: #f9fafb;
}

.filter-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.filter-tab .count {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    background: #e5e7eb;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.filter-tab.active .count {
    background: #dbeafe;
    color: #3b82f6;
}

/* Tabla */
.clientes-table {
    width: 100%;
    border-collapse: collapse;
}

.clientes-table thead {
    background: #f9fafb;
}

.clientes-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: 0.05em;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.clientes-table th:hover {
    background: #f3f4f6;
}

.clientes-table th.sortable::after {
    content: '↕️';
    margin-left: 6px;
    opacity: 0.3;
}

.clientes-table th.sort-asc::after {
    content: '↑';
    opacity: 1;
    color: #3b82f6;
}

.clientes-table th.sort-desc::after {
    content: '↓';
    opacity: 1;
    color: #3b82f6;
}

.clientes-table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background 0.2s;
}

.clientes-table tbody tr:hover {
    background: #f9fafb;
}

.clientes-table td {
    padding: 16px;
    font-size: 14px;
    color: #374151;
    vertical-align: middle;
}

/* Checkbox columna */
.clientes-table .checkbox-cell {
    width: 40px;
    text-align: center;
}

.clientes-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Columna Código */
.badge-codigo {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

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

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

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

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

/* Columna Cliente */
.cliente-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cliente-nombre {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
}

.cliente-detalles {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 12px;
}

.cliente-detalles span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Columna RFC */
.rfc-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rfc-codigo {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 13px;
}

.rfc-nacionalidad {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Columna Estado */
.badge-estado {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

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

.badge-estado.activo::before {
    content: '●';
    color: #10b981;
}

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

.badge-estado.inactivo::before {
    content: '⭕';
}

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

.badge-estado.pendiente::before {
    content: '⚠️';
}

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

.badge-estado.revision::before {
    content: '🔍';
}

/* Columna Contacto */
.contacto-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 13px;
}

.contacto-info a {
    color: #3b82f6;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.contacto-info a:hover {
    text-decoration: underline;
}

/* Columna Fecha */
.fecha-relativa {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
}

/* Columna Acciones */
.table-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-action {
    padding: 8px 12px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-action:hover {
    background: #e5e7eb;
    color: #111827;
}

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

.btn-action.primary:hover {
    background: #bfdbfe;
}

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

.btn-action.success:hover {
    background: #a7f3d0;
}

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

.btn-action.danger:hover {
    background: #fecaca;
}

/* Dropdown de más opciones */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    z-index: 1000;
    display: none;
}

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

.dropdown-menu button {
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background 0.2s;
}

.dropdown-menu button:hover {
    background: #f3f4f6;
}

.dropdown-menu button:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-menu button:last-child {
    border-radius: 0 0 8px 8px;
}

.dropdown-menu .divider {
    height: 1px;
    background: #e5e7eb;
    margin: 4px 0;
}

.dropdown-menu button.danger {
    color: #dc2626;
}

.dropdown-menu button.danger:hover {
    background: #fee2e2;
}

/* Paginación */
.clientes-table-pagination {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    font-size: 14px;
    color: #6b7280;
}

.pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination-controls button {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    background: white;
    color: #374151;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.pagination-controls button:hover:not(:disabled) {
    border-color: #3b82f6;
    color: #3b82f6;
}

.pagination-controls button.active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Acciones masivas */
.bulk-actions {
    padding: 12px 24px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    display: none;
    align-items: center;
    gap: 16px;
}

.bulk-actions.show {
    display: flex;
}

.bulk-actions-info {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.bulk-actions-buttons {
    display: flex;
    gap: 8px;
}

/* Loading state */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.spinner {
    border: 3px solid #f3f4f6;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
    padding: 60px 24px;
    text-align: center;
}

.empty-state i {
    font-size: 64px;
    color: #d1d5db;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 1024px) {
    .clientes-table-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .clientes-header-actions {
        flex-direction: column;
    }
    
    .clientes-search {
        min-width: 100%;
    }
}

@media (max-width: 768px) {
    .clientes-table {
        font-size: 12px;
    }
    
    .clientes-table th,
    .clientes-table td {
        padding: 12px 8px;
    }
    
    .cliente-detalles {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .table-actions {
        flex-direction: column;
    }
}
